Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-12-04 12:52:22 +0000
committerTobias Schwarz2014-12-04 12:52:22 +0000
commit10d3941cf430a62238b7b714c3864bfde90f49d4 (patch)
treea0e7cb42e08721f64d4d2c33c2eac136ac44fb4b /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui
parentef49e0d82b06ca772ca0ad31b60c65b0325dcaef (diff)
downloadorg.eclipse.tcf-10d3941cf430a62238b7b714c3864bfde90f49d4.tar.gz
org.eclipse.tcf-10d3941cf430a62238b7b714c3864bfde90f49d4.tar.xz
org.eclipse.tcf-10d3941cf430a62238b7b714c3864bfde90f49d4.zip
SM: use utility class for IDelegateService and IUIService delegate
access
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui')
-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
4 files changed, 12 insertions, 33 deletions
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$

Back to the top