Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-08-05 07:46:10 -0400
committerUwe Stieber2014-08-05 07:46:10 -0400
commitc8dd066de621112e18a79dc394c6ba89d7dfad26 (patch)
tree2e05f3fac20a7df63a6d21e65ea5ba25d173fc3a
parenteaf2aa9db02c6800e565dbac0fc2ffdb67575c81 (diff)
downloadorg.eclipse.tcf-c8dd066de621112e18a79dc394c6ba89d7dfad26.tar.gz
org.eclipse.tcf-c8dd066de621112e18a79dc394c6ba89d7dfad26.tar.xz
org.eclipse.tcf-c8dd066de621112e18a79dc394c6ba89d7dfad26.zip
Target Explorer: Review and Fix handling of delegate services
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java16
4 files changed, 62 insertions, 13 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java
index 86fb76f58..313642eef 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java
@@ -25,6 +25,7 @@ import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
import org.eclipse.tcf.te.runtime.services.interfaces.IDelegateService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
@@ -110,8 +111,18 @@ public class StartDebuggerStep extends AbstractPeerNodeStep {
protected void internalDone(Object caller, IStatus status) {
if ((status == null || status.isOK()) && autoAttachAll) {
// Check if there is a delegate registered
- IDelegateService service = ServiceManager.getInstance().getService(node, IDelegateService.class, false);
- IDelegate delegate = service != null ? service.getDelegate(node, IDelegate.class) : null;
+ IDelegate delegate = null;
+ IService[] services = ServiceManager.getInstance().getServices(node, IDelegateService.class, false);
+ for (IService s : services) {
+ if (s instanceof IDelegateService) {
+ IDelegateService service = (IDelegateService) s;
+ IDelegate candidate = service.getDelegate(node, IDelegate.class);
+ if (candidate != null) {
+ delegate = candidate;
+ break;
+ }
+ }
+ }
if (delegate != null) {
delegate.postAttachDebugger(node, monitor, callback);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java
index 3b3e2dd80..b00bcd6fd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java
@@ -33,6 +33,7 @@ import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx
import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryType;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IDelegateService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
import org.eclipse.tcf.te.tcf.core.async.CallbackInvocationDelegate;
import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelChannelService;
import org.eclipse.tcf.te.tcf.core.model.services.AbstractModelService;
@@ -861,8 +862,18 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
@Override
protected void internalDone(Object caller, IStatus status) {
// Determine if a delegate is registered
- IDelegateService service = ServiceManager.getInstance().getService(channel.getRemotePeer(), IDelegateService.class, false);
- IRuntimeModelRefreshService.IDelegate delegate = service != null ? service.getDelegate(channel.getRemotePeer(), IRuntimeModelRefreshService.IDelegate.class) : null;
+ IRuntimeModelRefreshService.IDelegate delegate = null;
+ IService[] services = ServiceManager.getInstance().getServices(channel.getRemotePeer(), IDelegateService.class, false);
+ for (IService s : services) {
+ if (s instanceof IDelegateService) {
+ IDelegateService service = (IDelegateService) s;
+ IRuntimeModelRefreshService.IDelegate candidate = service.getDelegate(channel.getRemotePeer(), IRuntimeModelRefreshService.IDelegate.class);
+ if (candidate != null) {
+ delegate = candidate;
+ break;
+ }
+ }
+ }
// Run the post refresh context delegate
if (delegate == null) delegate = defaultDelegate;
@@ -958,8 +969,18 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
@Override
protected void internalDone(Object caller, IStatus status) {
// Determine if a delegate is registered
- IDelegateService service = ServiceManager.getInstance().getService(channel.getRemotePeer(), IDelegateService.class, false);
- IRuntimeModelRefreshService.IDelegate delegate = service != null ? service.getDelegate(channel.getRemotePeer(), IRuntimeModelRefreshService.IDelegate.class) : null;
+ IRuntimeModelRefreshService.IDelegate delegate = null;
+ IService[] services = ServiceManager.getInstance().getServices(channel.getRemotePeer(), IDelegateService.class, false);
+ for (IService s : services) {
+ if (s instanceof IDelegateService) {
+ IDelegateService service = (IDelegateService) s;
+ IRuntimeModelRefreshService.IDelegate candidate = service.getDelegate(channel.getRemotePeer(), IRuntimeModelRefreshService.IDelegate.class);
+ if (candidate != null) {
+ delegate = candidate;
+ break;
+ }
+ }
+ }
// Determine the node type
if (delegate != null) delegate.setNodeType(parentContextId, node);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java
index 574b13fd9..a4f9ad903 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java
@@ -24,6 +24,7 @@ import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx
import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryType;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IDelegateService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
import org.eclipse.tcf.te.tcf.core.model.services.AbstractModelService;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNodeProperties;
@@ -234,8 +235,18 @@ public class RuntimeModelUpdateService extends AbstractModelService<IRuntimeMode
managedPropertyNames.add(IProcessContextNodeProperties.PROPERTY_NAME);
// Determine if a delegate is registered
- IDelegateService service = ServiceManager.getInstance().getService(dst, IDelegateService.class, false);
- IRuntimeModelRefreshService.IDelegate delegate = service != null ? service.getDelegate(dst, IRuntimeModelRefreshService.IDelegate.class) : null;
+ IRuntimeModelRefreshService.IDelegate delegate = null;
+ IService[] services = ServiceManager.getInstance().getServices(dst, IDelegateService.class, false);
+ for (IService s : services) {
+ if (s instanceof IDelegateService) {
+ IDelegateService service = (IDelegateService) s;
+ IRuntimeModelRefreshService.IDelegate candidate = service.getDelegate(dst, IRuntimeModelRefreshService.IDelegate.class);
+ if (candidate != null) {
+ delegate = candidate;
+ break;
+ }
+ }
+ }
if (delegate == null && getModel().getService(IRuntimeModelRefreshService.class) instanceof RuntimeModelRefreshService) {
delegate = ((RuntimeModelRefreshService)getModel().getService(IRuntimeModelRefreshService.class)).defaultDelegate;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java
index bf76c5a5c..a75ca3e93 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java
@@ -22,6 +22,7 @@ import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
import org.eclipse.tcf.te.runtime.services.interfaces.IDelegateService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.steps.StartDebuggerStep.IDelegate;
@@ -44,11 +45,16 @@ public class StartDebugCommandHandler extends AbstractPeerNodeCommandHandler {
@Override
protected void internalDone(Object caller, IStatus status) {
// Check if there is a delegate registered
- IDelegateService service = ServiceManager.getInstance().getService(peerNode, IDelegateService.class, false);
- IDelegate delegate = service != null ? service.getDelegate(peerNode, IDelegate.class) : null;
-
- if (delegate != null) {
- delegate.postAttachDebugger(peerNode, monitor, new Callback());
+ IService[] services = ServiceManager.getInstance().getServices(peerNode, IDelegateService.class, false);
+ for (IService s : services) {
+ if (s instanceof IDelegateService) {
+ IDelegateService service = (IDelegateService) s;
+ IDelegate delegate = service.getDelegate(peerNode, IDelegate.class);
+ if (delegate != null) {
+ delegate.postAttachDebugger(peerNode, monitor, new Callback());
+ break;
+ }
+ }
}
}
});

Back to the top