Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java91
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java222
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AttachLaunchConfigAdapter.java56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java90
7 files changed, 185 insertions, 287 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF
index 798735909..273a48cc5 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
@@ -28,7 +28,6 @@ Export-Package: org.eclipse.tcf.te.tcf.launch.core.activator;x-internal:=true,
org.eclipse.tcf.te.tcf.launch.core.delegates,
org.eclipse.tcf.te.tcf.launch.core.filetransfer,
org.eclipse.tcf.te.tcf.launch.core.interfaces,
- org.eclipse.tcf.te.tcf.launch.core.internal;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,
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 aef456722..4fda2ac58 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
@@ -9,6 +9,12 @@
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>
<!-- Launch Configuration Type contributions -->
@@ -22,6 +28,7 @@
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"
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java
index 6cb026788..93f9e0190 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java
@@ -9,11 +9,9 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.core.activator;
-import org.eclipse.tcf.te.runtime.events.ChangeEvent;
import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
-import org.eclipse.tcf.te.tcf.launch.core.internal.EventListenerDelegate;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -65,9 +63,6 @@ public class CoreBundleActivator implements BundleActivator {
@Override
public void start(BundleContext bundleContext) throws Exception {
CoreBundleActivator.context = bundleContext;
-
- eventListener = new EventListenerDelegate();
- EventManager.getInstance().addEventListener(eventListener, ChangeEvent.class);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java
deleted file mode 100644
index afaf287d5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tcf.te.tcf.launch.core.internal;
-
-import java.util.EventObject;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.te.launch.core.lm.LaunchConfigHelper;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
-import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
-import org.eclipse.tcf.te.runtime.events.ChangeEvent;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
-import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.IPeerModelProperties;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-
-/**
- * EventListenerDelegate
- */
-public class EventListenerDelegate implements IEventListener {
-
- /**
- * Constructor.
- */
- public EventListenerDelegate() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
- */
- @Override
- public void eventFired(EventObject event) {
- if (event instanceof ChangeEvent && event.getSource() instanceof IPeer) {
- IPeer peer = (IPeer)event.getSource();
- String launchConfigAttributes = peer.getAttributes().get(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES);
- try {
- for (ILaunchConfiguration config : DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ILaunchTypes.ATTACH))) {
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(config);
- if (contexts != null && contexts.length == 1 && contexts[0] instanceof IPeerModel && ((IPeerModel)contexts[0]).getPeerId().equalsIgnoreCase(peer.getID())) {
- IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(Map.class, launchConfigAttributes, false);
- try {
- Map<String, String> attributes = delegate != null ? (Map<String,String>)delegate.read(Map.class, launchConfigAttributes, null) : null;
- if (attributes != null) {
- attributes.remove(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS);
- attributes.remove(ICommonLaunchAttributes.ATTR_UUID);
- attributes.remove(ICommonLaunchAttributes.ATTR_LAST_LAUNCHED);
- final ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
- for (Entry<String, String> entry : attributes.entrySet()) {
- LaunchConfigHelper.addLaunchConfigAttribute(wc, entry.getKey(), entry.getValue());
- }
- ExecutorsUtil.executeInUI(new Runnable() {
- @Override
- public void run() {
- try {
- wc.doSave();
- }
- catch (Exception e) {
- }
- }
- });
- }
- }
- catch (Exception e) {
- }
-
- }
- }
- }
- catch (Exception e) {
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
index a822059ba..d2b3f87b6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
@@ -1,101 +1,121 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.launch.core.internal.adapters;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchListener;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-
-/**
- * Adapter factory implementation.
- */
-public class AdapterFactory implements IAdapterFactory {
- // Maintain a map of step context adapters per peer model
- /* default */ Map<ILaunch, IStepContext> adapters = new HashMap<ILaunch, IStepContext>();
-
- private static final Class<?>[] CLASSES = new Class[] {
- IStepContext.class
- };
-
- /**
- * Constructor.
- */
- public AdapterFactory() {
- final ILaunchListener listener = new ILaunchListener() {
- @Override
- public void launchRemoved(ILaunch launch) {
- IStepContext adapter = adapters.remove(launch);
- if (adapter instanceof IDisposable) {
- ((IDisposable)adapter).dispose();
- }
- }
- @Override
- public void launchChanged(ILaunch launch) {
- IStepContext adapter = adapters.remove(launch);
- if (adapter instanceof IDisposable) {
- ((IDisposable)adapter).dispose();
- }
- }
- @Override
- public void launchAdded(ILaunch launch) {
- }
- };
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener);
- }
- };
-
- if (Protocol.isDispatchThread()) {
- runnable.run();
- }
- else {
- Protocol.invokeAndWait(runnable);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof ILaunch) {
- if (IStepContext.class.equals(adapterType)) {
- // Lookup the adapter
- IStepContext adapter = adapters.get(adaptableObject);
- // No adapter yet -> create a new one for this peer
- if (adapter == null) {
- adapter = new StepContextAdapter((ILaunch)adaptableObject);
- adapters.put((ILaunch)adaptableObject, adapter);
- }
- return adapter;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @Override
- public Class[] getAdapterList() {
- return CLASSES;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.core.internal.adapters;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Adapter factory implementation.
+ */
+public class AdapterFactory implements IAdapterFactory {
+ // Maintain a map of step context adapters per peer model
+ /* default */ Map<ILaunch, IStepContext> adapters = new HashMap<ILaunch, IStepContext>();
+ AttachLaunchConfigAdapter attachLaunchConfigAdapter = new AttachLaunchConfigAdapter();
+
+ private static final Class<?>[] CLASSES = new Class[] {
+ IStepContext.class,
+ ILaunchConfiguration.class,
+ ILaunchConfigurationWorkingCopy.class,
+ };
+
+ /**
+ * Constructor.
+ */
+ public AdapterFactory() {
+ final ILaunchListener listener = new ILaunchListener() {
+ @Override
+ public void launchRemoved(ILaunch launch) {
+ IStepContext adapter = adapters.remove(launch);
+ if (adapter instanceof IDisposable) {
+ ((IDisposable)adapter).dispose();
+ }
+ }
+ @Override
+ public void launchChanged(ILaunch launch) {
+ IStepContext adapter = adapters.remove(launch);
+ if (adapter instanceof IDisposable) {
+ ((IDisposable)adapter).dispose();
+ }
+ }
+ @Override
+ public void launchAdded(ILaunch launch) {
+ }
+ };
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener);
+ }
+ };
+
+ if (Protocol.isDispatchThread()) {
+ runnable.run();
+ }
+ else {
+ Protocol.invokeAndWait(runnable);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ILaunch) {
+ if (IStepContext.class.equals(adapterType)) {
+ // Lookup the adapter
+ IStepContext adapter = adapters.get(adaptableObject);
+ // No adapter yet -> create a new one for this peer
+ if (adapter == null) {
+ adapter = new StepContextAdapter((ILaunch)adaptableObject);
+ adapters.put((ILaunch)adaptableObject, adapter);
+ }
+ return adapter;
+ }
+ }
+ else if (adaptableObject instanceof IPeerModel) {
+ if (ILaunchConfiguration.class.equals(adapterType)) {
+ return attachLaunchConfigAdapter.getAttachLaunchConfig((IPeerModel)adaptableObject);
+ }
+ if (ILaunchConfigurationWorkingCopy.class.equals(adapterType)) {
+ ILaunchConfiguration launchConfig = attachLaunchConfigAdapter.getAttachLaunchConfig((IPeerModel)adaptableObject);
+ try {
+ return launchConfig.getWorkingCopy();
+ }
+ catch (Exception e) {
+ return launchConfig;
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return CLASSES;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AttachLaunchConfigAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AttachLaunchConfigAdapter.java
new file mode 100644
index 000000000..cdf6b882c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AttachLaunchConfigAdapter.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.tcf.launch.core.internal.adapters;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchManager;
+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.tcf.launch.core.interfaces.ILaunchTypes;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * AttachLaunchConfigAdapter
+ */
+public class AttachLaunchConfigAdapter {
+
+ public ILaunchConfiguration getAttachLaunchConfig(IPeerModel peer) {
+ ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ILaunchTypes.ATTACH);
+ ILaunchSelection launchSelection = new LaunchSelection(ILaunchManager.DEBUG_MODE, new RemoteSelectionContext(peer, true));
+ ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(launchConfigType, ILaunchManager.DEBUG_MODE);
+ // create an empty launch configuration specification to initialize all attributes with their default defaults.
+ ILaunchSpecification launchSpec = delegate.getLaunchSpecification(launchConfigType.getIdentifier(), launchSelection);
+ ILaunchConfiguration[] launchConfigs = null;
+
+ try {
+ launchConfigs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(launchConfigType);
+ launchConfigs = delegate.getMatchingLaunchConfigurations(launchSpec, launchConfigs);
+ }
+ catch (Exception e) {
+ }
+
+ ILaunchConfiguration config = launchConfigs != null && launchConfigs.length > 0 ? launchConfigs[0] : null;
+
+ try {
+ config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec);
+ }
+ catch (Exception e) {
+ }
+
+ return config;
+ }
+}
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 2c5cff6fb..49ede291e 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
@@ -12,21 +12,13 @@ package org.eclipse.tcf.te.tcf.launch.core.lm.delegates;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationListener;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.core.TransientPeer;
import org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
@@ -34,21 +26,17 @@ 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.events.ChangeEvent;
-import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate;
-import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.launch.core.interfaces.IAttachLaunchAttributes;
import org.eclipse.tcf.te.tcf.launch.core.interfaces.IPeerModelProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
/**
* RemoteAppLaunchManagerDelegate
*/
-public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate implements ILaunchConfigurationListener {
+public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
// mandatory attributes for attach launch configurations
private static final String[] MANDATORY_CONFIG_ATTRIBUTES = new String[] {
@@ -196,80 +184,4 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate im
}
return 1;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public void launchConfigurationAdded(ILaunchConfiguration configuration) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public void launchConfigurationChanged(ILaunchConfiguration configuration) {
- try {
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(configuration);
- boolean active = false;
- for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
- if (launch.getLaunchConfiguration().equals(configuration)) {
- active = true;
- }
- }
- if (active && contexts != null && contexts.length == 1 && contexts[0] instanceof IPeerModel) {
- final IPeerModel peerModel = (IPeerModel)contexts[0];
- @SuppressWarnings({ "unchecked", "rawtypes" })
- Map<?,?> attributes = new LinkedHashMap(configuration.getAttributes());
- attributes.remove(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS);
- attributes.remove(ICommonLaunchAttributes.ATTR_UUID);
- attributes.remove(ICommonLaunchAttributes.ATTR_LAST_LAUNCHED);
- attributes.remove(ICommonLaunchAttributes.ATTR_CAPTURE_IN_FILE);
- attributes.remove(ICommonLaunchAttributes.ATTR_CAPTURE_OUTPUT);
-
- String oldLaunchConfigAttributes = peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES);
- oldLaunchConfigAttributes = oldLaunchConfigAttributes == null ? "" : oldLaunchConfigAttributes.trim(); //$NON-NLS-1$
-
- IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(Map.class, String.class, false);
- final String launchConfigAttributes = attributes.isEmpty() ? "" : (String)delegate.write(attributes, String.class, null); //$NON-NLS-1$
-
- if (!launchConfigAttributes.equals(oldLaunchConfigAttributes)) {
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- IPeer oldPeer = peerModel.getPeer();
- Map<String, String> attributes = new HashMap<String, String>(peerModel.getPeer().getAttributes());
- String oldLaunchConfigAttributes = attributes.get(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES);
- if (launchConfigAttributes.trim().length() == 0) {
- attributes.remove(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES);
- }
- else {
- attributes.put(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES, launchConfigAttributes);
- }
- IPeer newPeer = new Peer(attributes);
- if (oldPeer instanceof TransientPeer && !(oldPeer instanceof PeerRedirector || oldPeer instanceof Peer)) {
- peerModel.setProperty(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties.PROP_INSTANCE, newPeer);
- } else {
- if (oldPeer instanceof PeerRedirector) {
- ((PeerRedirector)oldPeer).updateAttributes(attributes);
- } else if (oldPeer instanceof Peer) {
- ((Peer)oldPeer).updateAttributes(attributes);
- }
- }
- EventManager.getInstance().fireEvent(new ChangeEvent(peerModel, IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES, oldLaunchConfigAttributes, launchConfigAttributes));
- }
- });
- }
- }
- }
- catch (Exception e) {
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
- }
}

Back to the top