From 2536b3b9bbd997affac98bb00b9956b27b959ddd Mon Sep 17 00:00:00 2001
From: Tobias Schwarz
Date: Tue, 14 Aug 2012 13:04:11 +0200
Subject: Target Explorer: add possibility to add parameters to refrenced steps
in a step group
---
.../plugin.properties | 66 ++++++-------
.../org.eclipse.tcf.te.tcf.launch.core/plugin.xml | 58 +++++++++---
.../te/tcf/launch/core/steps/CheckServiceStep.java | 105 +++++++++++++++++++++
3 files changed, 183 insertions(+), 46 deletions(-)
create mode 100644 target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CheckServiceStep.java
(limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core')
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 @@
-
+
+
+
+
@@ -67,8 +70,14 @@
-
-
+
+
+
+
+
+
+
+
@@ -85,7 +94,10 @@
-
+
+
+
+
@@ -110,6 +122,19 @@
iterator="org.eclipse.tcf.te.launch.core.steps.iterators.LaunchContextIterator">
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -143,22 +168,23 @@
label="%LaunchStepGroup.FileTransfer.name"
iterator="org.eclipse.tcf.te.tcf.launch.core.steps.iterators.FileTransferIterator">
+
+
+
+
-
-
-
-
-
-
+
+
+
@@ -170,6 +196,12 @@
id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"
class="org.eclipse.tcf.te.tcf.launch.core.steps.OpenChannelStep"
label="%LaunchStep.OpenChannel.name"/>
+
+
+
-
+ label="%LaunchStep.LaunchProcess.name"/>
-
+ label="%LaunchStep.AttachDebugger.name"/>
result = new AtomicReference();
+ 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 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.
+ }
+}
--
cgit v1.2.3