diff options
author | Tobias Schwarz | 2012-06-18 07:32:11 +0000 |
---|---|---|
committer | Uwe Stieber | 2012-06-18 08:07:55 +0000 |
commit | ae60b7594a2b6a69891b4eeef373401657a4e997 (patch) | |
tree | f2280ac831bb4388a3fb5226b1e3cb0e8c3b899d | |
parent | 4bb8e30d69a4451b945a9bd72dec0f52e6006ce0 (diff) | |
download | org.eclipse.tcf-ae60b7594a2b6a69891b4eeef373401657a4e997.tar.gz org.eclipse.tcf-ae60b7594a2b6a69891b4eeef373401657a4e997.tar.xz org.eclipse.tcf-ae60b7594a2b6a69891b4eeef373401657a4e997.zip |
Target Explorer: ADD attach launch
22 files changed, 931 insertions, 546 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/AbstractLaunchConfigurationDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/AbstractLaunchConfigurationDelegate.java deleted file mode 100644 index 3a3fff567..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/AbstractLaunchConfigurationDelegate.java +++ /dev/null @@ -1,56 +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.launch.core.delegates; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.debug.core.model.LaunchConfigurationDelegate; -import org.eclipse.tcf.te.launch.core.nls.Messages; - -/** - * Abstract launch configuration delegate implementation. - */ -public abstract class AbstractLaunchConfigurationDelegate extends LaunchConfigurationDelegate { - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildProjects(org.eclipse.core.resources.IProject[], org.eclipse.core.runtime.IProgressMonitor) - * <p> - * This method is a copy of the super implementation, except it does not lock the workspace to perform the build. - * This is required to support "Edit while build is ongoing". - */ - @Override - protected void buildProjects(final IProject[] projects, IProgressMonitor monitor) throws CoreException { - IWorkspaceRunnable build = new IWorkspaceRunnable(){ - @Override - public void run(IProgressMonitor pm) throws CoreException { - SubMonitor localmonitor = SubMonitor.convert(pm, Messages.AbstractLaunchConfigurationDelegate_scoped_incremental_build, projects.length); - try { - for (int i = 0; i < projects.length; i++ ) { - if (localmonitor.isCanceled()) { - throw new OperationCanceledException(); - } - projects[i].build(IncrementalProjectBuilder.INCREMENTAL_BUILD, localmonitor.newChild(1)); - } - } finally { - localmonitor.done(); - } - } - }; - ResourcesPlugin.getWorkspace().run(build, null, IWorkspace.AVOID_UPDATE, monitor); - } - -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java index a77bb7086..ce100c35c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java @@ -15,14 +15,19 @@ import java.util.List; import java.util.ListIterator;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
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.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -68,7 +73,34 @@ import org.eclipse.tcf.te.runtime.stepper.stepper.Stepper; * <li>The launch configuration delegate creates launches of type {@link Launch}.</li>
* </ul>
*/
-public class LaunchConfigurationDelegate extends AbstractLaunchConfigurationDelegate {
+public class LaunchConfigurationDelegate extends org.eclipse.debug.core.model.LaunchConfigurationDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildProjects(org.eclipse.core.resources.IProject[], org.eclipse.core.runtime.IProgressMonitor)
+ * <p>
+ * This method is a copy of the super implementation, except it does not lock the workspace to perform the build.
+ * This is required to support "Edit while build is ongoing".
+ */
+ @Override
+ protected void buildProjects(final IProject[] projects, IProgressMonitor monitor) throws CoreException {
+ IWorkspaceRunnable build = new IWorkspaceRunnable(){
+ @Override
+ public void run(IProgressMonitor pm) throws CoreException {
+ SubMonitor localmonitor = SubMonitor.convert(pm, Messages.AbstractLaunchConfigurationDelegate_scoped_incremental_build, projects.length);
+ try {
+ for (IProject project : projects) {
+ if (localmonitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, localmonitor.newChild(1));
+ }
+ } finally {
+ localmonitor.done();
+ }
+ }
+ };
+ ResourcesPlugin.getWorkspace().run(build, null, IWorkspace.AVOID_UPDATE, monitor);
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml index 7909e691a..49eef9a69 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml @@ -65,7 +65,7 @@ activeByDefault="true" contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchFavoritesContentProvider" labelProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeLabelProvider" - priority="normal"> + priority="lowest"> <triggerPoints> <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.ICategory"/> </triggerPoints> 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 75712590e..cd8f460fa 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 @@ -30,6 +30,5 @@ Export-Package: org.eclipse.tcf.te.tcf.launch.core.activator;x-internal:=true, org.eclipse.tcf.te.tcf.launch.core.internal.adapters;x-internal:=true, 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.services, 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 fb594a3e2..b5f43b7d3 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 @@ -14,10 +14,12 @@ providerName = Eclipse.org - TCF # ***** Launch Configuration Types *****
LaunchType.Remote.App.name=Remote Application
+LaunchType.Attach.name=Attach
# ***** Launch Step Groups *****
LaunchStepGroup.Remote.App.name=Remote Application
+LaunchStepGroup.Attach.name=Attach
LaunchStepGroup.FileTransfer.name=File Transfer
# ***** Launch Steps *****
@@ -25,5 +27,6 @@ LaunchStepGroup.FileTransfer.name=File Transfer LaunchStep.OpenChannel.name=Open TCF Channel
LaunchStep.FileTransfer.name=Transfer File
LaunchStep.LaunchProcess.name=Launch Process
+LaunchStep.ResumeContext.name=Resume Context
LaunchStep.AttachDebugger.name=Attach Debugger
LaunchStep.CloseChannel.name=Close TCF Channel
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 45870b1df..04053e75a 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,135 +1,203 @@ -<?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>
- </extension>
-
-<!-- Service contributions -->
- <extension point="org.eclipse.tcf.te.runtime.services.services">
- <service
- class="org.eclipse.tcf.te.tcf.launch.core.services.DebugService"
- id="org.eclipse.tcf.te.tcf.launch.core.services.debug">
- <serviceType
- bundleId="org.eclipse.tcf.te.runtime.services"
- class="org.eclipse.tcf.te.runtime.services.interfaces.IDebugService"/>
- <enablement>
- <or>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <instanceof value="org.eclipse.tcf.protocol.IPeer"/>
- </or>
- </enablement>
- </service>
- </extension>
-
-<!-- Launch Configuration Type contributions -->
- <extension point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- delegate="org.eclipse.tcf.te.launch.core.delegates.LaunchConfigurationDelegate"
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app"
- modes="run,debug"
- name="%LaunchType.Remote.App.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,debug"/>
- <stepGroup
- id="org.eclipse.tcf.te.tcf.launch.type.remote.app.stepGroup"
- modes="run,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"/>
- <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
- </and>
- </or>
- </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"/>
- </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"
- locked="false">
- <references>
- <reference id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
- <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.closeChannelStep"/>
- <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.launch.core.removeLaunchStep"/>
- </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"
- locked="false">
- <references>
- <reference id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStep"/>
- </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.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>
- <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>
- <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> + </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" + 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"/> + <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/> + </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"/> + <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/> + <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/> + </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"> + <and> + <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/> + <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/> + </and> + </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" + locked="false"> + <references> + <reference id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/> + <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.steps.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" + locked="false"> + <references> + <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" + locked="false"> + <references> + <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> + </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.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> + <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> + <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> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java new file mode 100644 index 000000000..d0e8a70ec --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * 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.delegates; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.tcf.internal.debug.model.TCFLaunch; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; + +/** + * Default tcf launch implementation. + * <p> + * The launch can be adapted to {@link IPropertiesContainer} to exchange user defined data + * between the launch steps. + */ +@SuppressWarnings("restriction") +public final class Launch extends TCFLaunch { + + /** + * Non-notifying properties container used for data exchange between the steps. + */ + private final IPropertiesContainer properties = new PropertiesContainer() { + @Override + public Object getAdapter(Class adapter) { + if (ILaunch.class.equals(adapter)) { + return Launch.this; + } + return super.getAdapter(adapter); + } + }; + + /** + * Constructor. + * + * @param configuration The launch configuration that was launched. + * @param mode The launch mode. + */ + public Launch(ILaunchConfiguration configuration, String mode) { + super(configuration, mode); + } + + /** + * Attach the tcf debugger to the given peer id. + * @param peerId The peer id. + */ + public void attachDebugger(String peerId) { + launchTCF(getLaunchMode(), peerId); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.Launch#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IPropertiesContainer.class.equals(adapter)) { + return properties; + } + + // Must force adapters to be loaded: (Defect WIND00243348, and Eclipse bug 197664). + Platform.getAdapterManager().loadAdapter(this, adapter.getName()); + + 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/delegates/LaunchConfigurationDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/LaunchConfigurationDelegate.java new file mode 100644 index 000000000..082872250 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/LaunchConfigurationDelegate.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * 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.delegates; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes; +import org.eclipse.tcf.util.TCFTask; + +/** + * Default tcf launch configuration delegate implementation. + * <p> + * The launch configuration delegate implements the bridge between the native Eclipse launch + * configuration framework and the stepper engine. The delegate is standard for all + * launch configurations which supports extensible and modularized launching. + * <p> + * <b>Implementation Details</b>:<br> + * <ul> + * <li>The launch configuration delegate signals the completion of the launch sequence via + * the custom {@link ILaunch} attribute {@link ICommonLaunchAttributes#ILAUNCH_ATTRIBUTE_LAUNCH_SEQUENCE_COMPLETED}.</li> + * <li>The launch configuration delegates enforces the removal of the launch from the Eclipse + * debug platforms launch manager if the progress monitor is set to canceled or an status with + * severity {@link IStatus#CANCEL} had been thrown by the stepper implementation.</li> + * <li>The launch configuration delegate creates launches of type {@link Launch}.</li> + * </ul> + */ +public class LaunchConfigurationDelegate extends org.eclipse.tcf.te.launch.core.delegates.LaunchConfigurationDelegate { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.launch.core.delegates.LaunchConfigurationDelegate#getLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) + */ + @Override + public ILaunch getLaunch(final ILaunchConfiguration configuration, final String mode) throws CoreException { + return new TCFTask<ILaunch>() { + int cnt; + @Override + public void run() { + // Need to delay at least one dispatch cycle to work around + // a possible racing between thread that calls getLaunch() and + // the process of activation of other TCF plug-ins. + if (cnt++ < 2) { + Protocol.invokeLater(this); + } + else { + done(new Launch(configuration, mode)); + } + } + }.getE(); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ILaunchTypes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ILaunchTypes.java index 4fb2dca43..556dd53ef 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ILaunchTypes.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/ILaunchTypes.java @@ -20,4 +20,9 @@ public interface ILaunchTypes { * Launch configuration type id: Remote Application
*/
public final String REMOTE_APPLICATION = "org.eclipse.tcf.te.tcf.launch.type.remote.app"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration type id: Attach
+ */
+ public final String ATTACH = "org.eclipse.tcf.te.tcf.launch.type.attach"; //$NON-NLS-1$
}
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 new file mode 100644 index 000000000..23e9a4c03 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * 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.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.IPropertiesAccessService; +import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants; + +/** + * RemoteAppLaunchManagerDelegate + */ +public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate { + + private static final String[] MANDATORY_CONFIG_ATTRIBUTES = new String[] { + ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS + }; + + /** + * Constructor. + */ + public AttachLaunchManagerDelegate() { + super(); + } + + @Override + public void updateLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) { + super.updateLaunchConfigAttributes(wc, launchSpec); + + if (launchSpec.hasAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS)) { + wc.setAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)launchSpec.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS).getValue()); + } + + 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); + + if (launchSpec.hasAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS)) { + wc.setAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)launchSpec.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS).getValue()); + } + + 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 != null && 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 != null && name.trim().length() > 0 ? name.trim() : super.getDefaultLaunchName(launchConfig); + } + + private String getDefaultLaunchName(IModelNode context) { + String name = ""; //$NON-NLS-1$ + 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; + } + return name.trim(); + } + + /* (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/services/DebugService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/services/DebugService.java deleted file mode 100644 index 5f0377e93..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/services/DebugService.java +++ /dev/null @@ -1,283 +0,0 @@ -/*******************************************************************************
- * 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
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.launch.core.services;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate;
-import org.eclipse.tcf.internal.debug.model.TCFLaunch;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
-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.AbstractService;
-import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-
-/**
- * Debug service implementations for TCF contexts.
- */
-@SuppressWarnings("restriction")
-public class DebugService extends AbstractService implements IDebugService {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IDebugService#attach(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
- */
- @Override
- public void attach(final Object context, final IPropertiesContainer data, final ICallback callback) {
- Assert.isNotNull(context);
- Assert.isNotNull(data);
- Assert.isNotNull(callback);
-
- // Get the peer to attach
- IPeer peer = null;
- if (context instanceof IPeerModel) {
- peer = ((IPeerModel)context).getPeer();
- }
- else if (context instanceof IPeer) {
- peer = (IPeer)context;
- }
-
- if (peer != null) {
- // Make sure that the attach is executed in a non TCF dispatch thread
- if (!Protocol.isDispatchThread()) {
- attachPeer(peer, data, callback);
- } else {
- final IPeer finPeer = peer;
- ExecutorsUtil.execute(new Runnable() {
- @Override
- public void run() {
- attachPeer(finPeer, data, callback);
- }
- });
- }
- }
- else {
- callback.done(this, Status.OK_STATUS);
- }
- }
-
- /**
- * Attach to the given peer.
- *
- * @param peer The peer. Must not be <code>null</code>.
- * @param data The data properties to parameterize the attach. Must not be <code>null</code>.
- * @param callback The callback to invoke once the operation completed. Must not be <code>null</code>.
- */
- protected void attachPeer(final IPeer peer, final IPropertiesContainer data, final ICallback callback) {
- Assert.isNotNull(peer);
- Assert.isNotNull(data);
- Assert.isNotNull(callback);
-
- // The launch configuration to execute
- ILaunchConfiguration lc = null;
- ILaunch l = null;
-
- // Look for existing launch configurations
- ILaunchConfiguration[] configs = findExistingConfigs(peer);
- if (configs.length > 0) {
- // Check if any of the matching launches has an active launch
- ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- for (ILaunchConfiguration config : configs) {
- for (ILaunch launch : launches) {
- if (config.equals(launch.getLaunchConfiguration())) {
- lc = config;
- l = launch;
- break;
- }
- }
- if (lc != null) {
- break;
- }
- }
- // If there is none with an active launch, take the first one
- if (lc == null) {
- lc = configs[0];
- }
- } else {
- // No existing launch configuration -> create a new one
- lc = createNewConfig(peer);
- }
-
- if (lc != null && l == null) {
- try {
- // Attach the launch listener to wait firing the callback until
- // the TCFLaunch got connect
- final TCFLaunch.LaunchListener listener = new TCFLaunch.LaunchListener() {
- @Override
- public void onProcessStreamError(TCFLaunch launch, String process_id, int stream_id, Exception error, int lost_size) {}
- @Override
- public void onProcessOutput(TCFLaunch launch, String process_id, int stream_id, byte[] data) {}
- @Override
- public void onDisconnected(TCFLaunch launch) {}
- @Override
- public void onCreated(TCFLaunch launch) {}
-
- @Override
- public void onConnected(TCFLaunch launch) {
- // If "our" launch got connected, fire the callback
- ILaunch l = (ILaunch)callback.getProperty("launch"); //$NON-NLS-1$
- if (launch == l) {
- TCFLaunch.removeListener(this);
- callback.done(DebugService.this, Status.OK_STATUS);
- }
- }
- };
- if (Protocol.isDispatchThread()) {
- TCFLaunch.addListener(listener);
- }
- else {
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- TCFLaunch.addListener(listener);
- }
- });
- }
-
- // Execute the launch configuration
- l = lc.launch(ILaunchManager.DEBUG_MODE, new NullProgressMonitor(), false, true);
- // And remember the launch returned. Will be needed outside
- // to set the selection to the debug view correctly
- callback.setProperty("launch", l); //$NON-NLS-1$
-
- } catch (CoreException e) {
- callback.done(this, e.getStatus());
- }
- } else {
- // Remember the launch found. Will be needed outside
- // to set the selection to the debug view correctly
- callback.setProperty("launch", l); //$NON-NLS-1$
- callback.done(this, Status.OK_STATUS);
- }
- }
-
- /**
- * Creates a new launch configuration for the given peer.
- *
- * @param peer The peer. Must not be <code>null</code>.
- * @return The new launch configuration instance.
- */
- protected ILaunchConfiguration createNewConfig(final IPeer peer) {
- Assert.isNotNull(peer);
-
- // The result
- ILaunchConfiguration lc = null;
-
- // Determine the ID of the given peer
- final AtomicReference<String> peerId = new AtomicReference<String>();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- peerId.set(peer.getID());
- }
- };
- if (Protocol.isDispatchThread()) {
- runnable.run();
- }
- else {
- Protocol.invokeAndWait(runnable);
- }
-
- // Get the launch manager
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- // Get the "Target Communication Framework" launch configuration type
- ILaunchConfigurationType lct = lm.getLaunchConfigurationType("org.eclipse.tcf.debug.LaunchConfigurationType"); //$NON-NLS-1$
- if (lct != null) {
- try {
- // Calculate the launch configuration name based on the peer id
- String name = lm.generateLaunchConfigurationName(peerId.get());
- // Create a new launch configuration working copy
- ILaunchConfigurationWorkingCopy wc = lct.newInstance(null, name);
- // And fill in the launch configuration attributes
- wc.setAttribute(TCFLaunchDelegate.ATTR_PEER_ID, peerId.get());
- wc.setAttribute(TCFLaunchDelegate.ATTR_STOP_AT_MAIN, true);
- wc.setAttribute(TCFLaunchDelegate.ATTR_DISCONNECT_ON_CTX_EXIT, true);
- wc.setAttribute(TCFLaunchDelegate.ATTR_RUN_LOCAL_AGENT, false);
- wc.setAttribute(TCFLaunchDelegate.ATTR_USE_LOCAL_AGENT, false);
- // Save the working copy
- lc = wc.doSave();
- } catch (CoreException e) {
- if (Platform.inDebugMode()) {
- e.printStackTrace();
- }
- }
- }
-
-
- return lc;
- }
-
- /**
- * Find existing launch configurations created for the given peer.
- *
- * @param peer The peer. Must not be <code>null</code>.
- * @return The list of existing launch configurations or an empty list.
- */
- protected ILaunchConfiguration[] findExistingConfigs(final IPeer peer) {
- Assert.isNotNull(peer);
-
- // The result list
- List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>();
-
- // Determine the ID of the given peer
- final AtomicReference<String> peerId = new AtomicReference<String>();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- peerId.set(peer.getID());
- }
- };
- if (Protocol.isDispatchThread()) {
- runnable.run();
- }
- else {
- Protocol.invokeAndWait(runnable);
- }
-
- // Get the launch manager
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- // Get the "Target Communication Framework" launch configuration type
- ILaunchConfigurationType lct = lm.getLaunchConfigurationType("org.eclipse.tcf.debug.LaunchConfigurationType"); //$NON-NLS-1$
- if (lct != null) {
- try {
- // Get all launch configurations of our type
- ILaunchConfiguration[] candidates = lm.getLaunchConfigurations(lct);
- for (ILaunchConfiguration candidate : candidates) {
- // If the peer id is matching, it is a valid candidate
- String lcPeerId = candidate.getAttribute(TCFLaunchDelegate.ATTR_PEER_ID, (String)null);
- if (lcPeerId != null && lcPeerId.equals(peerId.get())) {
- configs.add(candidate);
- }
- }
- } catch (CoreException e) {
- if (Platform.inDebugMode()) {
- e.printStackTrace();
- }
- }
- }
-
- return configs.toArray(new ILaunchConfiguration[configs.size()]);
- }
-}
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 d3b47fef5..b5eae0bb1 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 @@ -11,32 +11,18 @@ 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.protocol.IToken;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IRunControl;
-import org.eclipse.tcf.services.IRunControl.RunControlContext;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
+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.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
-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.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.IRemoteAppLaunchAttributes;
+import org.eclipse.tcf.te.tcf.launch.core.delegates.Launch;
/**
- * Launch process step implementation.
+ * Attach debugger step implementation.
*/
public class AttachDebuggerStep extends AbstractTcfLaunchStep {
@@ -51,61 +37,37 @@ public class AttachDebuggerStep extends AbstractTcfLaunchStep { */
@Override
public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- if (StepperAttributeUtil.getProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId, data) == 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(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
- IDebugService dbgService = ServiceManager.getInstance().getService(getActivePeerModel(data), IDebugService.class, false);
- if (dbgService != null) {
- Callback cb = new Callback();
- dbgService.attach(getActivePeerModel(data), new PropertiesContainer(), cb);
- ExecutorsUtil.waitAndExecute(0, cb.getDoneConditionTester(monitor));
-
- Tcf.getChannelManager().openChannel(getActivePeerModel(data).getPeer(), null, new IChannelManager.DoneOpenChannel() {
+ 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 doneOpenChannel(final Throwable error, final IChannel channel) {
- if (!ProgressHelper.isCancelOrError(AttachDebuggerStep.this, StatusHelper.getStatus(error), monitor, callback)) {
- IProcesses.ProcessContext processContext = (IProcesses.ProcessContext)StepperAttributeUtil.getProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId, data);
- IRunControl runControl = channel.getRemoteService(IRunControl.class);
- if (runControl != null) {
- runControl.getContext(processContext.getID(), new IRunControl.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, RunControlContext context) {
- if (error == null) {
- context.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- @Override
- public void doneCommand(IToken token, Exception error) {
- Tcf.getChannelManager().closeChannel(channel);
- callback.done(AttachDebuggerStep.this, StatusHelper.getStatus(error));
- }
- });
- }
- else {
- Tcf.getChannelManager().closeChannel(channel);
- callback.done(AttachDebuggerStep.this, StatusHelper.getStatus(error));
- }
- }
- });
- }
- else {
- Tcf.getChannelManager().closeChannel(channel);
- callback.done(this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing run control service")); //$NON-NLS-1$
- }
- }
- else if (channel != null) {
- Tcf.getChannelManager().closeChannel(channel);
- }
+ public void run() {
+ internalExecute(context, data, fullQualifiedId, monitor, callback);
}
});
}
- else {
- callback.done(this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing debugger service")); //$NON-NLS-1$
+ }
+
+ 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(data).getPeerId());
+ 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/FileTransferStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java index 7fd9ae24f..44c77e502 100644 --- 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 @@ -41,6 +41,11 @@ public class FileTransferStep extends AbstractTcfLaunchStep { */
@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$
@@ -52,13 +57,13 @@ public class FileTransferStep extends AbstractTcfLaunchStep { */
@Override
public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
- IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
- IFileTransferItem item = (IFileTransferItem)StepperAttributeUtil.getProperty(IFileTransferLaunchAttributes.ATTR_ACTIVE_FILE_TRANSFER, fullQualifiedId, data);
+ 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(data).getPeer(), channel, item, monitor, callback);
}
- else if (callback != null) {
+ else {
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/ResumeContextStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java new file mode 100644 index 000000000..b12ffcd71 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * 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.protocol.IToken; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.services.IProcesses; +import org.eclipse.tcf.services.IRunControl; +import org.eclipse.tcf.services.IRunControl.RunControlContext; +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); + + if (runControl != null) { + 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(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.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF index 59bf042e2..53eafd74c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF @@ -27,7 +27,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", org.eclipse.tcf.te.ui.controls;bundle-version="1.1.0", org.eclipse.tcf.te.ui.forms;bundle-version="1.1.0", org.eclipse.tcf.te.ui.swt;bundle-version="1.1.0", - org.eclipse.tcf.te.ui.views;bundle-version="1.1.0" + org.eclipse.tcf.te.ui.views;bundle-version="1.1.0", + org.eclipse.tcf.debug.ui;bundle-version="1.1.0", + org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/icons/obj16/attach.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/icons/obj16/attach.gif Binary files differnew file mode 100644 index 000000000..59c0c793d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/icons/obj16/attach.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.properties index 6075e73b1..507c01d04 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.properties @@ -21,3 +21,5 @@ LauchTree.name=Launches LaunchShortcutHandler.Remote.App.run.name=Run Remote Application
LaunchShortcutHandler.Remote.App.debug.name=Debug Remote Application
LaunchShortcut.Remote.App.name=Remote Application
+
+LaunchShortcut.Attach.name=Attach
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml index eac29aadb..76060d1dc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml @@ -2,12 +2,30 @@ <?eclipse version="3.4"?> <plugin> +<!-- Service contributions --> + <extension point="org.eclipse.tcf.te.runtime.services.services"> + <service + class="org.eclipse.tcf.te.tcf.launch.ui.internal.services.DebugService" + id="org.eclipse.tcf.te.tcf.launch.core.services.debug"> + <serviceType + bundleId="org.eclipse.tcf.te.runtime.services" + class="org.eclipse.tcf.te.runtime.services.interfaces.IDebugService"/> + <enablement> + <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/> + </enablement> + </service> + </extension> + <!-- Launch configuration type contributions --> <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> <launchConfigurationTypeImage configTypeID="org.eclipse.tcf.te.tcf.launch.type.remote.app" icon="icons/obj16/remote_app.gif" id="org.eclipse.tcf.te.tcf.launch.type.remote.app.image"/> + <launchConfigurationTypeImage + configTypeID="org.eclipse.tcf.te.tcf.launch.type.attach" + icon="icons/obj16/attach.gif" + id="org.eclipse.tcf.te.tcf.launch.type.attach.image"/> </extension> <!-- Launch configuration tab group contributions --> @@ -16,6 +34,10 @@ class="org.eclipse.tcf.te.tcf.launch.ui.remote.app.LaunchConfigurationTabGroup" id="org.eclipse.tcf.te.tcf.launch.type.remote.app.tabgroup" type="org.eclipse.tcf.te.tcf.launch.type.remote.app"/> + <launchConfigurationTabGroup + class="org.eclipse.tcf.te.tcf.launch.ui.attach.LaunchConfigurationTabGroup" + id="org.eclipse.tcf.te.tcf.launch.type.attach.tabgroup" + type="org.eclipse.tcf.te.tcf.launch.type.attach"/> </extension> <!-- Launch shortcut contributions --> @@ -58,7 +80,29 @@ forcePluginActivation="true" property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType" value="org.eclipse.tcf.te.tcf.launch.type.remote.app" - args="run"/> + args="debug"/> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + <shortcut + id="org.eclipse.tcf.te.tcf.launch.ui.launchshortcut.attach.debug" + label="%LaunchShortcut.Attach.name" + icon="icons/obj16/attach.gif" + modes="debug"> + <class class="org.eclipse.tcf.te.launch.ui.internal.handler.LaunchShortcutHandler"> + <parameter name="typeId" value="org.eclipse.tcf.te.tcf.launch.type.attach"/> + </class> + <contextualLaunch> + <enablement> + <with variable="selection"> + <iterate ifEmpty="false"> + <test + forcePluginActivation="true" + property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType" + value="org.eclipse.tcf.te.tcf.launch.type.attach" + args="debug"/> </iterate> </with> </enablement> @@ -100,7 +144,7 @@ activeByDefault="false" contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchNavigatorContentProvider" labelProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeLabelProvider" - priority="normal"> + priority="lowest"> <triggerPoints> <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/> </triggerPoints> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/attach/LaunchConfigurationMainTab.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/attach/LaunchConfigurationMainTab.java new file mode 100644 index 000000000..79cee5f49 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/attach/LaunchConfigurationMainTab.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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.ui.attach; + +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorTab; +import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes; +import org.eclipse.tcf.te.tcf.launch.ui.remote.app.launchcontext.ContextSelectorSection; +import org.eclipse.tcf.te.ui.forms.CustomFormToolkit; +import org.eclipse.ui.forms.IManagedForm; + +/** + * Remote application main launch tab implementation. + */ +public class LaunchConfigurationMainTab extends AbstractContextSelectorTab { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorTab#doCreateContextSelectorSection(org.eclipse.ui.forms.IManagedForm, org.eclipse.swt.widgets.Composite) + */ + @Override + protected ContextSelectorSection doCreateContextSelectorSection(IManagedForm form, Composite panel) { + return new ContextSelectorSection(form, panel); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.launch.ui.tabs.launchcontext.AbstractContextSelectorTab#doCreateAdditionalFormContent(org.eclipse.ui.forms.IManagedForm, org.eclipse.swt.widgets.Composite, org.eclipse.tcf.te.ui.forms.CustomFormToolkit) + */ + @Override + protected void doCreateAdditionalFormContent(IManagedForm form, Composite parent, CustomFormToolkit toolkit) { + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getImage() + */ + @Override + public Image getImage() { + return DebugUITools.getImage(ILaunchTypes.ATTACH); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/attach/LaunchConfigurationTabGroup.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/attach/LaunchConfigurationTabGroup.java new file mode 100644 index 000000000..dac5037aa --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/attach/LaunchConfigurationTabGroup.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * 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.ui.attach; + +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.debug.ui.CommonTab; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.sourcelookup.SourceLookupTab; +import org.eclipse.tcf.internal.debug.ui.launch.TCFMemoryMapTab; +import org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab; +import org.eclipse.tcf.te.launch.ui.tabs.AbstractLaunchConfigurationTabGroup; + +/** + * Remote application launch configuration tab group implementation. + */ +@SuppressWarnings("restriction") +public class LaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.launch.ui.tabs.AbstractLaunchContextConfigurationTabGroup#createContextSelectorTab(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.util.List, java.lang.String) + */ + @Override + public void createContextSelectorTab(ILaunchConfigurationDialog dialog, List<ILaunchConfigurationTab> tabs, String mode) { + Assert.isNotNull(tabs); + + ILaunchConfigurationTab tab = new LaunchConfigurationMainTab(); + tabs.add(tab); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.launch.ui.tabs.AbstractLaunchContextConfigurationTabGroup#createAdditionalTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.util.List, java.lang.String) + */ + @Override + public void createAdditionalTabs(ILaunchConfigurationDialog dialog, List<ILaunchConfigurationTab> tabs, String mode) { + + tabs.add(new TCFMemoryMapTab()); + tabs.add(new TCFPathMapTab()); + tabs.add(new SourceLookupTab()); + tabs.add(new CommonTab()); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java new file mode 100644 index 000000000..1541960d8 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.launch.ui.internal.services; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.launch.core.lm.LaunchManager; +import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate; +import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification; +import org.eclipse.tcf.te.launch.core.selection.LaunchSelection; +import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext; +import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection; +import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; +import org.eclipse.tcf.te.runtime.services.AbstractService; +import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService; +import org.eclipse.tcf.te.runtime.utils.StatusHelper; +import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes; + +/** + * Debug service implementations for TCF contexts. + */ +public class DebugService extends AbstractService implements IDebugService { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.services.interfaces.IDebugService#attach(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public void attach(final Object context, final IPropertiesContainer data, final ICallback callback) { + if (!Protocol.isDispatchThread()) { + internalAttach(context, data, callback); + } + else { + ExecutorsUtil.execute(new Runnable() { + @Override + public void run() { + internalAttach(context, data, callback); + } + }); + } + } + + protected void internalAttach(final Object context, final IPropertiesContainer data, final ICallback callback) { + Assert.isNotNull(context); + Assert.isNotNull(data); + Assert.isNotNull(callback); + + if (context instanceof IModelNode) { + ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ILaunchTypes.ATTACH); + try { + ILaunchSelection launchSelection = new LaunchSelection(ILaunchManager.DEBUG_MODE, new RemoteSelectionContext((IModelNode)context, true)); + ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(launchConfigType, ILaunchManager.DEBUG_MODE); + if (delegate != null) { + // create an empty launch configuration specification to initialize all attributes with their default defaults. + ILaunchSpecification launchSpec = delegate.getLaunchSpecification(launchConfigType.getIdentifier(), launchSelection); + delegate.validate(launchSpec); + if (launchSpec != null && launchSpec.isValid()) { + ILaunchConfiguration[] launchConfigs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(launchConfigType); + launchConfigs = delegate.getMatchingLaunchConfigurations(launchSpec, launchConfigs); + + ILaunchConfiguration config = launchConfigs != null && launchConfigs.length > 0 ? launchConfigs[0] : null; + config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec); + + delegate.validate(ILaunchManager.DEBUG_MODE, config); + DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); + } + } + callback.done(this, Status.OK_STATUS); + } + catch (Exception e) { + callback.done(this, StatusHelper.getStatus(e)); + } + } + else { + callback.done(this, Status.OK_STATUS); + } + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationTabGroup.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationTabGroup.java index 5becd2d66..7aefb11ae 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationTabGroup.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationTabGroup.java @@ -12,9 +12,13 @@ package org.eclipse.tcf.te.tcf.launch.ui.remote.app; import java.util.List;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.eclipse.tcf.internal.debug.ui.launch.TCFMemoryMapTab;
+import org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab;
import org.eclipse.tcf.te.launch.ui.tabs.AbstractLaunchConfigurationTabGroup;
import org.eclipse.tcf.te.launch.ui.tabs.refprojects.RefProjetcsTab;
import org.eclipse.tcf.te.tcf.launch.ui.remote.app.filetransfer.FileTransferTab;
@@ -22,6 +26,7 @@ import org.eclipse.tcf.te.tcf.launch.ui.remote.app.filetransfer.FileTransferTab; /**
* Remote application launch configuration tab group implementation.
*/
+@SuppressWarnings("restriction")
public class LaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
/* (non-Javadoc)
@@ -43,6 +48,11 @@ public class LaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabG tabs.add(new FileTransferTab());
tabs.add(new RefProjetcsTab());
+ if (ILaunchManager.DEBUG_MODE.equalsIgnoreCase(mode)) {
+ tabs.add(new TCFMemoryMapTab());
+ tabs.add(new TCFPathMapTab());
+ tabs.add(new SourceLookupTab());
+ }
tabs.add(new CommonTab());
}
}
|