Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-03-27 02:55:04 -0400
committerTobias Schwarz2013-03-27 03:07:28 -0400
commit231344a29237031e00014dcb390c3bf7f5af4ddd (patch)
treec9c6f9d81d97af81c2395ffaed7ed9ee1d36a420 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf
parent008cf1c36905598793946af1104c389932367306 (diff)
downloadorg.eclipse.tcf-231344a29237031e00014dcb390c3bf7f5af4ddd.tar.gz
org.eclipse.tcf-231344a29237031e00014dcb390c3bf7f5af4ddd.tar.xz
org.eclipse.tcf-231344a29237031e00014dcb390c3bf7f5af4ddd.zip
Target Explorer: fix refresh handler
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java
index 1064862bb..e626c2d34 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java
@@ -26,6 +26,7 @@ import org.eclipse.tcf.te.core.async.AsyncCallbackCollector;
import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.tcf.core.async.CallbackInvocationDelegate;
+import org.eclipse.tcf.te.tcf.locator.ScannerRunnable;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
@@ -71,7 +72,8 @@ public class RefreshHandler extends AbstractHandler {
// The selection must be a structured selection and must not be empty
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
// The list of locator model instances to refresh
- List<ILocatorModel> toRefresh = new ArrayList<ILocatorModel>();
+ List<ILocatorModel> locatorToRefresh = new ArrayList<ILocatorModel>();
+ List<IPeerModel> peerToRefresh = new ArrayList<IPeerModel>();
// Iterate the selection and determine the model instances
Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
@@ -84,15 +86,18 @@ public class RefreshHandler extends AbstractHandler {
ILocatorModel model = (ILocatorModel)node.getAdapter(ILocatorModel.class);
Assert.isNotNull(model);
// If not yet in the list, add it
- if (!toRefresh.contains(model)) {
- toRefresh.add(model);
+ if (!locatorToRefresh.contains(model)) {
+ locatorToRefresh.add(model);
+ }
+ if (!peerToRefresh.contains(node)) {
+ peerToRefresh.add(node);
}
}
// Trigger an refresh on all determined models and wait for the
// refresh to complete. Once completed, fire the parent callback.
AsyncCallbackCollector collector = new AsyncCallbackCollector(callback, new CallbackInvocationDelegate());
- for (ILocatorModel model : toRefresh) {
+ for (ILocatorModel model : locatorToRefresh) {
final ILocatorModel finModel = model;
final ICallback innerCallback = new AsyncCallbackCollector.SimpleCollectorCallback(collector);
@@ -109,6 +114,21 @@ public class RefreshHandler extends AbstractHandler {
};
Protocol.invokeLater(runnable);
}
+
+ for (IPeerModel model : peerToRefresh) {
+ final IPeerModel finModel = model;
+ final ICallback innerCallback = new AsyncCallbackCollector.SimpleCollectorCallback(collector);
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ new ScannerRunnable(null, finModel).run();
+ innerCallback.done(this, Status.OK_STATUS);
+ }
+ };
+ Protocol.invokeLater(runnable);
+ }
+
// Mark the collector as fully initialized
collector.initDone();
} else {

Back to the top