Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-08-14 07:04:11 -0400
committerTobias Schwarz2012-08-14 07:05:17 -0400
commit2536b3b9bbd997affac98bb00b9956b27b959ddd (patch)
tree7f84d88e2d1039a90a9c0f54531d4c86bcf8db1f /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core
parentdedd8a8ab79fc4e45e767abb563d7e5dda30996b (diff)
downloadorg.eclipse.tcf-2536b3b9bbd997affac98bb00b9956b27b959ddd.tar.gz
org.eclipse.tcf-2536b3b9bbd997affac98bb00b9956b27b959ddd.tar.xz
org.eclipse.tcf-2536b3b9bbd997affac98bb00b9956b27b959ddd.zip
Target Explorer: add possibility to add parameters to refrenced steps in
a step group
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CheckServiceStep.java105
3 files changed, 183 insertions, 46 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties
index b5f43b7d3..6667d2ff1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties
@@ -1,32 +1,34 @@
-##################################################################################
-# Copyright (c) 2011, 2012 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
-##################################################################################
-
-pluginName = Target Explorer, TCF Launching, Core
-providerName = Eclipse.org - TCF
-
-# ***** Launch Configuration Types *****
-
-LaunchType.Remote.App.name=Remote Application
-LaunchType.Attach.name=Attach
-
-# ***** Launch Step Groups *****
-
-LaunchStepGroup.Remote.App.name=Remote Application
-LaunchStepGroup.Attach.name=Attach
-LaunchStepGroup.FileTransfer.name=File Transfer
-
-# ***** Launch Steps *****
-
-LaunchStep.OpenChannel.name=Open TCF Channel
-LaunchStep.FileTransfer.name=Transfer File
-LaunchStep.LaunchProcess.name=Launch Process
-LaunchStep.ResumeContext.name=Resume Context
-LaunchStep.AttachDebugger.name=Attach Debugger
-LaunchStep.CloseChannel.name=Close TCF Channel
+##################################################################################
+# Copyright (c) 2011, 2012 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
+##################################################################################
+
+pluginName = Target Explorer, TCF Launching, Core
+providerName = Eclipse.org - TCF
+
+# ***** Launch Configuration Types *****
+
+LaunchType.Remote.App.name=Remote Application
+LaunchType.Attach.name=Attach
+
+# ***** Launch Step Groups *****
+
+LaunchStepGroup.Remote.App.name=Remote Application
+LaunchStepGroup.FileTransfer.name=File Transfer
+
+LaunchStepGroup.Attach.name=Attach
+
+# ***** Launch Steps *****
+
+LaunchStep.OpenChannel.name=Open TCF Channel
+LaunchStep.CheckService.name=Check TCF Service
+LaunchStep.FileTransfer.name=Transfer File
+LaunchStep.LaunchProcess.name=Launch Process
+LaunchStep.ResumeContext.name=Resume Context
+LaunchStep.AttachDebugger.name=Attach Debugger
+LaunchStep.CloseChannel.name=Close TCF Channel
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml
index ce058a2f2..aef456722 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml
@@ -46,7 +46,10 @@
</adapt>
<and>
<instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
+ <or>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasOfflineService" value="Processes"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
+ </or>
</and>
</or>
</with>
@@ -67,8 +70,14 @@
</adapt>
<and>
<instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
- <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/>
+ <or>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasOfflineService" value="Processes"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
+ </or>
+ <or>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasOfflineService" value="RunControl"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/>
+ </or>
</and>
</or>
</with>
@@ -85,7 +94,10 @@
<with variable="context">
<and>
<instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/>
+ <or>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasOfflineService" value="RunControl"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/>
+ </or>
</and>
</with>
</enablement>
@@ -110,6 +122,19 @@
iterator="org.eclipse.tcf.te.launch.core.steps.iterators.LaunchContextIterator">
<references>
<reference id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.checkServiceStep">
+ <parameter name="remoteService" value="RunControl"/>
+ <enablement>
+ <with variable="context">
+ <not>
+ <test property="org.eclipse.tcf.te.launch.core.launchMode" value="debug"/>
+ </not>
+ </with>
+ </enablement>
+ </reference>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.checkServiceStep">
+ <parameter name="remoteService" value="Processes"/>
+ </reference>
<reference id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStepGroup"/>
<reference id="org.eclipse.tcf.te.tcf.launch.core.launchProcessStep"/>
<reference id="org.eclipse.tcf.te.tcf.launch.core.resumeContextStep">
@@ -143,22 +168,23 @@
label="%LaunchStepGroup.FileTransfer.name"
iterator="org.eclipse.tcf.te.tcf.launch.core.steps.iterators.FileTransferIterator">
<references>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.checkServiceStep">
+ <parameter name="remoteService" value="FileSystem"/>
+ </reference>
<reference id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStep"/>
</references>
</stepGroup>
+
<stepGroup
id="org.eclipse.tcf.te.tcf.launch.type.attach.stepGroup"
label="%LaunchStepGroup.Attach.name"
iterator="org.eclipse.tcf.te.launch.core.steps.iterators.LaunchContextIterator">
<references>
<reference id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
- <reference id="org.eclipse.tcf.te.tcf.launch.core.attachDebuggerStep">
- <enablement>
- <with variable="context">
- <test property="org.eclipse.tcf.te.launch.core.launchMode" value="debug"/>
- </with>
- </enablement>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.checkServiceStep">
+ <parameter name="remoteService" value="RunControl"/>
</reference>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.attachDebuggerStep"/>
<reference id="org.eclipse.tcf.te.tcf.launch.core.closeChannelStep"/>
</references>
</stepGroup>
@@ -171,6 +197,12 @@
class="org.eclipse.tcf.te.tcf.launch.core.steps.OpenChannelStep"
label="%LaunchStep.OpenChannel.name"/>
<step
+ id="org.eclipse.tcf.te.tcf.launch.core.checkServiceStep"
+ class="org.eclipse.tcf.te.tcf.launch.core.steps.CheckServiceStep"
+ label="%LaunchStep.CheckService.name">
+ <requires id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
+ </step>
+ <step
id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStep"
class="org.eclipse.tcf.te.tcf.launch.core.steps.FileTransferStep"
label="%LaunchStep.FileTransfer.name">
@@ -179,13 +211,11 @@
<step
id="org.eclipse.tcf.te.tcf.launch.core.launchProcessStep"
class="org.eclipse.tcf.te.tcf.launch.core.steps.LaunchProcessStep"
- label="%LaunchStep.LaunchProcess.name">
- </step>
+ label="%LaunchStep.LaunchProcess.name"/>
<step
id="org.eclipse.tcf.te.tcf.launch.core.attachDebuggerStep"
class="org.eclipse.tcf.te.tcf.launch.core.steps.AttachDebuggerStep"
- label="%LaunchStep.AttachDebugger.name">
- </step>
+ label="%LaunchStep.AttachDebugger.name"/>
<step
id="org.eclipse.tcf.te.tcf.launch.core.resumeContextStep"
class="org.eclipse.tcf.te.tcf.launch.core.steps.ResumeContextStep"
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CheckServiceStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CheckServiceStep.java
new file mode 100644
index 000000000..102a755aa
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CheckServiceStep.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.launch.core.steps;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+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;
+import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.ICommonTCFLaunchAttributes;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+
+/**
+ * Check service step implementation.
+ */
+public class CheckServiceStep extends AbstractTcfLaunchStep {
+
+ public static final String PARAMETER_REMOTE_SERVICE = "remoteService"; //$NON-NLS-1$
+ public static final String PARAMETER_LOCAL_SERVICE = "localService"; //$NON-NLS-1$
+ public static final String PARAMETER_OFFLINE_SERVICE = "offlineService"; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ */
+ public CheckServiceStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(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 validateExecute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor) throws CoreException {
+ if (Protocol.isDispatchThread()) {
+ internalValidateExecute(context, data, fullQualifiedId, monitor);
+ }
+ else {
+ final AtomicReference<CoreException> result = new AtomicReference<CoreException>();
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ internalValidateExecute(context, data, fullQualifiedId, monitor);
+ }
+ catch (CoreException e) {
+ result.set(e);
+ }
+ }
+ });
+ if (result.get() != null) {
+ throw result.get();
+ }
+ }
+ }
+
+ protected void internalValidateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel == null || channel.getState() != IChannel.STATE_OPEN) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing or closed channel")); //$NON-NLS-1$
+ }
+
+ String remoteService = getParameters().get(PARAMETER_REMOTE_SERVICE);
+ if (remoteService != null && channel.getRemoteService(remoteService) == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing remote service '" + remoteService + "'")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String localService = getParameters().get(PARAMETER_LOCAL_SERVICE);
+ if (localService != null && channel.getLocalService(localService) == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing local service '" + localService + "'")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String offlineService = getParameters().get(PARAMETER_OFFLINE_SERVICE);
+ String services = getActivePeerModel(fullQualifiedId, data).getPeer().getAttributes().get(IPeerModelProperties.PROP_OFFLINE_SERVICES);
+ List<String> list = services != null ? Arrays.asList(services.split(",\\s*")) : Collections.EMPTY_LIST; //$NON-NLS-1$
+ if (offlineService != null && !list.contains(offlineService)) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing offline service '" + offlineService + "'")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(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, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ // nothing to do, check is done in validateExecute.
+ }
+}

Back to the top