Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-04-09 03:03:28 -0400
committerTobias Schwarz2013-04-09 03:03:28 -0400
commit9042daf4c16e9bdc547056d76b0d5d2abe7887b7 (patch)
tree72653d4a73299d533b76a52f007456f8cdf13e40 /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core
parentadeb4f2a4cbc9afb489cae44406cd10a6422e726 (diff)
downloadorg.eclipse.tcf-9042daf4c16e9bdc547056d76b0d5d2abe7887b7.tar.gz
org.eclipse.tcf-9042daf4c16e9bdc547056d76b0d5d2abe7887b7.tar.xz
org.eclipse.tcf-9042daf4c16e9bdc547056d76b0d5d2abe7887b7.zip
Target Explorer: rework stepper, reorder steps
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/META-INF/MANIFEST.MF75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties63
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml477
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ICommonTCFLaunchAttributes.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/steps/ITcfLaunchStepAttributes.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IAttachLaunchAttributes.java)47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java242
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/LaunchStepContext.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java)216
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java356
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java662
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AbstractTcfLaunchStep.java80
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AttachDebuggerStep.java138
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CheckServiceStep.java106
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CloseChannelStep.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java78
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java182
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/OpenChannelStep.java66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java122
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java83
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java71
21 files changed, 1286 insertions, 1927 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF
index 29b0791df..e360e3558 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF
@@ -1,37 +1,38 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.tcf.launch.core;singleton:=true
-Bundle-Version: 1.1.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.debug.core;bundle-version="3.7.100",
- org.eclipse.tcf.core;bundle-version="1.1.0",
- org.eclipse.tcf.debug;bundle-version="1.1.0",
- org.eclipse.tcf.te.core;bundle-version="1.1.0",
- org.eclipse.tcf.te.core.cdt;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.persistence;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.stepper;bundle-version="1.1.0",
- org.eclipse.tcf.te.launch.core;bundle-version="1.1.0",
- org.eclipse.tcf.te.tcf.core;bundle-version="1.1.0",
- org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.1.0",
- org.eclipse.tcf.te.tcf.locator;bundle-version="1.1.0",
- org.eclipse.tcf.te.tcf.processes.core;bundle-version="1.1.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.tcf.launch.core.activator;x-internal:=true,
- org.eclipse.tcf.te.tcf.launch.core.delegates,
- org.eclipse.tcf.te.tcf.launch.core.filetransfer,
- org.eclipse.tcf.te.tcf.launch.core.interfaces,
- org.eclipse.tcf.te.tcf.launch.core.internal.adapters;x-internal:=true,
- org.eclipse.tcf.te.tcf.launch.core.internal.services,
- org.eclipse.tcf.te.tcf.launch.core.lm.delegates,
- org.eclipse.tcf.te.tcf.launch.core.nls;x-internal:=true,
- org.eclipse.tcf.te.tcf.launch.core.steps,
- org.eclipse.tcf.te.tcf.launch.core.steps.iterators
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.tcf.launch.core;singleton:=true
+Bundle-Version: 1.1.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.debug.core;bundle-version="3.7.100",
+ org.eclipse.tcf.core;bundle-version="1.1.0",
+ org.eclipse.tcf.debug;bundle-version="1.1.0",
+ org.eclipse.tcf.te.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.core.cdt;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.persistence;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.stepper;bundle-version="1.1.0",
+ org.eclipse.tcf.te.launch.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.tcf.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.1.0",
+ org.eclipse.tcf.te.tcf.processes.core;bundle-version="1.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.launch.core.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.launch.core.delegates,
+ org.eclipse.tcf.te.tcf.launch.core.filetransfer,
+ org.eclipse.tcf.te.tcf.launch.core.interfaces,
+ org.eclipse.tcf.te.tcf.launch.core.interfaces.steps,
+ org.eclipse.tcf.te.tcf.launch.core.internal.adapters;x-internal:=true,
+ org.eclipse.tcf.te.tcf.launch.core.internal.services,
+ org.eclipse.tcf.te.tcf.launch.core.lm.delegates,
+ org.eclipse.tcf.te.tcf.launch.core.nls;x-internal:=true,
+ org.eclipse.tcf.te.tcf.launch.core.steps,
+ org.eclipse.tcf.te.tcf.launch.core.steps.iterators
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 060b8cc83..7c86354ea 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,34 +1,29 @@
-##################################################################################
-# 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 - Target Explorer
-
-# ***** Launch Configuration Types *****
-
-LaunchType.Remote.App.name=Remote Application
-LaunchType.Attach.name=Remote Debugger
-
-# ***** 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
+##################################################################################
+# 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 - Target Explorer
+
+# ***** Launch Configuration Types *****
+
+LaunchType.Remote.App.name=Remote Application
+LaunchType.Attach.name=Remote Debugger
+
+# ***** Launch Step Groups *****
+
+LaunchStepGroup.Remote.App.name=Remote Application
+LaunchStepGroup.FileTransfer.name=File Transfer
+LaunchStepGroup.LaunchProcess.name=Launch Process
+
+LaunchStepGroup.Attach.name=Attach
+
+# ***** Launch Steps *****
+
+LaunchStep.AttachDebugger.name=Attach Debugger
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 39127becf..dfbf2d8d8 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
@@ -1,249 +1,228 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Adapter factory contributions -->
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.debug.core.ILaunch"
- class="org.eclipse.tcf.te.tcf.launch.core.internal.adapters.AdapterFactory">
- <adapter type="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext"/>
- </factory>
- <factory
- adaptableType="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"
- class="org.eclipse.tcf.te.tcf.launch.core.internal.adapters.AdapterFactory">
- <adapter type="org.eclipse.debug.core.ILaunchConfiguration"/>
- <adapter type="org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"/>
- </factory>
- </extension>
-
-<!-- Service contributions -->
- <extension point="org.eclipse.tcf.te.runtime.services.services">
- <service
- id="org.eclipse.tcf.te.tcf.launch.services.persistence.import"
- class="org.eclipse.tcf.te.tcf.launch.core.internal.services.ImportPersistenceService">
- <serviceType class="org.eclipse.tcf.te.tcf.core.interfaces.IImportPersistenceService"/>
- </service>
- <service
- id="org.eclipse.tcf.te.tcf.launch.services.persistence.export"
- class="org.eclipse.tcf.te.tcf.launch.core.internal.services.ExportPersistenceService">
- <serviceType class="org.eclipse.tcf.te.tcf.core.interfaces.IExportPersistenceService"/>
- </service>
- </extension>
-
-<!-- Launch Configuration Type contributions -->
- <extension point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app"
- sourceLocatorId="org.eclipse.tcf.debug.SourceLocator"
- sourcePathComputerId="org.eclipse.tcf.debug.SourcePathComputer"
- delegate="org.eclipse.tcf.te.tcf.launch.core.delegates.LaunchConfigurationDelegate"
- modes="run,debug"
- name="%LaunchType.Remote.App.name"/>
- <launchConfigurationType
- id="org.eclipse.tcf.te.tcf.launch.type.attach"
- public="false"
- sourceLocatorId="org.eclipse.tcf.debug.SourceLocator"
- sourcePathComputerId="org.eclipse.tcf.debug.SourcePathComputer"
- delegate="org.eclipse.tcf.te.tcf.launch.core.delegates.LaunchConfigurationDelegate"
- modes="debug"
- name="%LaunchType.Attach.name"/>
- </extension>
-
-<!-- Launch Configuration Type Binding contributions -->
- <extension point="org.eclipse.tcf.te.launch.core.launchConfigTypeBindings">
- <launchConfigTypeBinding launchConfigTypeId="org.eclipse.tcf.te.tcf.launch.type.remote.app">
- <launchManagerDelegate
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app.launchManagerDelegate"
- modes="run"/>
- <stepGroup
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app.stepGroup"
- modes="run"/>
- <enablement>
- <with variable="context">
- <or>
- <adapt type="org.eclipse.core.resources.IResource">
- <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
- </adapt>
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <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>
- </enablement>
- </launchConfigTypeBinding>
- <launchConfigTypeBinding launchConfigTypeId="org.eclipse.tcf.te.tcf.launch.type.remote.app">
- <launchManagerDelegate
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app.launchManagerDelegate"
- modes="debug"/>
- <stepGroup
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app.stepGroup"
- modes="debug"/>
- <enablement>
- <with variable="context">
- <or>
- <adapt type="org.eclipse.core.resources.IResource">
- <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
- </adapt>
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <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>
- </enablement>
- </launchConfigTypeBinding>
- <launchConfigTypeBinding launchConfigTypeId="org.eclipse.tcf.te.tcf.launch.type.attach">
- <launchManagerDelegate
- id="org.eclipse.tcf.te.tcf.launch.type.attach.launchManagerDelegate"
- modes="debug"/>
- <stepGroup
- id="org.eclipse.tcf.te.tcf.launch.type.attach.stepGroup"
- modes="debug"/>
- <enablement>
- <with variable="context">
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- </with>
- </enablement>
- </launchConfigTypeBinding>
- </extension>
-
-<!-- Launch Manager Delegate contributions -->
- <extension point="org.eclipse.tcf.te.launch.core.launchManagerDelegates">
- <delegate
- class="org.eclipse.tcf.te.tcf.launch.core.lm.delegates.RemoteAppLaunchManagerDelegate"
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app.launchManagerDelegate"/>
- <delegate
- class="org.eclipse.tcf.te.tcf.launch.core.lm.delegates.AttachLaunchManagerDelegate"
- id="org.eclipse.tcf.te.tcf.launch.type.attach.launchManagerDelegate"/>
- </extension>
-
-<!-- Launch Step Group contributions -->
- <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
- <stepGroup
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app.stepGroup"
- label="%LaunchStepGroup.Remote.App.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.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">
- <enablement>
- <with variable="context">
- <test property="org.eclipse.tcf.te.launch.core.launchMode" value="debug"/>
- </with>
- </enablement>
- </reference>
- <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>
- <reference id="org.eclipse.tcf.te.tcf.launch.core.closeChannelStep"/>
- <reference id="org.eclipse.tcf.te.launch.core.removeLaunchStep">
- <enablement>
- <with variable="context">
- <not>
- <test property="org.eclipse.tcf.te.launch.core.launchMode" value="debug"/>
- </not>
- </with>
- </enablement>
- </reference>
- </references>
- </stepGroup>
- <stepGroup
- id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStepGroup"
- 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.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>
- </extension>
-
-<!-- Launch Step contributions -->
- <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
- <step
- id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"
- 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">
- <requires id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
- </step>
- <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
- id="org.eclipse.tcf.te.tcf.launch.core.attachDebuggerStep"
- class="org.eclipse.tcf.te.tcf.launch.core.steps.AttachDebuggerStep"
- label="%LaunchStep.AttachDebugger.name"/>
- <step
- id="org.eclipse.tcf.te.tcf.launch.core.resumeContextStep"
- class="org.eclipse.tcf.te.tcf.launch.core.steps.ResumeContextStep"
- label="%LaunchStep.ResumeContext.name">
- <requires id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
- <requires id="org.eclipse.tcf.te.tcf.launch.core.launchProcessStep"/>
- </step>
- <step
- id="org.eclipse.tcf.te.tcf.launch.core.closeChannelStep"
- class="org.eclipse.tcf.te.tcf.launch.core.steps.CloseChannelStep"
- label="%LaunchStep.CloseChannel.name">
- <requires id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
- </step>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Adapter factory contributions -->
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.debug.core.ILaunch"
+ class="org.eclipse.tcf.te.tcf.launch.core.internal.adapters.AdapterFactory">
+ <adapter type="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"
+ class="org.eclipse.tcf.te.tcf.launch.core.internal.adapters.AdapterFactory">
+ <adapter type="org.eclipse.debug.core.ILaunchConfiguration"/>
+ <adapter type="org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"/>
+ </factory>
+ </extension>
+
+<!-- Service contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.services.services">
+ <service
+ id="org.eclipse.tcf.te.tcf.launch.services.persistence.import"
+ class="org.eclipse.tcf.te.tcf.launch.core.internal.services.ImportPersistenceService">
+ <serviceType class="org.eclipse.tcf.te.tcf.core.interfaces.IImportPersistenceService"/>
+ </service>
+ <service
+ id="org.eclipse.tcf.te.tcf.launch.services.persistence.export"
+ class="org.eclipse.tcf.te.tcf.launch.core.internal.services.ExportPersistenceService">
+ <serviceType class="org.eclipse.tcf.te.tcf.core.interfaces.IExportPersistenceService"/>
+ </service>
+ </extension>
+
+<!-- Launch Configuration Type contributions -->
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ id="org.eclipse.tcf.te.tcf.launch.type.remote.app"
+ sourceLocatorId="org.eclipse.tcf.debug.SourceLocator"
+ sourcePathComputerId="org.eclipse.tcf.debug.SourcePathComputer"
+ delegate="org.eclipse.tcf.te.tcf.launch.core.delegates.LaunchConfigurationDelegate"
+ modes="run,debug"
+ name="%LaunchType.Remote.App.name"/>
+ <launchConfigurationType
+ id="org.eclipse.tcf.te.tcf.launch.type.attach"
+ public="false"
+ sourceLocatorId="org.eclipse.tcf.debug.SourceLocator"
+ sourcePathComputerId="org.eclipse.tcf.debug.SourcePathComputer"
+ delegate="org.eclipse.tcf.te.tcf.launch.core.delegates.LaunchConfigurationDelegate"
+ modes="debug"
+ name="%LaunchType.Attach.name"/>
+ </extension>
+
+<!-- Launch Configuration Type Binding contributions -->
+ <extension point="org.eclipse.tcf.te.launch.core.launchConfigTypeBindings">
+ <launchConfigTypeBinding launchConfigTypeId="org.eclipse.tcf.te.tcf.launch.type.remote.app">
+ <launchManagerDelegate
+ id="org.eclipse.tcf.te.tcf.launch.type.remote.app.launchManagerDelegate"
+ modes="run"/>
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.launch.type.remote.app.stepGroup"
+ modes="run"/>
+ <enablement>
+ <with variable="context">
+ <or>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
+ </adapt>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <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>
+ </enablement>
+ </launchConfigTypeBinding>
+ <launchConfigTypeBinding launchConfigTypeId="org.eclipse.tcf.te.tcf.launch.type.remote.app">
+ <launchManagerDelegate
+ id="org.eclipse.tcf.te.tcf.launch.type.remote.app.launchManagerDelegate"
+ modes="debug"/>
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.launch.type.remote.app.stepGroup"
+ modes="debug"/>
+ <enablement>
+ <with variable="context">
+ <or>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
+ </adapt>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <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>
+ </enablement>
+ </launchConfigTypeBinding>
+ <launchConfigTypeBinding launchConfigTypeId="org.eclipse.tcf.te.tcf.launch.type.attach">
+ <launchManagerDelegate
+ id="org.eclipse.tcf.te.tcf.launch.type.attach.launchManagerDelegate"
+ modes="debug"/>
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.launch.type.attach.stepGroup"
+ modes="debug"/>
+ <enablement>
+ <with variable="context">
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ </with>
+ </enablement>
+ </launchConfigTypeBinding>
+ </extension>
+
+<!-- Launch Manager Delegate contributions -->
+ <extension point="org.eclipse.tcf.te.launch.core.launchManagerDelegates">
+ <delegate
+ class="org.eclipse.tcf.te.tcf.launch.core.lm.delegates.RemoteAppLaunchManagerDelegate"
+ id="org.eclipse.tcf.te.tcf.launch.type.remote.app.launchManagerDelegate"/>
+ <delegate
+ class="org.eclipse.tcf.te.tcf.launch.core.lm.delegates.AttachLaunchManagerDelegate"
+ id="org.eclipse.tcf.te.tcf.launch.type.attach.launchManagerDelegate"/>
+ </extension>
+
+<!-- Launch Step Group contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.launch.type.remote.app.stepGroup"
+ label="%LaunchStepGroup.Remote.App.name"
+ iterator="org.eclipse.tcf.te.launch.core.steps.iterators.LaunchContextIterator">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.core.openChannelStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStepGroup"/>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.launchProcessStepGroup"/>
+ <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>
+ <reference id="org.eclipse.tcf.te.tcf.core.closeChannelStep"/>
+ <reference id="org.eclipse.tcf.te.launch.core.removeLaunchStep">
+ <enablement>
+ <with variable="context">
+ <not>
+ <test property="org.eclipse.tcf.te.launch.core.launchMode" value="debug"/>
+ </not>
+ </with>
+ </enablement>
+ </reference>
+ </references>
+ </stepGroup>
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.launch.core.launchProcessStepGroup"
+ label="%LaunchStepGroup.LaunchProcess.name"
+ iterator="org.eclipse.tcf.te.tcf.launch.core.steps.iterators.LaunchProcessIterator">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.locator.checkServiceStep">
+ <parameter name="remoteService" value="Processes"/>
+ </reference>
+ <reference id="org.eclipse.tcf.te.tcf.locator.checkServiceStep">
+ <parameter name="remoteService" value="RunControl"/>
+ <enablement>
+ <with variable="context">
+ <test property="org.eclipse.tcf.te.launch.core.launchMode" value="debug"/>
+ </with>
+ </enablement>
+ </reference>
+ <reference id="org.eclipse.tcf.te.tcf.processes.core.launchProcessStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.processes.core.resumeProcessStep">
+ <enablement>
+ <with variable="context">
+ <test property="org.eclipse.tcf.te.launch.core.launchMode" value="debug"/>
+ </with>
+ </enablement>
+ </reference>
+ </references>
+ </stepGroup>
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStepGroup"
+ label="%LaunchStepGroup.FileTransfer.name"
+ iterator="org.eclipse.tcf.te.tcf.launch.core.steps.iterators.FileTransferIterator">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.locator.checkServiceStep">
+ <parameter name="remoteService" value="FileSystem"/>
+ </reference>
+ <reference id="org.eclipse.tcf.te.tcf.filesystem.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.core.openChannelStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.locator.checkServiceStep">
+ <parameter name="remoteService" value="RunControl"/>
+ </reference>
+ <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>
+ <reference id="org.eclipse.tcf.te.tcf.core.closeChannelStep"/>
+ </references>
+ </stepGroup>
+ </extension>
+
+<!-- Launch Step contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
+ <step
+ id="org.eclipse.tcf.te.tcf.launch.core.attachDebuggerStep"
+ class="org.eclipse.tcf.te.tcf.launch.core.steps.AttachDebuggerStep"
+ label="%LaunchStep.AttachDebugger.name"/>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ICommonTCFLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ICommonTCFLaunchAttributes.java
deleted file mode 100644
index c2cf35521..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ICommonTCFLaunchAttributes.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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.interfaces;
-
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
-
-/**
- * Defines the launch configuration attribute id's to access the launch step contexts.
- */
-public interface ICommonTCFLaunchAttributes {
-
- /**
- * Define the prefix used by all other attribute id's as prefix.
- */
- public static final String ATTR_PREFIX = "org.eclipse.tcf.te.tcf.launch"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute: The TCF channel.
- */
- public static final String ATTR_CHANNEL = ICommonLaunchAttributes.ATTR_PREFIX + ".channel"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java
deleted file mode 100644
index e5db23e51..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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.interfaces;
-
-
-/**
- * Defines the launch configuration attribute id's to access the launch step contexts.
- */
-public interface IRemoteAppLaunchAttributes {
-
- /**
- * Launch configuration attribute: The process image.
- */
- public static final String ATTR_PROCESS_IMAGE = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_image"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute: The process arguments.
- */
- public static final String ATTR_PROCESS_ARGUMENTS = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_arguments"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute: Flag if or if not to stop at process entry.
- */
- public static final String ATTR_STOP_AT_ENTRY = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_stop_at_entry"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute: Flag if or if not to stop at main.
- */
- public static final String ATTR_STOP_AT_MAIN = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_stop_at_main"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute: Flag if or if not to attach process children.
- */
- public static final String ATTR_ATTACH_CHILDREN = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_attach_children"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute (internal use): The process context object.
- */
- public static final String ATTR_PROCESS_CONTEXT = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_context"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IAttachLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/steps/ITcfLaunchStepAttributes.java
index d97dc4330..a8d28eab1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IAttachLaunchAttributes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/steps/ITcfLaunchStepAttributes.java
@@ -1,21 +1,26 @@
-/*******************************************************************************
- * 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.interfaces;
-
-/**
- * Defines the launch configuration attribute id's for attach launches.
- */
-public interface IAttachLaunchAttributes {
-
- /**
- * Launch configuration attribute: List of TCF services to use to attach all their children (i.e. {IProcesses})
- */
- public static final String ATTR_ATTACH_SERVICES = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".attach_services"; //$NON-NLS-1$
-}
+/*******************************************************************************
+ * 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.interfaces.steps;
+
+/**
+ * Defines the launch configuration attribute id's for attach launches.
+ */
+public interface ITcfLaunchStepAttributes {
+
+ /**
+ * Define the prefix used by all other attribute id's as prefix.
+ */
+ public static final String ATTR_PREFIX = "org.eclipse.tcf.te.tcf.launch"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute: List of TCF services to use to attach all their children (i.e. {IProcesses})
+ */
+ public static final String ATTR_ATTACH_SERVICES = ATTR_PREFIX + ".attach_services"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
index d2b3f87b6..6ae2a7c9a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
@@ -1,121 +1,121 @@
-/*******************************************************************************
- * 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.internal.adapters;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchListener;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-
-/**
- * Adapter factory implementation.
- */
-public class AdapterFactory implements IAdapterFactory {
- // Maintain a map of step context adapters per peer model
- /* default */ Map<ILaunch, IStepContext> adapters = new HashMap<ILaunch, IStepContext>();
- AttachLaunchConfigAdapter attachLaunchConfigAdapter = new AttachLaunchConfigAdapter();
-
- private static final Class<?>[] CLASSES = new Class[] {
- IStepContext.class,
- ILaunchConfiguration.class,
- ILaunchConfigurationWorkingCopy.class,
- };
-
- /**
- * Constructor.
- */
- public AdapterFactory() {
- final ILaunchListener listener = new ILaunchListener() {
- @Override
- public void launchRemoved(ILaunch launch) {
- IStepContext adapter = adapters.remove(launch);
- if (adapter instanceof IDisposable) {
- ((IDisposable)adapter).dispose();
- }
- }
- @Override
- public void launchChanged(ILaunch launch) {
- IStepContext adapter = adapters.remove(launch);
- if (adapter instanceof IDisposable) {
- ((IDisposable)adapter).dispose();
- }
- }
- @Override
- public void launchAdded(ILaunch launch) {
- }
- };
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener);
- }
- };
-
- if (Protocol.isDispatchThread()) {
- runnable.run();
- }
- else {
- Protocol.invokeAndWait(runnable);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof ILaunch) {
- if (IStepContext.class.equals(adapterType)) {
- // Lookup the adapter
- IStepContext adapter = adapters.get(adaptableObject);
- // No adapter yet -> create a new one for this peer
- if (adapter == null) {
- adapter = new StepContextAdapter((ILaunch)adaptableObject);
- adapters.put((ILaunch)adaptableObject, adapter);
- }
- return adapter;
- }
- }
- else if (adaptableObject instanceof IPeerModel) {
- if (ILaunchConfiguration.class.equals(adapterType)) {
- return attachLaunchConfigAdapter.getAttachLaunchConfig((IPeerModel)adaptableObject);
- }
- if (ILaunchConfigurationWorkingCopy.class.equals(adapterType)) {
- ILaunchConfiguration launchConfig = attachLaunchConfigAdapter.getAttachLaunchConfig((IPeerModel)adaptableObject);
- try {
- return launchConfig.getWorkingCopy();
- }
- catch (Exception e) {
- return launchConfig;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @Override
- public Class[] getAdapterList() {
- return CLASSES;
- }
-
-}
+/*******************************************************************************
+ * 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.internal.adapters;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Adapter factory implementation.
+ */
+public class AdapterFactory implements IAdapterFactory {
+ // Maintain a map of step context adapters per peer model
+ /* default */ Map<ILaunch, IStepContext> adapters = new HashMap<ILaunch, IStepContext>();
+ AttachLaunchConfigAdapter attachLaunchConfigAdapter = new AttachLaunchConfigAdapter();
+
+ private static final Class<?>[] CLASSES = new Class[] {
+ IStepContext.class,
+ ILaunchConfiguration.class,
+ ILaunchConfigurationWorkingCopy.class,
+ };
+
+ /**
+ * Constructor.
+ */
+ public AdapterFactory() {
+ final ILaunchListener listener = new ILaunchListener() {
+ @Override
+ public void launchRemoved(ILaunch launch) {
+ IStepContext adapter = adapters.remove(launch);
+ if (adapter instanceof IDisposable) {
+ ((IDisposable)adapter).dispose();
+ }
+ }
+ @Override
+ public void launchChanged(ILaunch launch) {
+ IStepContext adapter = adapters.remove(launch);
+ if (adapter instanceof IDisposable) {
+ ((IDisposable)adapter).dispose();
+ }
+ }
+ @Override
+ public void launchAdded(ILaunch launch) {
+ }
+ };
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener);
+ }
+ };
+
+ if (Protocol.isDispatchThread()) {
+ runnable.run();
+ }
+ else {
+ Protocol.invokeAndWait(runnable);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ILaunch) {
+ if (IStepContext.class.equals(adapterType)) {
+ // Lookup the adapter
+ IStepContext adapter = adapters.get(adaptableObject);
+ // No adapter yet -> create a new one for this peer
+ if (adapter == null) {
+ adapter = new LaunchStepContext((ILaunch)adaptableObject);
+ adapters.put((ILaunch)adaptableObject, adapter);
+ }
+ return adapter;
+ }
+ }
+ else if (adaptableObject instanceof IPeerModel) {
+ if (ILaunchConfiguration.class.equals(adapterType)) {
+ return attachLaunchConfigAdapter.getAttachLaunchConfig((IPeerModel)adaptableObject);
+ }
+ if (ILaunchConfigurationWorkingCopy.class.equals(adapterType)) {
+ ILaunchConfiguration launchConfig = attachLaunchConfigAdapter.getAttachLaunchConfig((IPeerModel)adaptableObject);
+ try {
+ return launchConfig.getWorkingCopy();
+ }
+ catch (Exception e) {
+ return launchConfig;
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return CLASSES;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/LaunchStepContext.java
index 7e18fb467..cd30c2a1d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/StepContextAdapter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/LaunchStepContext.java
@@ -1,115 +1,101 @@
-/*******************************************************************************
- * 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.internal.adapters;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-
-/**
- * Peer model step context adapter implementation.
- */
-public class StepContextAdapter extends PlatformObject implements IStepContext {
- // Reference to the launch
- private final ILaunch launch;
-
- /**
- * Constructor.
- *
- * @param launch The launch. Must not be <code>null</code>.
- */
- public StepContextAdapter(ILaunch launch) {
- super();
- Assert.isNotNull(launch);
- this.launch = launch;
- }
-
- /**
- * Returns the launch.
- * @return The launch.
- */
- public ILaunch getLaunch() {
- return launch;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getId()
- */
- @Override
- public String getId() {
- return launch != null && launch.getLaunchConfiguration() != null ? launch.getLaunchConfiguration().getName() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getSecondaryId()
- */
- @Override
- public String getSecondaryId() {
- return launch != null ? launch.getLaunchMode() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getName()
- */
- @Override
- public String getName() {
- return getId();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getContextObject()
- */
- @Override
- public Object getContextObject() {
- return launch;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getInfo(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public String getInfo(IPropertiesContainer data) {
- try {
- return getName() + "(" + launch.getLaunchMode() + ") - " + launch.getLaunchConfiguration().getType().getName(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (CoreException e) {
- }
- return getName() + "(" + launch.getLaunchMode() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(final Class adapter) {
- if (ILaunch.class.equals(adapter)) {
- return launch;
- }
-
- if (ILaunchConfiguration.class.isAssignableFrom(adapter)) {
- return launch.getLaunchConfiguration();
- }
-
- if (ILaunchConfigurationType.class.isAssignableFrom(adapter)) {
- try {
- return launch.getLaunchConfiguration().getType();
- }
- catch (CoreException e) {
- }
- }
-
- return super.getAdapter(adapter);
- }
-}
+/*******************************************************************************
+ * 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.internal.adapters;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.context.AbstractStepContext;
+
+/**
+ * Launch step context adapter implementation.
+ */
+public class LaunchStepContext extends AbstractStepContext {
+
+ /**
+ * Constructor.
+ *
+ * @param launch The launch. Must not be <code>null</code>.
+ */
+ public LaunchStepContext(ILaunch launch) {
+ super(launch);
+ }
+
+ /**
+ * Returns the launch.
+ * @return The launch.
+ */
+ public ILaunch getLaunch() {
+ return (ILaunch)getContextObject();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getId()
+ */
+ @Override
+ public String getId() {
+ return getLaunch().getLaunchConfiguration() != null ? getLaunch().getLaunchConfiguration().getName() : null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getSecondaryId()
+ */
+ @Override
+ public String getSecondaryId() {
+ return getLaunch().getLaunchMode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getName()
+ */
+ @Override
+ public String getName() {
+ return getId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getInfo(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public String getInfo(IPropertiesContainer data) {
+ try {
+ return getName() + "(" + getLaunch().getLaunchMode() + ") - " + getLaunch().getLaunchConfiguration().getType().getName(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ catch (CoreException e) {
+ }
+ return getName() + "(" + getLaunch().getLaunchMode() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(final Class adapter) {
+ if (ILaunch.class.equals(adapter)) {
+ return getLaunch();
+ }
+
+ if (ILaunchConfiguration.class.isAssignableFrom(adapter)) {
+ return getLaunch().getLaunchConfiguration();
+ }
+
+ if (ILaunchConfigurationType.class.isAssignableFrom(adapter)) {
+ try {
+ return getLaunch().getLaunchConfiguration().getType();
+ }
+ catch (CoreException e) {
+ }
+ }
+
+ return super.getAdapter(adapter);
+ }
+}
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 905ec2799..e42042a10 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
@@ -1,178 +1,178 @@
-/*******************************************************************************
- * 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.lm.delegates;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate;
-import org.eclipse.tcf.te.core.cdt.CdtUtils;
-import org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
-import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
-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.interfaces.delegates.ILabelProviderDelegate;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.IAttachLaunchAttributes;
-
-/**
- * RemoteAppLaunchManagerDelegate
- */
-public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
-
- // mandatory attributes for attach launch configurations
- private static final String[] MANDATORY_CONFIG_ATTRIBUTES = new String[] {
- ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS
- };
-
- /**
- * Constructor.
- */
- public AttachLaunchManagerDelegate() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfigAttributes(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
- */
- @Override
- public void updateLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
- super.updateLaunchConfigAttributes(wc, launchSpec);
-
- wc.setAttribute(IAttachLaunchAttributes.ATTR_ATTACH_SERVICES, (List<?>)null);
- wc.setAttribute(TCFLaunchDelegate.ATTR_DISCONNECT_ON_CTX_EXIT, false);
- copySpecToConfig(launchSpec, wc);
-
- wc.rename(getDefaultLaunchName(wc));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#initLaunchConfigAttributes(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
- */
- @Override
- public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
- super.initLaunchConfigAttributes(wc, launchSpec);
-
- wc.setAttribute(IAttachLaunchAttributes.ATTR_ATTACH_SERVICES, (List<?>)null);
- wc.setAttribute(TCFLaunchDelegate.ATTR_DISCONNECT_ON_CTX_EXIT, false);
- try {
- wc.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, CdtUtils.getDefaultSourceLookupDirector().getMemento());
- }
- catch (Exception e) {
-
- }
- copySpecToConfig(launchSpec, wc);
-
- wc.rename(getDefaultLaunchName(wc));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfig(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext, boolean)
- */
- @Override
- public void updateLaunchConfig(ILaunchConfigurationWorkingCopy wc, ISelectionContext selContext, boolean replace) {
- super.updateLaunchConfig(wc, selContext, replace);
-
- if (selContext instanceof IRemoteSelectionContext) {
- IRemoteSelectionContext remoteCtx = (IRemoteSelectionContext)selContext;
- LaunchContextsPersistenceDelegate.setLaunchContexts(wc, new IModelNode[]{remoteCtx.getRemoteCtx()});
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#addLaunchSpecAttributes(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification, java.lang.String, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext)
- */
- @Override
- protected ILaunchSpecification addLaunchSpecAttributes(ILaunchSpecification launchSpec, String launchConfigTypeId, ISelectionContext selectionContext) {
- launchSpec = super.addLaunchSpecAttributes(launchSpec, launchConfigTypeId, selectionContext);
-
- if (selectionContext instanceof IRemoteSelectionContext) {
- List<IModelNode> launchContexts = new ArrayList<IModelNode>(Arrays.asList(LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec)));
- IModelNode remoteCtx = ((IRemoteSelectionContext)selectionContext).getRemoteCtx();
- if (!launchContexts.contains(remoteCtx)) {
- launchContexts.add(remoteCtx);
- LaunchContextsPersistenceDelegate.setLaunchContexts(launchSpec, launchContexts.toArray(new IModelNode[launchContexts.size()]));
- }
-
- launchSpec.setLaunchConfigName(getDefaultLaunchName(launchSpec));
- }
-
- return launchSpec;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
- */
- @Override
- public String getDefaultLaunchName(ILaunchSpecification launchSpec) {
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec);
- String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null));
- return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchSpec);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public String getDefaultLaunchName(ILaunchConfiguration launchConfig) {
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchConfig);
- String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null));
- return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchConfig);
- }
-
- 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();
- }
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getMandatoryAttributes()
- */
- @Override
- protected List<String> getMandatoryAttributes() {
- return Arrays.asList(MANDATORY_CONFIG_ATTRIBUTES);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getNumAttributes()
- */
- @Override
- protected int getNumAttributes() {
- return 1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getAttributeRanking(java.lang.String)
- */
- @Override
- protected int getAttributeRanking(String attributeKey) {
- if (ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS.equals(attributeKey)) {
- return getNumAttributes() * 2;
- }
- return 1;
- }
-}
+/*******************************************************************************
+ * 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.lm.delegates;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate;
+import org.eclipse.tcf.te.core.cdt.CdtUtils;
+import org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+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.interfaces.delegates.ILabelProviderDelegate;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.steps.ITcfLaunchStepAttributes;
+
+/**
+ * RemoteAppLaunchManagerDelegate
+ */
+public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
+
+ // mandatory attributes for attach launch configurations
+ private static final String[] MANDATORY_CONFIG_ATTRIBUTES = new String[] {
+ ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS
+ };
+
+ /**
+ * Constructor.
+ */
+ public AttachLaunchManagerDelegate() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfigAttributes(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
+ */
+ @Override
+ public void updateLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
+ super.updateLaunchConfigAttributes(wc, launchSpec);
+
+ wc.setAttribute(ITcfLaunchStepAttributes.ATTR_ATTACH_SERVICES, (List<?>)null);
+ wc.setAttribute(TCFLaunchDelegate.ATTR_DISCONNECT_ON_CTX_EXIT, false);
+ copySpecToConfig(launchSpec, wc);
+
+ wc.rename(getDefaultLaunchName(wc));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#initLaunchConfigAttributes(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
+ */
+ @Override
+ public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
+ super.initLaunchConfigAttributes(wc, launchSpec);
+
+ wc.setAttribute(ITcfLaunchStepAttributes.ATTR_ATTACH_SERVICES, (List<?>)null);
+ wc.setAttribute(TCFLaunchDelegate.ATTR_DISCONNECT_ON_CTX_EXIT, false);
+ try {
+ wc.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, CdtUtils.getDefaultSourceLookupDirector().getMemento());
+ }
+ catch (Exception e) {
+
+ }
+ copySpecToConfig(launchSpec, wc);
+
+ wc.rename(getDefaultLaunchName(wc));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfig(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext, boolean)
+ */
+ @Override
+ public void updateLaunchConfig(ILaunchConfigurationWorkingCopy wc, ISelectionContext selContext, boolean replace) {
+ super.updateLaunchConfig(wc, selContext, replace);
+
+ if (selContext instanceof IRemoteSelectionContext) {
+ IRemoteSelectionContext remoteCtx = (IRemoteSelectionContext)selContext;
+ LaunchContextsPersistenceDelegate.setLaunchContexts(wc, new IModelNode[]{remoteCtx.getRemoteCtx()});
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#addLaunchSpecAttributes(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification, java.lang.String, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext)
+ */
+ @Override
+ protected ILaunchSpecification addLaunchSpecAttributes(ILaunchSpecification launchSpec, String launchConfigTypeId, ISelectionContext selectionContext) {
+ launchSpec = super.addLaunchSpecAttributes(launchSpec, launchConfigTypeId, selectionContext);
+
+ if (selectionContext instanceof IRemoteSelectionContext) {
+ List<IModelNode> launchContexts = new ArrayList<IModelNode>(Arrays.asList(LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec)));
+ IModelNode remoteCtx = ((IRemoteSelectionContext)selectionContext).getRemoteCtx();
+ if (!launchContexts.contains(remoteCtx)) {
+ launchContexts.add(remoteCtx);
+ LaunchContextsPersistenceDelegate.setLaunchContexts(launchSpec, launchContexts.toArray(new IModelNode[launchContexts.size()]));
+ }
+
+ launchSpec.setLaunchConfigName(getDefaultLaunchName(launchSpec));
+ }
+
+ return launchSpec;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
+ */
+ @Override
+ public String getDefaultLaunchName(ILaunchSpecification launchSpec) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec);
+ String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null));
+ return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchSpec);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public String getDefaultLaunchName(ILaunchConfiguration launchConfig) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchConfig);
+ String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null));
+ return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchConfig);
+ }
+
+ 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();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getMandatoryAttributes()
+ */
+ @Override
+ protected List<String> getMandatoryAttributes() {
+ return Arrays.asList(MANDATORY_CONFIG_ATTRIBUTES);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getNumAttributes()
+ */
+ @Override
+ protected int getNumAttributes() {
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getAttributeRanking(java.lang.String)
+ */
+ @Override
+ protected int getAttributeRanking(String attributeKey) {
+ if (ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS.equals(attributeKey)) {
+ return getNumAttributes() * 2;
+ }
+ return 1;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
index 58f0522ba..3a7aa926e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
@@ -1,331 +1,331 @@
-/*******************************************************************************
- * 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.lm.delegates;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.te.core.cdt.CdtUtils;
-import org.eclipse.tcf.te.launch.core.exceptions.LaunchServiceException;
-import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
-import org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.IReferencedProjectLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
-import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
-import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectItem;
-import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectsPersistenceDelegate;
-import org.eclipse.tcf.te.launch.core.selection.interfaces.IProjectSelectionContext;
-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.filetransfer.FileTransferItem;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.IRemoteAppLaunchAttributes;
-
-/**
- * RemoteAppLaunchManagerDelegate
- */
-public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
-
- private static final String[] MANDATORY_CONFIG_ATTRIBUTES = new String[] {
- ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS,
- IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE
- };
-
- /**
- * Constructor.
- */
- public RemoteAppLaunchManagerDelegate() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#initLaunchConfigAttributes(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
- */
- @Override
- public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
- super.initLaunchConfigAttributes(wc, launchSpec);
-
- wc.setAttribute(IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN, true);
- wc.setAttribute(IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN, true);
- try {
- wc.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, CdtUtils.getDefaultSourceLookupDirector().getMemento());
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec);
- if (contexts != null && contexts.length == 1) {
- ILaunchConfiguration attachLaunch = (ILaunchConfiguration)Platform.getAdapterManager().getAdapter(contexts[0], ILaunchConfiguration.class);
- wc.setAttribute("org.eclipse.tcf.debug.PathMap", attachLaunch.getAttribute("org.eclipse.tcf.debug.PathMap", (String)null)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- catch (Exception e) {
- }
- copySpecToConfig(launchSpec, wc);
-
- wc.rename(getDefaultLaunchName(wc));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfig(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext, boolean)
- */
- @Override
- public void updateLaunchConfig(ILaunchConfigurationWorkingCopy wc, ISelectionContext selContext, boolean replace) {
- super.updateLaunchConfig(wc, selContext, replace);
-
- if (selContext instanceof IProjectSelectionContext) {
- List<IFileTransferItem> transfers;
- List<IReferencedProjectItem> projects;
- String processPath;
- if (replace) {
- transfers = new ArrayList<IFileTransferItem>();
- projects = new ArrayList<IReferencedProjectItem>();
- processPath = getProcessImageAndSetProjectAndTransfer((IProjectSelectionContext)selContext, transfers, projects);
-
- FileTransfersPersistenceDelegate.setFileTransfers(wc, transfers.toArray(new IFileTransferItem[transfers.size()]));
- ReferencedProjectsPersistenceDelegate.setReferencedProjects(wc, projects.toArray(new IReferencedProjectItem[projects.size()]));
- if (processPath != null && processPath.trim().length() > 0) {
- DefaultPersistenceDelegate.setAttribute(wc, IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, processPath);
- }
- }
- else {
- transfers = new ArrayList<IFileTransferItem>(Arrays.asList(FileTransfersPersistenceDelegate.getFileTransfers(wc)));
- projects = new ArrayList<IReferencedProjectItem>(Arrays.asList(ReferencedProjectsPersistenceDelegate.getReferencedProjects(wc)));
- processPath = getProcessImageAndSetProjectAndTransfer((IProjectSelectionContext)selContext, transfers, projects);
-
- FileTransfersPersistenceDelegate.setFileTransfers(wc, transfers.toArray(new IFileTransferItem[transfers.size()]));
- ReferencedProjectsPersistenceDelegate.setReferencedProjects(wc, projects.toArray(new IReferencedProjectItem[projects.size()]));
- if (processPath != null && processPath.trim().length() > 0 && !DefaultPersistenceDelegate.hasAttribute(wc, IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE)) {
- DefaultPersistenceDelegate.setAttribute(wc, IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, processPath);
- }
- }
- }
- else if (selContext instanceof IRemoteSelectionContext) {
- IRemoteSelectionContext remoteCtx = (IRemoteSelectionContext)selContext;
- LaunchContextsPersistenceDelegate.setLaunchContexts(wc, new IModelNode[]{remoteCtx.getRemoteCtx()});
- }
-
- wc.rename(getDefaultLaunchName(wc));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#addLaunchSpecAttributes(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification, java.lang.String, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext)
- */
- @Override
- protected ILaunchSpecification addLaunchSpecAttributes(ILaunchSpecification launchSpec, String launchConfigTypeId, ISelectionContext selectionContext) {
- launchSpec = super.addLaunchSpecAttributes(launchSpec, launchConfigTypeId, selectionContext);
-
- if (selectionContext instanceof IRemoteSelectionContext) {
- List<IModelNode> launchContexts = new ArrayList<IModelNode>(Arrays.asList(LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec)));
- IModelNode remoteCtx = ((IRemoteSelectionContext)selectionContext).getRemoteCtx();
- if (!launchContexts.contains(remoteCtx)) {
- launchContexts.add(remoteCtx);
- LaunchContextsPersistenceDelegate.setLaunchContexts(launchSpec, launchContexts.toArray(new IModelNode[launchContexts.size()]));
- }
-
- launchSpec.setLaunchConfigName(getDefaultLaunchName(launchSpec));
- }
- else if (selectionContext instanceof IProjectSelectionContext) {
- List<IFileTransferItem> transfers = new ArrayList<IFileTransferItem>(Arrays.asList(FileTransfersPersistenceDelegate.getFileTransfers(launchSpec)));
- List<IReferencedProjectItem> projects = new ArrayList<IReferencedProjectItem>(Arrays.asList(ReferencedProjectsPersistenceDelegate.getReferencedProjects(launchSpec)));
- String processPath = getProcessImageAndSetProjectAndTransfer((IProjectSelectionContext)selectionContext, transfers, projects);
-
- FileTransfersPersistenceDelegate.setFileTransfers(launchSpec, transfers.toArray(new IFileTransferItem[transfers.size()]));
- ReferencedProjectsPersistenceDelegate.setReferencedProjects(launchSpec, projects.toArray(new IReferencedProjectItem[projects.size()]));
- launchSpec.addAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, processPath);
-
- launchSpec.setLaunchConfigName(getDefaultLaunchName(launchSpec));
- }
-
- return launchSpec;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
- */
- @Override
- public String getDefaultLaunchName(ILaunchSpecification launchSpec) {
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec);
- String processPath = (String)launchSpec.getAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, null);
- String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null), processPath);
- return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchSpec);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public String getDefaultLaunchName(ILaunchConfiguration launchConfig) {
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchConfig);
- String processPath = DefaultPersistenceDelegate.getAttribute(launchConfig, IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, (String)null);
- String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null), processPath);
- return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchConfig);
- }
-
- private String getDefaultLaunchName(IModelNode context, String processPath) {
- String name = ""; //$NON-NLS-1$
- if (processPath != null) {
- name += new Path(processPath).lastSegment();
- }
- if (context != null) {
- IPropertiesAccessService service = ServiceManager.getInstance().getService(context, IPropertiesAccessService.class);
- Object dnsName = service != null ? service.getProperty(context, "dns.name.transient") : null; //$NON-NLS-1$
- String ctxName = service != null ? (String)service.getTargetAddress(context).get(IPropertiesAccessServiceConstants.PROP_ADDRESS) : null;
- ctxName = dnsName != null && dnsName.toString().trim().length() > 0 ? dnsName.toString().trim() : ctxName;
-
- name += " (" + ctxName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- return name.trim();
- }
-
- private String getProcessImageAndSetProjectAndTransfer(IProjectSelectionContext prjContext, List<IFileTransferItem> transfers, List<IReferencedProjectItem> projects) {
- String processName = null;
- String processPath = null;
-
- boolean added = false;
- for (Object selection : prjContext.getSelections()) {
- if (selection instanceof IPath) {
- IPath path = (IPath)selection;
- IFileTransferItem transfer = new FileTransferItem(path, new Path("/tmp/")); //$NON-NLS-1$
- if (!transfers.contains(transfer)) {
- transfers.add(transfer);
- }
- if (!added) {
- processName = path.lastSegment();
- processPath = "/tmp/" + processName; //$NON-NLS-1$
- }
- added = true;
- }
- }
-
- IReferencedProjectItem project = new ReferencedProjectItem(prjContext.getProjectCtx().getName());
- if (!projects.contains(project)) {
- projects.add(project);
- }
-
- return processPath;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#validate(java.lang.String, org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public void validate(String launchMode, ILaunchConfiguration launchConfig) throws LaunchServiceException {
- super.validate(launchMode, launchConfig);
-
- StringBuilder missingAttributes = new StringBuilder();
- for (String attribute : MANDATORY_CONFIG_ATTRIBUTES) {
- if (!isValidAttribute(attribute, launchConfig, launchMode)) {
- if (missingAttributes.length() == 0) {
- missingAttributes.append(attribute);
- } else {
- missingAttributes.append(", "); //$NON-NLS-1$
- missingAttributes.append(attribute);
- }
- }
- }
- if (missingAttributes.length() > 0) {
- throw new LaunchServiceException("Missing launch configuration attributes: " + '\n' + missingAttributes.toString(), LaunchServiceException.TYPE_MISSING_LAUNCH_CONFIG_ATTR); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#equals(java.lang.String, java.lang.Object, java.lang.Object, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification, org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
- */
- @Override
- protected int equals(String attributeKey, Object specValue, Object confValue, ILaunchSpecification launchSpec, ILaunchConfiguration launchConfig, String launchMode) {
-
- if (IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE.equals(attributeKey)) {
- // get match of object
- int match = specValue.equals(confValue) ? FULL_MATCH : NO_MATCH;
- // compare objects in the list when they are not already equal
- if (match != FULL_MATCH) {
- IPath confPath = new Path(confValue.toString());
- IPath specPath = new Path(specValue.toString());
-
- if (confPath.lastSegment().equals(specPath.lastSegment())) {
- match = PARTIAL_MATCH;
- }
- else {
- match = NO_MATCH;
- }
- }
- return match;
- }
-
- return super.equals(attributeKey, specValue, confValue, launchSpec, launchConfig, launchMode);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getNumAttributes()
- */
- @Override
- protected int getNumAttributes() {
- return 8;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getAttributeRanking(java.lang.String)
- */
- @Override
- protected int getAttributeRanking(String attributeKey) {
- if (ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS.equals(attributeKey)) {
- return getNumAttributes() * 256;
- }
- else if (IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE.equals(attributeKey)) {
- return getNumAttributes() * 128;
- }
- else if (IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS.equals(attributeKey)) {
- return getNumAttributes() * 64;
- }
- else if (IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS.equals(attributeKey)) {
- return getNumAttributes() * 32;
- }
- else if (IReferencedProjectLaunchAttributes.ATTR_REFERENCED_PROJECTS.equals(attributeKey)) {
- return getNumAttributes() * 16;
- }
- else if (IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY.equals(attributeKey)) {
- return getNumAttributes() * 8;
- }
- else if (IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN.equals(attributeKey)) {
- return getNumAttributes() * 4;
- }
- else if (IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN.equals(attributeKey)) {
- return getNumAttributes() * 2;
- }
- else {
- return 1;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDescription(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public String getDescription(ILaunchConfiguration config) {
- String image = DefaultPersistenceDelegate.getAttribute(config, IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, (String)null);
- String args = DefaultPersistenceDelegate.getAttribute(config, IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS, ""); //$NON-NLS-1$
- if (image != null) {
- return new Path(image).toPortableString() + " " + args; //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * 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.lm.delegates;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.tcf.te.core.cdt.CdtUtils;
+import org.eclipse.tcf.te.launch.core.exceptions.LaunchServiceException;
+import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
+import org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.IReferencedProjectLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectItem;
+import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectsPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.IProjectSelectionContext;
+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.filetransfer.FileTransferItem;
+import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
+import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.tcf.processes.core.interfaces.steps.IProcessesStepAttributes;
+
+/**
+ * RemoteAppLaunchManagerDelegate
+ */
+public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
+
+ private static final String[] MANDATORY_CONFIG_ATTRIBUTES = new String[] {
+ ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS,
+ IProcessesStepAttributes.ATTR_PROCESS_IMAGE
+ };
+
+ /**
+ * Constructor.
+ */
+ public RemoteAppLaunchManagerDelegate() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#initLaunchConfigAttributes(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
+ */
+ @Override
+ public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
+ super.initLaunchConfigAttributes(wc, launchSpec);
+
+ wc.setAttribute(IProcessesStepAttributes.ATTR_STOP_AT_MAIN, true);
+ wc.setAttribute(IProcessesStepAttributes.ATTR_ATTACH_CHILDREN, true);
+ try {
+ wc.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, CdtUtils.getDefaultSourceLookupDirector().getMemento());
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec);
+ if (contexts != null && contexts.length == 1) {
+ ILaunchConfiguration attachLaunch = (ILaunchConfiguration)Platform.getAdapterManager().getAdapter(contexts[0], ILaunchConfiguration.class);
+ wc.setAttribute("org.eclipse.tcf.debug.PathMap", attachLaunch.getAttribute("org.eclipse.tcf.debug.PathMap", (String)null)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ catch (Exception e) {
+ }
+ copySpecToConfig(launchSpec, wc);
+
+ wc.rename(getDefaultLaunchName(wc));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfig(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext, boolean)
+ */
+ @Override
+ public void updateLaunchConfig(ILaunchConfigurationWorkingCopy wc, ISelectionContext selContext, boolean replace) {
+ super.updateLaunchConfig(wc, selContext, replace);
+
+ if (selContext instanceof IProjectSelectionContext) {
+ List<IFileTransferItem> transfers;
+ List<IReferencedProjectItem> projects;
+ String processPath;
+ if (replace) {
+ transfers = new ArrayList<IFileTransferItem>();
+ projects = new ArrayList<IReferencedProjectItem>();
+ processPath = getProcessImageAndSetProjectAndTransfer((IProjectSelectionContext)selContext, transfers, projects);
+
+ FileTransfersPersistenceDelegate.setFileTransfers(wc, transfers.toArray(new IFileTransferItem[transfers.size()]));
+ ReferencedProjectsPersistenceDelegate.setReferencedProjects(wc, projects.toArray(new IReferencedProjectItem[projects.size()]));
+ if (processPath != null && processPath.trim().length() > 0) {
+ DefaultPersistenceDelegate.setAttribute(wc, IProcessesStepAttributes.ATTR_PROCESS_IMAGE, processPath);
+ }
+ }
+ else {
+ transfers = new ArrayList<IFileTransferItem>(Arrays.asList(FileTransfersPersistenceDelegate.getFileTransfers(wc)));
+ projects = new ArrayList<IReferencedProjectItem>(Arrays.asList(ReferencedProjectsPersistenceDelegate.getReferencedProjects(wc)));
+ processPath = getProcessImageAndSetProjectAndTransfer((IProjectSelectionContext)selContext, transfers, projects);
+
+ FileTransfersPersistenceDelegate.setFileTransfers(wc, transfers.toArray(new IFileTransferItem[transfers.size()]));
+ ReferencedProjectsPersistenceDelegate.setReferencedProjects(wc, projects.toArray(new IReferencedProjectItem[projects.size()]));
+ if (processPath != null && processPath.trim().length() > 0 && !DefaultPersistenceDelegate.hasAttribute(wc, IProcessesStepAttributes.ATTR_PROCESS_IMAGE)) {
+ DefaultPersistenceDelegate.setAttribute(wc, IProcessesStepAttributes.ATTR_PROCESS_IMAGE, processPath);
+ }
+ }
+ }
+ else if (selContext instanceof IRemoteSelectionContext) {
+ IRemoteSelectionContext remoteCtx = (IRemoteSelectionContext)selContext;
+ LaunchContextsPersistenceDelegate.setLaunchContexts(wc, new IModelNode[]{remoteCtx.getRemoteCtx()});
+ }
+
+ wc.rename(getDefaultLaunchName(wc));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#addLaunchSpecAttributes(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification, java.lang.String, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext)
+ */
+ @Override
+ protected ILaunchSpecification addLaunchSpecAttributes(ILaunchSpecification launchSpec, String launchConfigTypeId, ISelectionContext selectionContext) {
+ launchSpec = super.addLaunchSpecAttributes(launchSpec, launchConfigTypeId, selectionContext);
+
+ if (selectionContext instanceof IRemoteSelectionContext) {
+ List<IModelNode> launchContexts = new ArrayList<IModelNode>(Arrays.asList(LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec)));
+ IModelNode remoteCtx = ((IRemoteSelectionContext)selectionContext).getRemoteCtx();
+ if (!launchContexts.contains(remoteCtx)) {
+ launchContexts.add(remoteCtx);
+ LaunchContextsPersistenceDelegate.setLaunchContexts(launchSpec, launchContexts.toArray(new IModelNode[launchContexts.size()]));
+ }
+
+ launchSpec.setLaunchConfigName(getDefaultLaunchName(launchSpec));
+ }
+ else if (selectionContext instanceof IProjectSelectionContext) {
+ List<IFileTransferItem> transfers = new ArrayList<IFileTransferItem>(Arrays.asList(FileTransfersPersistenceDelegate.getFileTransfers(launchSpec)));
+ List<IReferencedProjectItem> projects = new ArrayList<IReferencedProjectItem>(Arrays.asList(ReferencedProjectsPersistenceDelegate.getReferencedProjects(launchSpec)));
+ String processPath = getProcessImageAndSetProjectAndTransfer((IProjectSelectionContext)selectionContext, transfers, projects);
+
+ FileTransfersPersistenceDelegate.setFileTransfers(launchSpec, transfers.toArray(new IFileTransferItem[transfers.size()]));
+ ReferencedProjectsPersistenceDelegate.setReferencedProjects(launchSpec, projects.toArray(new IReferencedProjectItem[projects.size()]));
+ launchSpec.addAttribute(IProcessesStepAttributes.ATTR_PROCESS_IMAGE, processPath);
+
+ launchSpec.setLaunchConfigName(getDefaultLaunchName(launchSpec));
+ }
+
+ return launchSpec;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
+ */
+ @Override
+ public String getDefaultLaunchName(ILaunchSpecification launchSpec) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec);
+ String processPath = (String)launchSpec.getAttribute(IProcessesStepAttributes.ATTR_PROCESS_IMAGE, null);
+ String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null), processPath);
+ return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchSpec);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDefaultLaunchName(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public String getDefaultLaunchName(ILaunchConfiguration launchConfig) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launchConfig);
+ String processPath = DefaultPersistenceDelegate.getAttribute(launchConfig, IProcessesStepAttributes.ATTR_PROCESS_IMAGE, (String)null);
+ String name = getDefaultLaunchName((contexts != null && contexts.length > 0 ? contexts[0] : null), processPath);
+ return name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchConfig);
+ }
+
+ private String getDefaultLaunchName(IModelNode context, String processPath) {
+ String name = ""; //$NON-NLS-1$
+ if (processPath != null) {
+ name += new Path(processPath).lastSegment();
+ }
+ if (context != null) {
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(context, IPropertiesAccessService.class);
+ Object dnsName = service != null ? service.getProperty(context, "dns.name.transient") : null; //$NON-NLS-1$
+ String ctxName = service != null ? (String)service.getTargetAddress(context).get(IPropertiesAccessServiceConstants.PROP_ADDRESS) : null;
+ ctxName = dnsName != null && dnsName.toString().trim().length() > 0 ? dnsName.toString().trim() : ctxName;
+
+ name += " (" + ctxName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return name.trim();
+ }
+
+ private String getProcessImageAndSetProjectAndTransfer(IProjectSelectionContext prjContext, List<IFileTransferItem> transfers, List<IReferencedProjectItem> projects) {
+ String processName = null;
+ String processPath = null;
+
+ boolean added = false;
+ for (Object selection : prjContext.getSelections()) {
+ if (selection instanceof IPath) {
+ IPath path = (IPath)selection;
+ IFileTransferItem transfer = new FileTransferItem(path, new Path("/tmp/")); //$NON-NLS-1$
+ if (!transfers.contains(transfer)) {
+ transfers.add(transfer);
+ }
+ if (!added) {
+ processName = path.lastSegment();
+ processPath = "/tmp/" + processName; //$NON-NLS-1$
+ }
+ added = true;
+ }
+ }
+
+ IReferencedProjectItem project = new ReferencedProjectItem(prjContext.getProjectCtx().getName());
+ if (!projects.contains(project)) {
+ projects.add(project);
+ }
+
+ return processPath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#validate(java.lang.String, org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public void validate(String launchMode, ILaunchConfiguration launchConfig) throws LaunchServiceException {
+ super.validate(launchMode, launchConfig);
+
+ StringBuilder missingAttributes = new StringBuilder();
+ for (String attribute : MANDATORY_CONFIG_ATTRIBUTES) {
+ if (!isValidAttribute(attribute, launchConfig, launchMode)) {
+ if (missingAttributes.length() == 0) {
+ missingAttributes.append(attribute);
+ } else {
+ missingAttributes.append(", "); //$NON-NLS-1$
+ missingAttributes.append(attribute);
+ }
+ }
+ }
+ if (missingAttributes.length() > 0) {
+ throw new LaunchServiceException("Missing launch configuration attributes: " + '\n' + missingAttributes.toString(), LaunchServiceException.TYPE_MISSING_LAUNCH_CONFIG_ATTR); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#equals(java.lang.String, java.lang.Object, java.lang.Object, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification, org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
+ */
+ @Override
+ protected int equals(String attributeKey, Object specValue, Object confValue, ILaunchSpecification launchSpec, ILaunchConfiguration launchConfig, String launchMode) {
+
+ if (IProcessesStepAttributes.ATTR_PROCESS_IMAGE.equals(attributeKey)) {
+ // get match of object
+ int match = specValue.equals(confValue) ? FULL_MATCH : NO_MATCH;
+ // compare objects in the list when they are not already equal
+ if (match != FULL_MATCH) {
+ IPath confPath = new Path(confValue.toString());
+ IPath specPath = new Path(specValue.toString());
+
+ if (confPath.lastSegment().equals(specPath.lastSegment())) {
+ match = PARTIAL_MATCH;
+ }
+ else {
+ match = NO_MATCH;
+ }
+ }
+ return match;
+ }
+
+ return super.equals(attributeKey, specValue, confValue, launchSpec, launchConfig, launchMode);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getNumAttributes()
+ */
+ @Override
+ protected int getNumAttributes() {
+ return 8;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getAttributeRanking(java.lang.String)
+ */
+ @Override
+ protected int getAttributeRanking(String attributeKey) {
+ if (ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS.equals(attributeKey)) {
+ return getNumAttributes() * 256;
+ }
+ else if (IProcessesStepAttributes.ATTR_PROCESS_IMAGE.equals(attributeKey)) {
+ return getNumAttributes() * 128;
+ }
+ else if (IProcessesStepAttributes.ATTR_PROCESS_ARGUMENTS.equals(attributeKey)) {
+ return getNumAttributes() * 64;
+ }
+ else if (IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS.equals(attributeKey)) {
+ return getNumAttributes() * 32;
+ }
+ else if (IReferencedProjectLaunchAttributes.ATTR_REFERENCED_PROJECTS.equals(attributeKey)) {
+ return getNumAttributes() * 16;
+ }
+ else if (IProcessesStepAttributes.ATTR_STOP_AT_ENTRY.equals(attributeKey)) {
+ return getNumAttributes() * 8;
+ }
+ else if (IProcessesStepAttributes.ATTR_STOP_AT_MAIN.equals(attributeKey)) {
+ return getNumAttributes() * 4;
+ }
+ else if (IProcessesStepAttributes.ATTR_ATTACH_CHILDREN.equals(attributeKey)) {
+ return getNumAttributes() * 2;
+ }
+ else {
+ return 1;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#getDescription(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public String getDescription(ILaunchConfiguration config) {
+ String image = DefaultPersistenceDelegate.getAttribute(config, IProcessesStepAttributes.ATTR_PROCESS_IMAGE, (String)null);
+ String args = DefaultPersistenceDelegate.getAttribute(config, IProcessesStepAttributes.ATTR_PROCESS_ARGUMENTS, ""); //$NON-NLS-1$
+ if (image != null) {
+ return new Path(image).toPortableString() + " " + args; //$NON-NLS-1$
+ }
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AbstractTcfLaunchStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AbstractTcfLaunchStep.java
index 48f1b0892..2f19954b6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AbstractTcfLaunchStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AbstractTcfLaunchStep.java
@@ -1,35 +1,45 @@
-/*******************************************************************************
- * 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 org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.launch.core.steps.AbstractLaunchStep;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-
-/**
- * Abstract TCF launch step implementation.
- */
-public abstract class AbstractTcfLaunchStep extends AbstractLaunchStep {
-
- /**
- * Returns the active peer model that is currently used.
- *
- * @param data The data giving object. Must not be <code>null</code>.
- * @return The active peer model.
- */
- protected IPeerModel getActivePeerModel(IFullQualifiedId fullQualifiedId, IPropertiesContainer data) {
- IModelNode node = getActiveLaunchContext(fullQualifiedId, data);
- Assert.isTrue(node instanceof IPeerModel);
- return (IPeerModel)node;
- }
-}
+/*******************************************************************************
+ * 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 org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.te.launch.core.steps.AbstractLaunchStep;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Abstract TCF launch step implementation.
+ */
+public abstract class AbstractTcfLaunchStep extends AbstractLaunchStep {
+
+ /**
+ * Returns the active peer model context that is currently used.
+ *
+ * @param context The step context. Must not be <code>null</code>.
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualfied id for this step. Must not be <code>null</code>.
+ * @return The active peer model context.
+ */
+ protected IPeerModel getActivePeerModelContext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId) {
+ Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ IPeerModel peerModel = null;
+ if (activeContext instanceof IPeerModel)
+ return (IPeerModel)activeContext;
+ if (activeContext instanceof IAdaptable)
+ peerModel = (IPeerModel)((IAdaptable)activeContext).getAdapter(IPeerModel.class);
+ if (peerModel == null)
+ peerModel = (IPeerModel)Platform.getAdapterManager().getAdapter(activeContext, IPeerModel.class);
+
+ return peerModel;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AttachDebuggerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AttachDebuggerStep.java
index 3ac987781..afb5c2a32 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AttachDebuggerStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/AttachDebuggerStep.java
@@ -1,73 +1,65 @@
-/*******************************************************************************
- * 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 org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-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.interfaces.IFullQualifiedId;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-import org.eclipse.tcf.te.runtime.utils.StatusHelper;
-import org.eclipse.tcf.te.tcf.launch.core.delegates.Launch;
-
-/**
- * Attach debugger step implementation.
- */
-public class AttachDebuggerStep extends AbstractTcfLaunchStep {
-
- /**
- * Constructor.
- */
- public AttachDebuggerStep() {
- }
-
- /* (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(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- }
-
- /* (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) {
- if (Protocol.isDispatchThread()) {
- internalExecute(context, data, fullQualifiedId, monitor, callback);
- }
- else {
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- internalExecute(context, data, fullQualifiedId, monitor, callback);
- }
- });
- }
- }
-
- protected void internalExecute(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
- ILaunch launch = getLaunch(context);
- if (launch instanceof Launch) {
- Launch tcfLaunch = (Launch)launch;
- try {
- tcfLaunch.attachDebugger(getActivePeerModel(fullQualifiedId, data));
- callback.done(this, Status.OK_STATUS);
- }
- catch (Exception e) {
- callback.done(this, StatusHelper.getStatus(e));
- }
- }
- }
-}
+/*******************************************************************************
+ * 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 org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunch;
+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.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.launch.core.delegates.Launch;
+
+/**
+ * Attach debugger step implementation.
+ */
+public class AttachDebuggerStep extends AbstractTcfLaunchStep {
+
+ /**
+ * Constructor.
+ */
+ public AttachDebuggerStep() {
+ }
+
+ /* (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) {
+ if (Protocol.isDispatchThread()) {
+ internalExecute(context, data, fullQualifiedId, monitor, callback);
+ }
+ else {
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ internalExecute(context, data, fullQualifiedId, monitor, callback);
+ }
+ });
+ }
+ }
+
+ protected void internalExecute(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ ILaunch launch = getLaunch(context);
+ if (launch instanceof Launch) {
+ Launch tcfLaunch = (Launch)launch;
+ try {
+ tcfLaunch.attachDebugger(getActivePeerModelContext(context, data, fullQualifiedId));
+ callback.done(this, Status.OK_STATUS);
+ }
+ catch (Exception e) {
+ callback.done(this, StatusHelper.getStatus(e));
+ }
+ }
+ }
+}
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
deleted file mode 100644
index d88e8b855..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CheckServiceStep.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.
- callback.done(this, Status.OK_STATUS);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CloseChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CloseChannelStep.java
deleted file mode 100644
index 3d5bcf82c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/CloseChannelStep.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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 org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-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.core.Tcf;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.ICommonTCFLaunchAttributes;
-
-/**
- * Close channel step implementation.
- */
-public class CloseChannelStep extends AbstractTcfLaunchStep {
-
- /**
- * Constructor.
- */
- public CloseChannelStep() {
- }
-
- /* (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(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- }
-
- /* (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(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
- IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
- if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
- Tcf.getChannelManager().closeChannel(channel);
- }
- callback.done(this, Status.OK_STATUS);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java
deleted file mode 100644
index 6b3a997de..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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 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.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
-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.filesystem.core.services.FileTransferService;
-import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.ICommonTCFLaunchAttributes;
-
-/**
- * Launch process step implementation.
- */
-public class FileTransferStep extends AbstractTcfLaunchStep {
-
- /**
- * Constructor.
- */
- public FileTransferStep() {
- }
-
- /* (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(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$
- }
-
- Object item = StepperAttributeUtil.getProperty(IFileTransferLaunchAttributes.ATTR_ACTIVE_FILE_TRANSFER, fullQualifiedId, data);
- if (!(item instanceof IFileTransferItem)) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing file transfer item")); //$NON-NLS-1$
- }
- }
-
- /* (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(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
- final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
- final IFileTransferItem item = (IFileTransferItem)StepperAttributeUtil.getProperty(IFileTransferLaunchAttributes.ATTR_ACTIVE_FILE_TRANSFER, fullQualifiedId, data);
-
- if (item.isEnabled()) {
- FileTransferService.transfer(getActivePeerModel(fullQualifiedId, data).getPeer(), channel, item, monitor, callback);
- }
- else {
- callback.done(this, Status.OK_STATUS);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep#getTotalWork(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public int getTotalWork(IStepContext context, IPropertiesContainer data) {
- return 1000;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java
deleted file mode 100644
index 71de3914f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * 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.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.Assert;
-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.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcessesV1;
-import org.eclipse.tcf.te.core.utils.text.StringUtil;
-import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-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.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-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.runtime.utils.Host;
-import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil;
-import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes;
-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.launch.core.interfaces.IRemoteAppLaunchAttributes;
-import org.eclipse.tcf.te.tcf.processes.core.interfaces.launcher.IProcessLauncher;
-import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessLauncher;
-
-/**
- * Launch process step implementation.
- */
-public class LaunchProcessStep extends AbstractTcfLaunchStep {
-
- /**
- * Constructor.
- */
- public LaunchProcessStep() {
- }
-
- /* (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(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- String processImage = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, (String)null);
- if (processImage != null && processImage.trim().length() > 0) {
- StepperAttributeUtil.setProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, fullQualifiedId, data, processImage);
- }
- else {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing process image name")); //$NON-NLS-1$
- }
-
- 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 processArguments = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS, (String)null);
- StepperAttributeUtil.setProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS, fullQualifiedId, data, processArguments);
- }
-
- /* (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) {
- final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
- Assert.isTrue(channel != null && channel.getState() == IChannel.STATE_OPEN, "channel is missing or closed"); //$NON-NLS-1$
-
- // Get the launch configuration object
- final ILaunchConfiguration lc = getLaunchConfiguration(context);
- Assert.isNotNull(lc);
-
- // Construct the launcher object
- final ProcessLauncher launcher = new ProcessLauncher();
-
- final Map<String, Object> launchAttributes = new HashMap<String, Object>();
-
- launchAttributes.put(IProcessLauncher.PROP_PROCESS_PATH, StepperAttributeUtil.getStringProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, fullQualifiedId, data));
-
- String arguments = StepperAttributeUtil.getStringProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS, fullQualifiedId, data);
- String[] args = arguments != null && !"".equals(arguments.trim()) ? StringUtil.tokenize(arguments, 0, true) : null; //$NON-NLS-1$
- launchAttributes.put(IProcessLauncher.PROP_PROCESS_ARGS, args);
-
- launchAttributes.put(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, Boolean.FALSE);
-
- boolean outputConsole = DefaultPersistenceDelegate.getAttribute(lc, "org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", true); //$NON-NLS-1$
- if (outputConsole) {
- launchAttributes.put(IProcessLauncher.PROP_PROCESS_ASSOCIATE_CONSOLE, Boolean.TRUE);
- }
- String outputFile = DefaultPersistenceDelegate.getAttribute(lc, "org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE", (String)null); //$NON-NLS-1$
- if (outputFile != null) {
- launchAttributes.put(IProcessLauncher.PROP_PROCESS_OUTPUT_REDIRECT_TO_FILE, outputFile);
- }
-
- if (ILaunchManager.DEBUG_MODE.equals(getLaunchMode(context))) {
- launchAttributes.put(IProcessLauncher.PROP_PROCESS_ATTACH, Boolean.TRUE);
-
- boolean stopAtEntry = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY, false);
- if (stopAtEntry) {
- launchAttributes.put(IProcessesV1.START_STOP_AT_ENTRY, Boolean.TRUE);
- }
-
- boolean stopAtMain = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN, false);
- if (stopAtMain) {
- launchAttributes.put(IProcessesV1.START_STOP_AT_MAIN, Boolean.TRUE);
- }
-
- boolean attachChildren = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN, false);
- if (attachChildren) {
- launchAttributes.put(IProcessesV1.START_ATTACH_CHILDREN, Boolean.TRUE);
- }
- }
-
- // Determine the active peer
- final IPeer peer = getActivePeerModel(fullQualifiedId, data).getPeer();
-
- // Fill in the launch attributes
- IPropertiesContainer container = new PropertiesContainer();
- container.setProperties(launchAttributes);
-
- // If the line separator setting is not set explicitly, try to determine it automatically (local host only).
- if (container.getProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) == null) {
- // Determine if the launch is on local host. If yes, we can preset the
- // line ending character.
- final AtomicBoolean isLocalhost = new AtomicBoolean();
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (ITransportTypes.TRANSPORT_TYPE_TCP.equals(peer.getTransportName())
- || ITransportTypes.TRANSPORT_TYPE_SSL.equals(peer.getTransportName())) {
- isLocalhost.set(IPAddressUtil.getInstance().isLocalHost(peer.getAttributes().get(IPeer.ATTR_IP_HOST)));
- }
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- if (isLocalhost.get()) {
- container.setProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR, Host.isWindowsHost() ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF);
- }
- }
-
- // Launch the process
- launcher.launch(peer, container, new Callback(callback) {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Object result = getResult();
- if (status.isOK()) {
- if (result instanceof IProcesses.ProcessContext) {
- StepperAttributeUtil.setProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId.getParentId(), data, result);
- }
- StepperAttributeUtil.setProperty("services.processes.name", fullQualifiedId.getParentId(), data, //$NON-NLS-1$
- (launcher.getSvcProcesses() instanceof IProcessesV1 ? IProcessesV1.NAME : IProcesses.NAME));
- }
- Assert.isTrue(channel.getState() == IChannel.STATE_OPEN, "channel is closed"); //$NON-NLS-1$
- super.internalDone(caller, status);
- }
- });
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/OpenChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/OpenChannelStep.java
deleted file mode 100644
index 10702102a..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/OpenChannelStep.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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 org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tcf.protocol.IChannel;
-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.runtime.utils.StatusHelper;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.ICommonTCFLaunchAttributes;
-
-/**
- * Open channel step implementation.
- */
-public class OpenChannelStep extends AbstractTcfLaunchStep {
-
- /**
- * Constructor.
- */
- public OpenChannelStep() {
- }
-
- /* (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(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- }
-
- /* (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(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
- Tcf.getChannelManager().openChannel(getActivePeerModel(fullQualifiedId, data).getPeer(), null, new IChannelManager.DoneOpenChannel() {
- @Override
- public void doneOpenChannel(final Throwable error, final IChannel channel) {
- StepperAttributeUtil.setProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId.getParentId(), data, channel);
- callback.done(OpenChannelStep.this, StatusHelper.getStatus(error));
- }
- });
- }
-
- @Override
- public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
- IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
- if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
- Tcf.getChannelManager().closeChannel(channel);
- }
- super.rollback(context, data, status, fullQualifiedId, monitor, callback);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java
deleted file mode 100644
index 79567fcfe..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * 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 org.eclipse.core.runtime.Assert;
-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.debug.core.ILaunchConfiguration;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcessesV1;
-import org.eclipse.tcf.services.IRunControl;
-import org.eclipse.tcf.services.IRunControl.RunControlContext;
-import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
-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.runtime.utils.ProgressHelper;
-import org.eclipse.tcf.te.runtime.utils.StatusHelper;
-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.launch.core.interfaces.IRemoteAppLaunchAttributes;
-
-/**
- * Resume context step implementation.
- */
-public class ResumeContextStep extends AbstractTcfLaunchStep {
-
- /**
- * Constructor.
- */
- public ResumeContextStep() {
- }
-
- /* (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(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$
- }
-
- IProcesses.ProcessContext processContext = (IProcesses.ProcessContext)StepperAttributeUtil.getProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId, data);
- if (processContext == null) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing process context")); //$NON-NLS-1$
- }
- }
-
- /* (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) {
- if (Protocol.isDispatchThread()) {
- internalExecute(context, data, fullQualifiedId, monitor, callback);
- }
- else {
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- internalExecute(context, data, fullQualifiedId, monitor, callback);
- }
- });
- }
- }
-
- protected void internalExecute(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
- final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
- final IProcesses.ProcessContext processContext = (IProcesses.ProcessContext)StepperAttributeUtil.getProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId, data);
- final IRunControl runControl = channel.getRemoteService(IRunControl.class);
- final String svcProcessesName = (String)StepperAttributeUtil.getProperty("services.processes.name", fullQualifiedId, data); //$NON-NLS-1$
-
- if (IProcessesV1.NAME.equals(svcProcessesName)) {
- // If the processes service used is IProcessesV1, there is nothing to do here
- callback.done(ResumeContextStep.this, Status.OK_STATUS);
- } else if (runControl != null) {
- // Get the launch configuration object
- final ILaunchConfiguration lc = getLaunchConfiguration(context);
- Assert.isNotNull(lc);
- boolean stopAtEntry = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY, false);
-
- // In case "stop at entry" is not desired, we have to resume the context once to
- // "stop at main".
- if (!stopAtEntry) {
- runControl.getContext(processContext.getID(), new IRunControl.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, RunControlContext context) {
- ProgressHelper.worked(monitor, 5);
- if (!ProgressHelper.isCancelOrError(ResumeContextStep.this, StatusHelper.getStatus(error), monitor, callback)) {
- context.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- @Override
- public void doneCommand(IToken token, Exception error) {
- callback.done(ResumeContextStep.this, StatusHelper.getStatus(error));
- }
- });
- }
- }
- });
- } else {
- callback.done(ResumeContextStep.this, Status.OK_STATUS);
- }
- }
- else {
- callback.done(this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing run control service")); //$NON-NLS-1$
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java
index 0f20eb626..856a33016 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java
@@ -1,37 +1,46 @@
-/*******************************************************************************
- * 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.iterators;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.launch.core.steps.iterators.AbstractLaunchStepGroupIterator;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-
-
-/**
- * AbstractTcfLaunchStepGroupIterator
- */
-public abstract class AbstractTcfLaunchStepGroupIterator extends AbstractLaunchStepGroupIterator {
-
- /**
- * Returns the active peer model that is currently used.
- *
- * @param data The data giving object. Must not be <code>null</code>.
- * @return The active peer model.
- */
- protected IPeerModel getActivePeerModel(IFullQualifiedId fullQualifiedId, IPropertiesContainer data) {
- IModelNode node = getActiveLaunchContext(fullQualifiedId, data);
- Assert.isTrue(node instanceof IPeerModel);
- return (IPeerModel)node;
- }
-}
+/*******************************************************************************
+ * 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.iterators;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.te.launch.core.steps.iterators.AbstractLaunchStepGroupIterator;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Abstract TCF launch step group iterator.
+ */
+public abstract class AbstractTcfLaunchStepGroupIterator extends AbstractLaunchStepGroupIterator {
+
+ /**
+ * Returns the active peer model context that is currently used.
+ *
+ * @param context The step context. Must not be <code>null</code>.
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualfied id for this step. Must not be <code>null</code>.
+ * @return The active peer model context.
+ */
+ protected IPeerModel getActivePeerModelContext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId) {
+ Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ IPeerModel peerModel = null;
+ if (activeContext instanceof IPeerModel)
+ return (IPeerModel)activeContext;
+ if (activeContext instanceof IAdaptable)
+ peerModel = (IPeerModel)((IAdaptable)activeContext).getAdapter(IPeerModel.class);
+ if (peerModel == null)
+ peerModel = (IPeerModel)Platform.getAdapterManager().getAdapter(activeContext, IPeerModel.class);
+
+ return peerModel;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java
index 605423397..6ac3c8275 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java
@@ -14,13 +14,13 @@ 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.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
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.filesystem.core.interfaces.steps.IFileSystemStepAttributes;
import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
/**
@@ -29,7 +29,6 @@ import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
public class FileTransferIterator extends AbstractTcfLaunchStepGroupIterator {
private IFileTransferItem[] items = null;
- private int iteration = -1;
/**
* Constructor.
@@ -43,8 +42,8 @@ public class FileTransferIterator extends AbstractTcfLaunchStepGroupIterator {
*/
@Override
public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
+ super.initialize(context, data, fullQualifiedId, monitor);
items = FileTransfersPersistenceDelegate.getFileTransfers(getLaunchConfiguration(context));
- iteration = 0;
}
/* (non-Javadoc)
@@ -56,24 +55,18 @@ public class FileTransferIterator extends AbstractTcfLaunchStepGroupIterator {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#hasNext(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 boolean hasNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
- return iteration < getNumIterations();
- }
-
- /* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(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 next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- if (iteration < 0) {
+ if (getIteration() < 0) {
throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "iterator not initialized")); //$NON-NLS-1$
}
- if (iteration >= getNumIterations()) {
+ if (getIteration() >= getNumIterations()) {
throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "no more iterations")); //$NON-NLS-1$
}
- StepperAttributeUtil.setProperty(IFileTransferLaunchAttributes.ATTR_ACTIVE_FILE_TRANSFER, fullQualifiedId, data, items[iteration++]);
+ StepperAttributeUtil.setProperty(IFileSystemStepAttributes.ATTR_FILE_TRANSFER_ITEM, fullQualifiedId, data, items[getIteration()]);
+
+ super.next(context, data, fullQualifiedId, monitor);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java
new file mode 100644
index 000000000..af344fa9d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.iterators;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
+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.processes.core.interfaces.steps.IProcessesStepAttributes;
+
+/**
+ * Step group iterator for file transfer.
+ */
+public class LaunchProcessIterator extends AbstractTcfLaunchStepGroupIterator {
+
+ /**
+ * Constructor.
+ */
+ public LaunchProcessIterator() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#getNumIterations()
+ */
+ @Override
+ public int getNumIterations() {
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(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 next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ String processImage = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IProcessesStepAttributes.ATTR_PROCESS_IMAGE, (String)null);
+ String processArguments = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IProcessesStepAttributes.ATTR_PROCESS_ARGUMENTS, (String)null);
+
+ boolean isDebug = ILaunchManager.DEBUG_MODE.equals(getLaunchMode(context));
+ boolean attachProcess = isDebug;
+ boolean stopAtEntry = isDebug && DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IProcessesStepAttributes.ATTR_STOP_AT_ENTRY, false);
+ boolean stopAtMain = isDebug && DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IProcessesStepAttributes.ATTR_STOP_AT_MAIN, false);
+ boolean attachChildren = isDebug && DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IProcessesStepAttributes.ATTR_ATTACH_CHILDREN, false);
+
+ boolean outputConsole = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), "org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", true); //$NON-NLS-1$
+ String outputFile = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), "org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE", (String)null); //$NON-NLS-1$
+
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_PROCESS_IMAGE, fullQualifiedId, data, processImage);
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_PROCESS_ARGUMENTS, fullQualifiedId, data, processArguments);
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_ATTACH, fullQualifiedId, data, attachProcess);
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_ATTACH_CHILDREN, fullQualifiedId, data, attachChildren);
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_STOP_AT_ENTRY, fullQualifiedId, data, stopAtEntry);
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_STOP_AT_MAIN, fullQualifiedId, data, stopAtMain);
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_OUTPUT_CONSOLE, fullQualifiedId, data, outputConsole);
+ StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_OUTPUT_FILE, fullQualifiedId, data, outputFile);
+
+ super.next(context, data, fullQualifiedId, monitor);
+ }
+}

Back to the top