diff options
author | Uwe Stieber | 2013-04-12 10:16:49 +0000 |
---|---|---|
committer | Uwe Stieber | 2013-04-12 10:16:49 +0000 |
commit | ccf1b162686a47401aee384afb648b699c030cc3 (patch) | |
tree | deebbc1a34d6c67f01bb4ff3af4ef396fe07b0ad /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core | |
parent | 902ec1e3a213082f30ce5c70157e1dc6c195c4c0 (diff) | |
download | org.eclipse.tcf-ccf1b162686a47401aee384afb648b699c030cc3.tar.gz org.eclipse.tcf-ccf1b162686a47401aee384afb648b699c030cc3.tar.xz org.eclipse.tcf-ccf1b162686a47401aee384afb648b699c030cc3.zip |
Target Explorer: Fix bugzilla 405548 and rework default source lookup handling
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core')
2 files changed, 400 insertions, 406 deletions
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 dfbf2d8d8..c9e5f52bf 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,228 +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.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>
+<?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.te.launch.core.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.te.launch.core.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/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 e42042a10..577ec6cdf 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,172 @@ -/*******************************************************************************
- * 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;
- }
-}
+/******************************************************************************* + * 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.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); + + 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; + } +} |