Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-08-04 08:36:46 -0400
committerTobias Schwarz2014-08-04 08:36:46 -0400
commit422f0ae1aaf1192cdbd88cdc5672b0b129537980 (patch)
tree4fcbaef6a7ee8d3a5362cf2005a1d5c82a8909c2
parented196c63bb8b7a817035ee8e46721e007dc0fc0c (diff)
downloadorg.eclipse.tcf-422f0ae1aaf1192cdbd88cdc5672b0b129537980.tar.gz
org.eclipse.tcf-422f0ae1aaf1192cdbd88cdc5672b0b129537980.tar.xz
org.eclipse.tcf-422f0ae1aaf1192cdbd88cdc5672b0b129537980.zip
Target Explorer: refactor stepper operation services
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IStepperServiceOperations.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java25
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/services/AbstractStepperOperationService.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/StepperOperationService.java)56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/StepperOperationService.java43
12 files changed, 136 insertions, 66 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java
index 76d7a7edf..5f9c29872 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java
@@ -99,4 +99,14 @@ public interface IStepperOperationService extends IService {
* @return <code>true</code> if the step data is valid.
*/
public boolean validateStepData(Object context, String operation, IPropertiesContainer data);
+
+ /**
+ * Get the stepper data to be used for the given context, operation and user data.
+ * @param context The context. Must not be <code>null</code>.
+ * @param operation The operation. Must not be <code>null</code>.
+ * @param data The step data to be validated.
+ * @return Stepper data to be useed.
+ */
+ public IPropertiesContainer getStepGroupData(Object context, String operation, IPropertiesContainer data);
+
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java
index 4c8856108..cea140a25 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java
@@ -56,4 +56,12 @@ public abstract class AbstractStepperOperationService extends AbstractService im
public IPropertiesContainer getSpecialHistoryData(Object context, String operation, IPropertiesContainer data) {
return null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService#getStepGroupData(java.lang.Object, java.lang.String, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public IPropertiesContainer getStepGroupData(Object context, String operation, IPropertiesContainer data) {
+ return data;
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
index 03582c986..464ce11b6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
@@ -45,6 +45,7 @@ public final class StepperHelper {
IStepContext stepContext = service.getStepContext(context, operation);
String stepGroupId = service.getStepGroupId(context, operation);
+ data = service.getStepGroupData(context, operation, data);
String name = service.getStepGroupName(context, operation);
boolean isCancelable = service.isCancelable(context, operation);
boolean addToActionHistory = service.addToActionHistory(context, operation);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF
index ffa24ff74..4e5bb3b42 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF
@@ -39,6 +39,7 @@ Export-Package: org.eclipse.tcf.te.tcf.core,
org.eclipse.tcf.te.tcf.core.listeners.interfaces,
org.eclipse.tcf.te.tcf.core.nls;x-internal:=true,
org.eclipse.tcf.te.tcf.core.peers,
+ org.eclipse.tcf.te.tcf.core.services,
org.eclipse.tcf.te.tcf.core.steps,
org.eclipse.tcf.te.tcf.core.streams,
org.eclipse.tcf.te.tcf.core.util,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml
index 797a230e2..31db3299e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml
@@ -17,18 +17,6 @@
class="org.eclipse.tcf.te.tcf.core.internal.services.PathMapResolverService">
<serviceType class="org.eclipse.tcf.te.tcf.core.interfaces.IPathMapResolverService"/>
</service>
-
- <service
- class="org.eclipse.tcf.te.tcf.core.internal.channelmanager.StepperOperationService"
- id="org.eclipse.tcf.te.tcf.core.services.stepperOperation">
- <serviceType
- bundleId="org.eclipse.tcf.te.runtime.stepper"
- class="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService">
- </serviceType>
- <enablement>
- <instanceof value="org.eclipse.tcf.protocol.IPeer"/>
- </enablement>
- </service>
</extension>
<!-- Step contributions -->
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IStepperServiceOperations.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IStepperServiceOperations.java
new file mode 100644
index 000000000..8f6bdf4e2
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IStepperServiceOperations.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.core.interfaces;
+
+/**
+ * IStepperServiceOperations
+ */
+public interface IStepperServiceOperations {
+
+ /**
+ * Open channel operation
+ */
+ public static final String OPEN_CHANNEL = "openChannel"; //$NON-NLS-1$
+
+ /**
+ * Close channel operation
+ */
+ public static final String CLOSE_CHANNEL = "closeChannel"; //$NON-NLS-1$
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java
index 5258a52bf..b34ab15b3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java
@@ -9,6 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.core.interfaces.steps;
+import org.eclipse.tcf.te.tcf.core.internal.channelmanager.iterators.ChainPeersIterator;
+
/**
* Defines locator related step data attribute id's.
@@ -35,4 +37,8 @@ public interface ITcfStepAttributes {
*/
public static final String ATTR_VALUE_ADD = ITcfStepAttributes.ATTR_PREFIX + ".value_add"; //$NON-NLS-1$
+ /**
+ * Step attribute: Flag if the peer should not be added to the list of peers to chain in {@link ChainPeersIterator}.
+ */
+ public static final String ATTR_SKIP_PEER_TO_CHAIN = ITcfStepAttributes.ATTR_PREFIX + ".skip_peer_to_chain"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
index b359cb40c..4182a9019 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
@@ -39,6 +39,7 @@ import org.eclipse.tcf.te.runtime.stepper.utils.StepperHelper;
import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.tcf.core.events.ChannelEvent;
import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.core.interfaces.IStepperServiceOperations;
import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
import org.eclipse.tcf.te.tcf.core.interfaces.tracing.ITraceIds;
import org.eclipse.tcf.te.tcf.core.internal.channelmanager.steps.ShutdownValueAddStep;
@@ -260,17 +261,17 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
};
// Get the stepper operation service
- IStepperOperationService stepperOperationService = StepperHelper.getService(peer, StepperOperationService.OPEN_CHANNEL);
+ IStepperOperationService stepperOperationService = StepperHelper.getService(peer, IStepperServiceOperations.OPEN_CHANNEL);
// Schedule the "open channel" stepper job
- IStepContext stepContext = stepperOperationService.getStepContext(peer, StepperOperationService.OPEN_CHANNEL);
- String stepGroupId = stepperOperationService.getStepGroupId(peer, StepperOperationService.OPEN_CHANNEL);
+ IStepContext stepContext = stepperOperationService.getStepContext(peer, IStepperServiceOperations.OPEN_CHANNEL);
+ String stepGroupId = stepperOperationService.getStepGroupId(peer, IStepperServiceOperations.OPEN_CHANNEL);
if (stepGroupId != null && stepContext != null) {
- String name = stepperOperationService.getStepGroupName(peer, StepperOperationService.OPEN_CHANNEL);
- boolean isCancelable = stepperOperationService.isCancelable(peer, StepperOperationService.OPEN_CHANNEL);
+ String name = stepperOperationService.getStepGroupName(peer, IStepperServiceOperations.OPEN_CHANNEL);
+ boolean isCancelable = stepperOperationService.isCancelable(peer, IStepperServiceOperations.OPEN_CHANNEL);
- job = new StepperJob(name != null ? name : "", stepContext, data, stepGroupId, StepperOperationService.OPEN_CHANNEL, isCancelable, true); //$NON-NLS-1$
+ job = new StepperJob(name != null ? name : "", stepContext, stepperOperationService.getStepGroupData(peer, IStepperServiceOperations.OPEN_CHANNEL, data), stepGroupId, IStepperServiceOperations.OPEN_CHANNEL, isCancelable, true); //$NON-NLS-1$
job.setJobCallback(callback);
job.markStatusHandled();
job.schedule();
@@ -498,17 +499,17 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
};
// Get the stepper operation service
- IStepperOperationService stepperOperationService = StepperHelper.getService(peer, StepperOperationService.CLOSE_CHANNEL);
+ IStepperOperationService stepperOperationService = StepperHelper.getService(peer, IStepperServiceOperations.CLOSE_CHANNEL);
// Schedule the "close channel" stepper job
- IStepContext stepContext = stepperOperationService.getStepContext(peer, StepperOperationService.CLOSE_CHANNEL);
- String stepGroupId = stepperOperationService.getStepGroupId(peer, StepperOperationService.CLOSE_CHANNEL);
+ IStepContext stepContext = stepperOperationService.getStepContext(peer, IStepperServiceOperations.CLOSE_CHANNEL);
+ String stepGroupId = stepperOperationService.getStepGroupId(peer, IStepperServiceOperations.CLOSE_CHANNEL);
if (stepGroupId != null && stepContext != null) {
- String name = stepperOperationService.getStepGroupName(peer, StepperOperationService.CLOSE_CHANNEL);
- boolean isCancelable = stepperOperationService.isCancelable(peer, StepperOperationService.CLOSE_CHANNEL);
+ String name = stepperOperationService.getStepGroupName(peer, IStepperServiceOperations.CLOSE_CHANNEL);
+ boolean isCancelable = stepperOperationService.isCancelable(peer, IStepperServiceOperations.CLOSE_CHANNEL);
- job = new StepperJob(name != null ? name : "", stepContext, data, stepGroupId, StepperOperationService.CLOSE_CHANNEL, isCancelable, true); //$NON-NLS-1$
+ job = new StepperJob(name != null ? name : "", stepContext, stepperOperationService.getStepGroupData(peer, IStepperServiceOperations.CLOSE_CHANNEL, data), stepGroupId, IStepperServiceOperations.CLOSE_CHANNEL, isCancelable, true); //$NON-NLS-1$
job.setJobCallback(callback);
job.markStatusHandled();
job.schedule();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java
index 44f1a3ec5..1bcfb8960 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java
@@ -24,6 +24,7 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepAttributes;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
import org.eclipse.tcf.te.tcf.core.interfaces.IPeerProperties;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
import org.eclipse.tcf.te.tcf.core.iterators.AbstractPeerStepGroupIterator;
import org.eclipse.tcf.te.tcf.core.util.persistence.PeerDataHelper;
import org.eclipse.tcf.te.tcf.core.va.ValueAddManager;
@@ -46,7 +47,7 @@ public class ChainPeersIterator extends AbstractPeerStepGroupIterator {
* @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ public void initialize(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
super.initialize(context, data, fullQualifiedId, monitor);
final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
@@ -75,7 +76,9 @@ public class ChainPeersIterator extends AbstractPeerStepGroupIterator {
}
}
- peers.add(peer);
+ if (!StepperAttributeUtil.getBooleanProperty(ITcfStepAttributes.ATTR_SKIP_PEER_TO_CHAIN, fullQualifiedId, data)) {
+ peers.add(peer);
+ }
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/StepperOperationService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/services/AbstractStepperOperationService.java
index d922b2418..4d9657903 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/StepperOperationService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/services/AbstractStepperOperationService.java
@@ -7,33 +7,43 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.tcf.core.internal.channelmanager;
+package org.eclipse.tcf.te.tcf.core.services;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.te.runtime.stepper.services.AbstractStepperOperationService;
+import org.eclipse.tcf.te.tcf.core.interfaces.IStepperServiceOperations;
import org.eclipse.tcf.te.tcf.core.nls.Messages;
/**
* Channel manager stepper operation service implementation.
*/
-public class StepperOperationService extends AbstractStepperOperationService {
- /**
- * Open channel operation
- */
- public static final String OPEN_CHANNEL = "openChannel"; //$NON-NLS-1$
+public abstract class AbstractStepperOperationService extends org.eclipse.tcf.te.runtime.stepper.services.AbstractStepperOperationService {
/**
- * Close channel operation
+ * Constructor
*/
- public static final String CLOSE_CHANNEL = "closeChannel"; //$NON-NLS-1$
+ public AbstractStepperOperationService() {
+ super();
+ }
/**
- * Constructor
+ * Returns the peer context.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @return The peer context.
*/
- public StepperOperationService() {
- super();
+ protected IPeer getPeerContext(Object context) {
+ IPeer peer = null;
+ if (context instanceof IPeer)
+ return (IPeer)context;
+ if (context instanceof IAdaptable)
+ peer = (IPeer)((IAdaptable)context).getAdapter(IPeer.class);
+ if (peer == null)
+ peer = (IPeer)Platform.getAdapterManager().getAdapter(context, IPeer.class);
+
+ return peer;
}
/* (non-Javadoc)
@@ -41,8 +51,7 @@ public class StepperOperationService extends AbstractStepperOperationService {
*/
@Override
public boolean isHandledOperation(Object context, String operation) {
- Assert.isTrue(context instanceof IPeer);
- return OPEN_CHANNEL.equals(operation) || CLOSE_CHANNEL.equals(operation);
+ return IStepperServiceOperations.OPEN_CHANNEL.equals(operation) || IStepperServiceOperations.CLOSE_CHANNEL.equals(operation);
}
/* (non-Javadoc)
@@ -50,11 +59,9 @@ public class StepperOperationService extends AbstractStepperOperationService {
*/
@Override
public String getStepGroupId(Object context, String operation) {
- Assert.isTrue(context instanceof IPeer);
-
- if (OPEN_CHANNEL.equals(operation))
+ if (IStepperServiceOperations.OPEN_CHANNEL.equals(operation))
return "org.eclipse.tcf.te.tcf.core.channelmanager.openChannelStepGroup"; //$NON-NLS-1$
- if (CLOSE_CHANNEL.equals(operation))
+ if (IStepperServiceOperations.CLOSE_CHANNEL.equals(operation))
return "org.eclipse.tcf.te.tcf.core.channelmanager.closeChannelStepGroup"; //$NON-NLS-1$
return null;
@@ -65,11 +72,9 @@ public class StepperOperationService extends AbstractStepperOperationService {
*/
@Override
public String getStepGroupName(Object context, String operation) {
- Assert.isTrue(context instanceof IPeer);
-
- if (OPEN_CHANNEL.equals(operation))
+ if (IStepperServiceOperations.OPEN_CHANNEL.equals(operation))
return NLS.bind(Messages.StepperOperationService_stepGroupName_openChannel, ((IPeer)context).getName());
- if (CLOSE_CHANNEL.equals(operation))
+ if (IStepperServiceOperations.CLOSE_CHANNEL.equals(operation))
return NLS.bind(Messages.StepperOperationService_stepGroupName_closeChannel, ((IPeer)context).getName());
return null;
@@ -80,8 +85,7 @@ public class StepperOperationService extends AbstractStepperOperationService {
*/
@Override
public boolean isEnabled(Object context, String operation) {
- Assert.isTrue(context instanceof IPeer);
- return OPEN_CHANNEL.equals(operation) || CLOSE_CHANNEL.equals(operation);
+ return IStepperServiceOperations.OPEN_CHANNEL.equals(operation) || IStepperServiceOperations.CLOSE_CHANNEL.equals(operation);
}
/* (non-Javadoc)
@@ -89,7 +93,6 @@ public class StepperOperationService extends AbstractStepperOperationService {
*/
@Override
public boolean isCancelable(Object context, String operation) {
- Assert.isTrue(context instanceof IPeer);
return false;
}
@@ -98,7 +101,6 @@ public class StepperOperationService extends AbstractStepperOperationService {
*/
@Override
public boolean addToActionHistory(Object context, String operation) {
- Assert.isTrue(context instanceof IPeer);
return false;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
index b6ddf7a2a..e1f139086 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
@@ -146,7 +146,10 @@
class="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService">
</serviceType>
<enablement>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/>
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/>
+ <instanceof value="org.eclipse.tcf.protocol.IPeer"/>
+ </or>
<test forcePluginActivation="true" property="org.eclipse.tcf.te.tcf.locator.isOfType" value="null"/>
</enablement>
</service>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/StepperOperationService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/StepperOperationService.java
index 7db230a3a..9fb83e150 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/StepperOperationService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/StepperOperationService.java
@@ -9,7 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.locator.services;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.tcf.locator.interfaces.IStepGroupIds;
import org.eclipse.tcf.te.tcf.locator.interfaces.IStepperServiceOperations;
@@ -18,7 +19,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
/**
* Connect/disconnect stepper operation service implementation.
*/
-public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.services.AbstractStepperOperationService {
+public class StepperOperationService extends org.eclipse.tcf.te.tcf.core.services.AbstractStepperOperationService {
/**
* Constructor.
@@ -26,12 +27,32 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
public StepperOperationService() {
}
+
+ /**
+ * Returns the peer node context.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @return The peer node context.
+ */
+ protected IPeerNode getPeerNodeContext(Object context) {
+ IPeerNode peerNode = null;
+ if (context instanceof IPeerNode)
+ return (IPeerNode)context;
+ if (context instanceof IAdaptable)
+ peerNode = (IPeerNode)((IAdaptable)context).getAdapter(IPeerNode.class);
+ if (peerNode == null)
+ peerNode = (IPeerNode)Platform.getAdapterManager().getAdapter(context, IPeerNode.class);
+
+ return peerNode;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService#isHandledOperation(java.lang.Object, java.lang.String)
*/
@Override
public boolean isHandledOperation(Object context, String operation) {
- return IStepperServiceOperations.CONNECT.equals(operation) ||
+ return super.isHandledOperation(context, operation) ||
+ IStepperServiceOperations.CONNECT.equals(operation) ||
IStepperServiceOperations.DISCONNECT.equals(operation) ||
IStepperServiceOperations.CONNECTION_LOST.equals(operation) ||
IStepperServiceOperations.CONNECTION_RECOVERING.equals(operation);
@@ -42,7 +63,7 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
*/
@Override
public boolean addToActionHistory(Object context, String operation) {
- return false;
+ return super.addToActionHistory(context, operation);
}
/* (non-Javadoc)
@@ -50,8 +71,6 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
*/
@Override
public String getStepGroupId(Object context, String operation) {
- Assert.isTrue(context instanceof IPeerNode);
-
if (IStepperServiceOperations.CONNECT.equals(operation)) {
return IStepGroupIds.CONNECT;
}
@@ -65,7 +84,7 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
return IStepGroupIds.CONNECTION_RECOVERING;
}
- return null;
+ return super.getStepGroupId(context, operation);
}
/* (non-Javadoc)
@@ -73,8 +92,6 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
*/
@Override
public String getStepGroupName(Object context, String operation) {
- Assert.isTrue(context instanceof IPeerNode);
-
if (IStepperServiceOperations.CONNECT.equals(operation)) {
return "Connect "+((IPeerNode)context).getName(); //$NON-NLS-1$
}
@@ -88,7 +105,7 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
return "Recovering Connection to "+((IPeerNode)context).getName(); //$NON-NLS-1$
}
- return null;
+ return super.getStepGroupName(context, operation);
}
/* (non-Javadoc)
@@ -111,7 +128,7 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
}
}
- return false;
+ return super.isEnabled(context, operation);
}
/* (non-Javadoc)
@@ -119,6 +136,8 @@ public class StepperOperationService extends org.eclipse.tcf.te.runtime.stepper.
*/
@Override
public boolean isCancelable(Object context, String operation) {
- return IStepperServiceOperations.CONNECT.equals(operation) || IStepperServiceOperations.CONNECTION_RECOVERING.equals(operation);
+ return super.isCancelable(context, operation) ||
+ IStepperServiceOperations.CONNECT.equals(operation) ||
+ IStepperServiceOperations.CONNECTION_RECOVERING.equals(operation);
}
}

Back to the top