Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-02-23 02:41:12 -0500
committerWilliam Chen2012-02-23 03:45:12 -0500
commite2177d1ac6b3d7bb9cb45f26277e86654afa7c05 (patch)
treef7e2cc7700baeb4feaf367d1354fb1c8126c23c1
parent6b7603a0d5456013354456298dd01f2839a6d7d0 (diff)
downloadorg.eclipse.tcf-e2177d1ac6b3d7bb9cb45f26277e86654afa7c05.tar.gz
org.eclipse.tcf-e2177d1ac6b3d7bb9cb45f26277e86654afa7c05.tar.xz
org.eclipse.tcf-e2177d1ac6b3d7bb9cb45f26277e86654afa7c05.zip
Target Explorer: Refactoring: Remove bad smells (normal warnings from
FindBugs).
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneClose.java57
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneOpenChannel.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneReadDir.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneRoots.java7
4 files changed, 11 insertions, 65 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneClose.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneClose.java
deleted file mode 100644
index db2b786de..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneClose.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.internal.callbacks;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IFileSystem.DoneClose;
-import org.eclipse.tcf.services.IFileSystem.FileSystemException;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.filesystem.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
-
-/**
- * The callback handler that handles the event when a directory is closed.
- */
-public class QueryDoneClose implements DoneClose {
- // The tcf channel.
- IChannel channel;
- // The parent node being queried.
- FSTreeNode parentNode;
- // The callback object.
- ICallback callback;
-
- /**
- * Constructor
- *
- * @param callback The callback object.
- * @param channel The channel to close.
- * @param parentNode The parent node
- */
- public QueryDoneClose(ICallback callback, IChannel channel, FSTreeNode parentNode) {
- this.callback = callback;
- this.channel = channel;
- this.parentNode = parentNode;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.services.IFileSystem.DoneClose#doneClose(org.eclipse.tcf.protocol.IToken, org.eclipse.tcf.services.IFileSystem.FileSystemException)
- */
- @Override
- public void doneClose(IToken token, FileSystemException error) {
- if(callback != null) {
- IStatus status = error == null ? Status.OK_STATUS : new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), error.getLocalizedMessage(), error);
- callback.done(this, status);
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneOpenChannel.java
index 5b3f49669..b43d05a19 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneOpenChannel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneOpenChannel.java
@@ -75,7 +75,7 @@ public class QueryDoneOpenChannel implements DoneOpenChannel {
IFileSystem service = channel.getRemoteService(IFileSystem.class);
if(service != null) {
if(parentNode.isSystemRoot()) {
- service.roots(new QueryDoneRoots(proxy, channel, parentNode));
+ service.roots(new QueryDoneRoots(proxy, parentNode));
} else {
String absPath = parentNode.getLocation();
service.opendir(absPath, new QueryDoneOpen(proxy, channel, service, parentNode));
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneReadDir.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneReadDir.java
index 558c01fac..742e95d5d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneReadDir.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneReadDir.java
@@ -15,6 +15,7 @@ import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.services.IFileSystem;
import org.eclipse.tcf.services.IFileSystem.DirEntry;
+import org.eclipse.tcf.services.IFileSystem.DoneClose;
import org.eclipse.tcf.services.IFileSystem.DoneReadDir;
import org.eclipse.tcf.services.IFileSystem.FileSystemException;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
@@ -71,7 +72,14 @@ public class QueryDoneReadDir implements DoneReadDir {
if (eof) {
// Close the handle and channel if EOF is signaled or an error occurred.
- service.close(handle, new QueryDoneClose(callback, channel, parentNode));
+ service.close(handle, new DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ if(callback != null) {
+ IStatus status = error == null ? Status.OK_STATUS : new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), error.getLocalizedMessage(), error);
+ callback.done(this, status);
+ }
+ }});
}
else {
// And invoke ourself again
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneRoots.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneRoots.java
index b14ebedf1..7a1b01a9d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneRoots.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/callbacks/QueryDoneRoots.java
@@ -11,7 +11,6 @@ package org.eclipse.tcf.te.tcf.filesystem.internal.callbacks;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.services.IFileSystem.DirEntry;
import org.eclipse.tcf.services.IFileSystem.DoneRoots;
@@ -24,8 +23,6 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The callback handler that handles the event when the roots are listed.
*/
public class QueryDoneRoots implements DoneRoots {
- // The channel being used.
- IChannel channel;
// The parent directory node.
FSTreeNode parentNode;
// The callback object
@@ -35,12 +32,10 @@ public class QueryDoneRoots implements DoneRoots {
* Create an instance with parameters to initialize the fields.
*
* @param callback the callback.
- * @param channel The tcf channel.
* @param parentNode The parent directory node.
*/
- public QueryDoneRoots(ICallback callback, IChannel channel, FSTreeNode parentNode) {
+ public QueryDoneRoots(ICallback callback, FSTreeNode parentNode) {
this.callback = callback;
- this.channel = channel;
this.parentNode = parentNode;
}

Back to the top