Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-12-04 12:52:22 +0000
committerTobias Schwarz2015-01-22 10:34:40 +0000
commitd61edf9cbcc18dad5597c78e36c1b1cec562dcfd (patch)
tree6520cee78ac1df4ca1f94b7822b64ef376d30612
parentc2a929f797866484cc8ab0efe72e3ad8e14a904a (diff)
downloadorg.eclipse.tcf-d61edf9cbcc18dad5597c78e36c1b1cec562dcfd.tar.gz
org.eclipse.tcf-d61edf9cbcc18dad5597c78e36c1b1cec562dcfd.tar.xz
org.eclipse.tcf-d61edf9cbcc18dad5597c78e36c1b1cec562dcfd.zip
SM: use utility class for IDelegateService and IUIService delegate
access
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/ServiceUtils.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ISimulatorService.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java17
-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.java32
-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.java17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PIDLabelProvider.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PPIDLabelProvider.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/search/ProcessSearchable.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/OpenEditorHandler.java8
26 files changed, 125 insertions, 183 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/ServiceUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/ServiceUtils.java
new file mode 100644
index 000000000..40febe65a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/ServiceUtils.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.runtime.services;
+
+import org.eclipse.tcf.te.runtime.services.interfaces.IDelegateService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+
+/**
+ * ServiceUtils
+ */
+public final class ServiceUtils {
+
+ public static <V extends Object> V getUIServiceDelegate(Object context, Object delegateContext, Class<? extends V> delegateClass) {
+ IService[] services = ServiceManager.getInstance().getServices(context, IUIService.class, false);
+ for (IService service : services) {
+ V delegate = ((IUIService)service).getDelegate(delegateContext, delegateClass);
+ if (delegate != null) {
+ return delegate;
+ }
+ }
+
+ return null;
+ }
+
+ public static <V extends Object> V getDelegateServiceDelegate(Object context, Object delegateContext, Class<? extends V> delegateClass) {
+ IService[] services = ServiceManager.getInstance().getServices(context, IDelegateService.class, false);
+ for (IService service : services) {
+ V delegate = ((IDelegateService)service).getDelegate(delegateContext, delegateClass);
+ if (delegate != null) {
+ return delegate;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ISimulatorService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ISimulatorService.java
index c04e7a9d9..1f666c049 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ISimulatorService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ISimulatorService.java
@@ -35,6 +35,11 @@ public interface ISimulatorService extends IService {
public enum State { Stopped, Starting, Started, Stopping }
/**
+ * Get the name of the simulator.
+ */
+ public String getName();
+
+ /**
* Starts the simulator.
*
* @param context The context. Must not be <code>null</code>.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
index f8db185ea..8d68fec45 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
@@ -13,8 +13,7 @@ package org.eclipse.tcf.te.tcf.filesystem.ui.nls;
import java.lang.reflect.Field;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.IFileSystemUIDelegate;
/**
@@ -80,8 +79,7 @@ public class Messages extends NLS {
*/
public static String getStringDelegated(Object context, String key) {
if (key != null) {
- IUIService service = ServiceManager.getInstance().getService(context, IUIService.class);
- IFileSystemUIDelegate delegate = service != null ? service.getDelegate(context, IFileSystemUIDelegate.class) : null;
+ IFileSystemUIDelegate delegate = ServiceUtils.getUIServiceDelegate(context, context, IFileSystemUIDelegate.class);
return delegate != null ? delegate.getMessage(key) : null;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java
index 329fe50e9..39cb66ac0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java
@@ -25,8 +25,7 @@ import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPe
import org.eclipse.tcf.te.launch.core.selection.interfaces.IRemoteSelectionContext;
import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.runtime.services.interfaces.delegates.ILabelProviderDelegate;
import org.eclipse.tcf.te.tcf.launch.core.interfaces.steps.ITcfLaunchStepAttributes;
@@ -133,14 +132,9 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
private String getDefaultLaunchName(IModelNode context) {
if (context != null) {
- IUIService uiService = ServiceManager.getInstance().getService(context, IUIService.class);
- if (uiService != null) {
- ILabelProviderDelegate labelProviderDelegate = uiService.getDelegate(context, ILabelProviderDelegate.class);
- if (labelProviderDelegate != null) {
- return labelProviderDelegate.getText(context);
- }
- }
- return context.getName();
+ ILabelProviderDelegate delegate = ServiceUtils.getUIServiceDelegate(context, context, ILabelProviderDelegate.class);
+ String name = delegate != null ? delegate.getText(context) : null;
+ return name != null ? name : context.getName();
}
return ""; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java
index df269ae0d..4440bb1aa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java
@@ -29,8 +29,7 @@ import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableNodeProperties;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
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.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.core.Tcf;
import org.eclipse.tcf.te.tcf.core.interfaces.IPeerProperties;
import org.eclipse.tcf.te.tcf.core.peers.Peer;
@@ -216,12 +215,7 @@ public class PeerModelRefreshService extends AbstractPeerModelService implements
}
// Construct the peer from the attributes
IPeer peer = new Peer(attrs);
-
- IPeerModelMigrationDelegate delegate = null;
- for (IService delegateService : ServiceManager.getInstance().getServices(peer, IDelegateService.class, false)) {
- delegate = ((IDelegateService)delegateService).getDelegate(peer, IPeerModelMigrationDelegate.class);
- if (delegate != null) break;
- }
+ IPeerModelMigrationDelegate delegate = ServiceUtils.getDelegateServiceDelegate(peer, peer, IPeerModelMigrationDelegate.class);
if (delegate != null) {
Version activeVersion = delegate.getVersion();
String version = attrs.get(IPeerProperties.PROP_VERSION);
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 2e2c62f34..3a64d1247 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
@@ -23,9 +23,8 @@ import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
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;
@@ -119,19 +118,7 @@ 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
- 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;
- }
- }
- }
-
+ IDelegate delegate = ServiceUtils.getDelegateServiceDelegate(node, node, IDelegate.class);
if (delegate != null) {
delegate.postAttachDebugger(node, monitor, callback);
} else {
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 b00bcd6fd..cfcfe1dab 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
@@ -31,9 +31,7 @@ import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx;
import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryState;
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.runtime.services.ServiceUtils;
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;
@@ -862,19 +860,7 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
@Override
protected void internalDone(Object caller, IStatus status) {
// Determine if a delegate is registered
- 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;
- }
- }
- }
-
+ IRuntimeModelRefreshService.IDelegate delegate = ServiceUtils.getDelegateServiceDelegate(channel.getRemotePeer(), channel.getRemotePeer(), IRuntimeModelRefreshService.IDelegate.class);
// Run the post refresh context delegate
if (delegate == null) delegate = defaultDelegate;
Assert.isNotNull(delegate);
@@ -969,19 +955,7 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
@Override
protected void internalDone(Object caller, IStatus status) {
// Determine if a delegate is registered
- 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;
- }
- }
- }
-
+ IRuntimeModelRefreshService.IDelegate delegate = ServiceUtils.getDelegateServiceDelegate(channel.getRemotePeer(), channel.getRemotePeer(), IRuntimeModelRefreshService.IDelegate.class);
// Determine the node type
if (delegate != null) delegate.setNodeType(parentContextId, node);
// Fallback to the default delegate if node type is not set by delegate
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 a4f9ad903..28939e208 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
@@ -22,9 +22,7 @@ import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx;
import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryState;
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.runtime.services.ServiceUtils;
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;
@@ -235,18 +233,7 @@ public class RuntimeModelUpdateService extends AbstractModelService<IRuntimeMode
managedPropertyNames.add(IProcessContextNodeProperties.PROPERTY_NAME);
// Determine if a delegate is registered
- 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;
- }
- }
- }
+ IRuntimeModelRefreshService.IDelegate delegate = ServiceUtils.getDelegateServiceDelegate(dst, dst, IRuntimeModelRefreshService.IDelegate.class);
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.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java
index 183ab5d1c..44f7f5627 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java
@@ -20,8 +20,7 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.tcf.te.runtime.events.ChangeEvent;
import org.eclipse.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
import org.eclipse.tcf.te.tcf.processes.ui.interfaces.IProcessMonitorUIDelegate;
@@ -153,9 +152,8 @@ public class ProcessMonitorEditorPage extends AbstractTreeViewerExplorerEditorPa
@Override
protected int getAutoExpandLevel() {
if (ProcessMonitorEditorPage.this.getEditorInputNode() instanceof IPeerNode) {
- IPeerNode node = (IPeerNode)ProcessMonitorEditorPage.this.getEditorInputNode();
- IUIService service = ServiceManager.getInstance().getService(node, IUIService.class);
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(node, IProcessMonitorUIDelegate.class) : null;
+ IPeerNode peerNode = (IPeerNode)ProcessMonitorEditorPage.this.getEditorInputNode();
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
if (delegate != null) {
return delegate.getAutoExpandLevel();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PIDLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PIDLabelProvider.java
index bc5e53f02..91874ed12 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PIDLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PIDLabelProvider.java
@@ -13,8 +13,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
@@ -56,9 +55,7 @@ public class PIDLabelProvider extends AbstractLabelProviderDelegate {
if (id.startsWith("P")) id = id.substring(1); //$NON-NLS-1$
IPeerNode peerNode = (IPeerNode)node.getAdapter(IPeerNode.class);
- IUIService service = peerNode != null ? ServiceManager.getInstance().getService(peerNode, IUIService.class) : null;
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(peerNode, IProcessMonitorUIDelegate.class) : null;
-
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
String newId = delegate != null ? delegate.getText(element, "PID", id) : null; //$NON-NLS-1$
return newId != null ? newId : id;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PPIDLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PPIDLabelProvider.java
index 2f94110c8..613ab623a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PPIDLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/columns/PPIDLabelProvider.java
@@ -13,8 +13,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
@@ -54,9 +53,7 @@ public class PPIDLabelProvider extends AbstractLabelProviderDelegate {
String id = ppid.get() >= 0 ? Long.toString(ppid.get()) : ""; //$NON-NLS-1$
IPeerNode peerNode = (IPeerNode)node.getAdapter(IPeerNode.class);
- IUIService service = peerNode != null ? ServiceManager.getInstance().getService(peerNode, IUIService.class) : null;
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(peerNode, IProcessMonitorUIDelegate.class) : null;
-
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
String newId = delegate != null ? delegate.getText(element, "PPID", id) : null; //$NON-NLS-1$
return newId != null ? newId : id;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java
index e7417f14a..59d0f987d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java
@@ -20,8 +20,7 @@ import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.callback.AsyncCallbackCollector;
import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
@@ -85,11 +84,8 @@ public class RefreshProcessListHandler extends AbstractHandler implements IEleme
IWorkbenchPart part = site.getPart();
if (part instanceof IEditorPart) {
IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
- IPeerNode node = editorInput != null ? (IPeerNode) editorInput.getAdapter(IPeerNode.class) : null;
-
- IUIService service = ServiceManager.getInstance().getService(node, IUIService.class);
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(node, IProcessMonitorUIDelegate.class) : null;
-
+ IPeerNode peerNode = editorInput != null ? (IPeerNode) editorInput.getAdapter(IPeerNode.class) : null;
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
if (delegate != null) {
String text = delegate.getMessage("RefreshProcessListHandler_updateElement_text"); //$NON-NLS-1$
if (text != null) element.setText(text);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java
index 62c511baa..a6ec41261 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java
@@ -22,8 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil;
import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
@@ -80,9 +79,8 @@ public class TerminateHandler extends AbstractHandler implements IElementUpdater
model.getService(IModelRefreshService.class).refresh(process, new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
- IPeerNode node = process.getParent(IRuntimeModel.class).getPeerNode();
- IUIService service = ServiceManager.getInstance().getService(node, IUIService.class);
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(node, IProcessMonitorUIDelegate.class) : null;
+ IPeerNode peerNode = process.getParent(IRuntimeModel.class).getPeerNode();
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
String text = delegate != null ? delegate.getMessage("TerminateHandler_terminateFailed") : null; //$NON-NLS-1$
// Build up the message template
String template = NLS.bind(text != null ? text : Messages.TerminateHandler_terminateFailed, process.getName(), Messages.PossibleCause);
@@ -113,11 +111,8 @@ public class TerminateHandler extends AbstractHandler implements IElementUpdater
IWorkbenchPart part = site.getPart();
if (part instanceof IEditorPart) {
IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
- IPeerNode node = editorInput != null ? (IPeerNode) editorInput.getAdapter(IPeerNode.class) : null;
-
- IUIService service = ServiceManager.getInstance().getService(node, IUIService.class);
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(node, IProcessMonitorUIDelegate.class) : null;
-
+ IPeerNode peerNode = editorInput != null ? (IPeerNode) editorInput.getAdapter(IPeerNode.class) : null;
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
if (delegate != null) {
String text = delegate.getMessage("TerminateHandler_updateElement_text"); //$NON-NLS-1$
if (text != null) element.setText(text);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java
index 49cec1ddb..2e994cfb5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/AttachContextSelectionDialog.java
@@ -51,8 +51,7 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.core.interfaces.IContextDataProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.utils.PeerNodeDataHelper;
@@ -219,8 +218,7 @@ public class AttachContextSelectionDialog extends CustomTitleAreaDialog implemen
String id = pid.get() >= 0 ? Long.toString(pid.get()) : ""; //$NON-NLS-1$
if (id.startsWith("P")) id = id.substring(1); //$NON-NLS-1$
IPeerNode peerNode = (IPeerNode)((IProcessContextNode)element).getAdapter(IPeerNode.class);
- IUIService service = peerNode != null ? ServiceManager.getInstance().getService(peerNode, IUIService.class) : null;
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(peerNode, IProcessMonitorUIDelegate.class) : null;
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
String newId = delegate != null ? delegate.getText(element, "PID", id) : null; //$NON-NLS-1$
if (newId != null) {
text = NLS.bind(Messages.AttachContextSelectionDialog_pid_decoration, text, newId);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java
index f09b70ee6..3f073a862 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java
@@ -9,8 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.processes.ui.internal.properties;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.processes.ui.interfaces.IProcessMonitorUIDelegate;
@@ -25,9 +24,7 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
// Get the UI delegate for the context (== receiver)
- IUIService service = ServiceManager.getInstance().getService(receiver, IUIService.class);
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(receiver, IProcessMonitorUIDelegate.class) : null;
-
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(receiver, receiver, IProcessMonitorUIDelegate.class);
if ("isColumnActive".equals(property) || "isFilterActive".equals(property)) { //$NON-NLS-1$ //$NON-NLS-2$
// If no delegate is registered for the context, the column or filter are treated as active (== no activation expression)
if (delegate == null) return true;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java
index 06e15be70..284ead5a2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java
@@ -15,8 +15,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
@@ -104,8 +103,7 @@ public class ContextIDSection extends BaseTitledSection {
@Override
public void refresh() {
IPeerNode peerNode = (IPeerNode)node.getAdapter(IPeerNode.class);
- IUIService service = peerNode != null ? ServiceManager.getInstance().getService(peerNode, IUIService.class) : null;
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(peerNode, IProcessMonitorUIDelegate.class) : null;
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
String label = delegate != null ? delegate.getMessage("ContextIDSection_PID") : null; //$NON-NLS-1$
if (label != null) SWTControlUtil.setText(pidLabel, label);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java
index 9264e956a..66bf54b6d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java
@@ -15,8 +15,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
@@ -94,8 +93,7 @@ public class IDSection extends BaseTitledSection {
@Override
public void refresh() {
IPeerNode peerNode = (IPeerNode)node.getAdapter(IPeerNode.class);
- IUIService service = peerNode != null ? ServiceManager.getInstance().getService(peerNode, IUIService.class) : null;
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(peerNode, IProcessMonitorUIDelegate.class) : null;
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
String label = delegate != null ? delegate.getMessage("IDSection_Title") : null; //$NON-NLS-1$
if (label != null && section != null && !section.isDisposed()) section.setText(label);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
index bd0d75671..5cd00da39 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
@@ -10,8 +10,7 @@
package org.eclipse.tcf.te.tcf.processes.ui.nls;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.processes.ui.interfaces.IProcessMonitorUIDelegate;
/**
@@ -43,8 +42,7 @@ public class Messages extends NLS {
*/
public static String getStringDelegated(Object context, String key) {
if (key != null) {
- IUIService service = ServiceManager.getInstance().getService(context, IUIService.class);
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(context, IProcessMonitorUIDelegate.class) : null;
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(context, context, IProcessMonitorUIDelegate.class);
return delegate != null ? delegate.getMessage(key) : null;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/search/ProcessSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/search/ProcessSearchable.java
index 5bbe920d2..62b27f201 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/search/ProcessSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/search/ProcessSearchable.java
@@ -16,8 +16,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
import org.eclipse.tcf.te.tcf.processes.ui.interfaces.IProcessMonitorUIDelegate;
@@ -39,12 +38,11 @@ public class ProcessSearchable extends CompositeSearchable {
*
* @param node The peer model node context. Must not be <code>null</code>.
*/
- public ProcessSearchable(IPeerNode node) {
+ public ProcessSearchable(IPeerNode peerNode) {
super();
- IUIService service = ServiceManager.getInstance().getService(node, IUIService.class);
- IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(node, IProcessMonitorUIDelegate.class) : null;
- ISearchable[] searchables = delegate != null ? delegate.getSearchables(node) : null;
+ IProcessMonitorUIDelegate delegate = ServiceUtils.getUIServiceDelegate(peerNode, peerNode, IProcessMonitorUIDelegate.class);
+ ISearchable[] searchables = delegate != null ? delegate.getSearchables(peerNode) : null;
if (searchables == null) {
searchables = new ISearchable[] { new GeneralSearchable(), new ProcessUserSearchable(), new ProcessStateSearchable() };
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java
index 0c11ef298..7390874be 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java
@@ -36,7 +36,7 @@ import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil;
import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
@@ -127,8 +127,7 @@ public class DeleteHandler extends AbstractHandler {
}
// Check if there is a delete handler delegate for the element
- IUIService service = ServiceManager.getInstance().getService(element, IUIService.class);
- IDeleteHandlerDelegate delegate = service != null ? service.getDelegate(element, IDeleteHandlerDelegate.class) : null;
+ IDeleteHandlerDelegate delegate = ServiceUtils.getUIServiceDelegate(element, element, IDeleteHandlerDelegate.class);
// If a delegate is available, ask the handler first if the given element is currently deletable
if (delegate != null) canDelete = delegate.canDelete(treePath);
@@ -181,8 +180,7 @@ public class DeleteHandler extends AbstractHandler {
}
// Check if there is a delete handler delegate for the element
- IUIService uiService = ServiceManager.getInstance().getService(node, IUIService.class);
- IDeleteHandlerDelegate delegate = uiService != null ? uiService.getDelegate(node, IDeleteHandlerDelegate.class) : null;
+ IDeleteHandlerDelegate delegate = ServiceUtils.getUIServiceDelegate(node, node, IDeleteHandlerDelegate.class);
// If a delegate is available, signal the execution of the remove
if (delegate != null) delegate.postDelete(node);
}
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 a75ca3e93..e64fc1442 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
@@ -20,9 +20,8 @@ import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
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;
@@ -45,16 +44,9 @@ public class StartDebugCommandHandler extends AbstractPeerNodeCommandHandler {
@Override
protected void internalDone(Object caller, IStatus status) {
// Check if there is a delegate registered
- 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;
- }
- }
+ IDelegate delegate = ServiceUtils.getDelegateServiceDelegate(peerNode, peerNode, IDelegate.class);
+ if (delegate != null) {
+ delegate.postAttachDebugger(peerNode, monitor, new Callback());
}
}
});
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
index 95afabcb8..60c77ff3b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
@@ -32,8 +32,7 @@ import org.eclipse.tcf.te.core.utils.ConnectStateHelper;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.persistence.utils.DataHelper;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
import org.eclipse.tcf.te.tcf.locator.utils.CommonUtils;
@@ -109,8 +108,7 @@ public class PeerNodePropertiesSectionContentProvider implements IStructuredCont
});
}
- IUIService service = ServiceManager.getInstance().getService(inputElement, IUIService.class);
- INodePropertiesTableUIDelegate delegate = service != null ? service.getDelegate(inputElement, INodePropertiesTableUIDelegate.class) : null;
+ INodePropertiesTableUIDelegate delegate = ServiceUtils.getUIServiceDelegate(inputElement, inputElement, INodePropertiesTableUIDelegate.class);
List<NodePropertiesTableTableNode> nodes = new ArrayList<NodePropertiesTableTableNode>();
for (Entry<String, Object> entry : properties.entrySet()) {
String name = entry.getKey();
@@ -129,7 +127,7 @@ public class PeerNodePropertiesSectionContentProvider implements IStructuredCont
if (delegate != null) delegate.expandNodesAfterSort(inputElement, nodes);
- ILabelProvider provider = service != null ? service.getDelegate(inputElement, ILabelProvider.class) : null;
+ ILabelProvider provider = ServiceUtils.getUIServiceDelegate(inputElement, inputElement, ILabelProvider.class);
List<NodePropertiesTableTableNode> result = new ArrayList<NodePropertiesTableTableNode>();
for (NodePropertiesTableTableNode node : nodes) {
// Possible replacement for the node properties table table node value
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
index 9f67d8be7..b9cde7c58 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
@@ -22,7 +22,6 @@ import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
import org.eclipse.tcf.te.runtime.services.interfaces.delegates.ILabelProviderDelegate;
import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorNode;
@@ -34,7 +33,6 @@ import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
import org.eclipse.tcf.te.tcf.ui.navigator.images.PeerNodeImageDescriptor;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.interfaces.ISimulatorServiceUIDelegate;
import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableTableNode;
import org.eclipse.ui.navigator.IDescriptionProvider;
@@ -118,19 +116,12 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe
NodePropertiesTableTableNode node = (NodePropertiesTableTableNode)element;
if ("SimulatorType".equals(node.name)) { //$NON-NLS-1$
- String type = null;
-
ISimulatorService service = ServiceManager.getInstance().getService(node.value, ISimulatorService.class, false);
if (service != null) {
- // Get the UI service which is associated with the simulator service
- IUIService uiService = ServiceManager.getInstance().getService(service, IUIService.class);
- // Get the simulator service UI delegate
- ISimulatorServiceUIDelegate uiDelegate = uiService != null ? uiService.getDelegate(service, ISimulatorServiceUIDelegate.class) : null;
- // Get the simulator service name
- type = uiDelegate != null ? uiDelegate.getName() : null;
+ return service.getName();
}
- return type != null && !"".equals(type) ? type : node.value; //$NON-NLS-1$
+ return node.value;
}
String key = "PeerLabelProviderDelegate_NodePropertiesTable_" + node.name.trim() + "_" + node.value.replaceAll("\\.", "_"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java
index 5be1e74f7..34dfbd886 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/interfaces/ISimulatorServiceUIDelegate.java
@@ -23,6 +23,7 @@ public interface ISimulatorServiceUIDelegate {
public static final String PROP_MODES = "Modes"; //$NON-NLS-1$
public static final String PROP_MODE_LABEL_X = "ModeLabel"; //$NON-NLS-1$
public static final String PROP_MODE_DESCRIPTION_X = "ModeDescription"; //$NON-NLS-1$
+ public static final String PROP_BSPS = "BSPs"; //$NON-NLS-1$
/**
* Get the simulator service the UI delegate is associated with.
@@ -39,6 +40,10 @@ public interface ISimulatorServiceUIDelegate {
*/
public String getName();
+ /**
+ * Get the image for the simulator service.
+ * @return The simulator image.
+ */
public Image getImage();
/**
@@ -58,5 +63,12 @@ public interface ISimulatorServiceUIDelegate {
*/
public IPropertiesContainer getProperties(Object context, String config);
+ /**
+ * Get the configuration panel for the given context and mode.
+ * @param context The context to configure.
+ * @param parentControl The parent control.
+ * @param mode The connection mode.
+ * @return
+ */
public IWizardConfigurationPanel getConfigPanel(Object context, BaseWizardConfigurationPanelControl parentControl, String mode);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java
index 776990519..dba10ecae 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java
@@ -9,8 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.views.expressions;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate;
import org.eclipse.tcf.te.ui.views.editor.Editor;
import org.eclipse.tcf.te.ui.views.extensions.EditorPageBindingExtensionPointManager;
@@ -29,9 +28,8 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if ("hasApplicableEditorBindings".equals(property)) { //$NON-NLS-1$
- IUIService service = ServiceManager.getInstance().getService(receiver, IUIService.class);
- IEditorHandlerDelegate delegate = service != null ? service.getDelegate(receiver, IEditorHandlerDelegate.class) : null;
- IEditorInput input = (delegate != null) ? delegate.getEditorInput(receiver) : null;
+ IEditorHandlerDelegate delegate = ServiceUtils.getUIServiceDelegate(receiver, receiver, IEditorHandlerDelegate.class);
+ IEditorInput input = delegate != null ? delegate.getEditorInput(receiver) : null;
return (expectedValue != null ? expectedValue : Boolean.TRUE).equals(
input != null ? Boolean.valueOf(EditorPageBindingExtensionPointManager.getInstance().getApplicableEditorPageBindings(input).length > 0) : Boolean.FALSE);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/OpenEditorHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/OpenEditorHandler.java
index 17a3543c9..89d050569 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/OpenEditorHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/OpenEditorHandler.java
@@ -20,8 +20,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
import org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate;
import org.eclipse.tcf.te.ui.views.activator.UIPlugin;
import org.eclipse.tcf.te.ui.views.editor.EditorInput;
@@ -97,9 +96,8 @@ public class OpenEditorHandler extends AbstractHandler {
// Get the active page
IWorkbenchPage page = window.getActivePage();
// Create the editor input object
- IUIService service = ServiceManager.getInstance().getService(element, IUIService.class);
- IEditorHandlerDelegate delegate = service != null ? service.getDelegate(element, IEditorHandlerDelegate.class) : null;
- IEditorInput input = (delegate != null) ? delegate.getEditorInput(element) : new EditorInput(element);
+ IEditorHandlerDelegate delegate = ServiceUtils.getUIServiceDelegate(element, element, IEditorHandlerDelegate.class);
+ IEditorInput input = delegate != null ? delegate.getEditorInput(element) : new EditorInput(element);
try {
// Opens the Target Explorer properties editor
IEditorPart editor = page.openEditor(input, IUIConstants.ID_EDITOR);

Back to the top