Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-11-06 07:21:12 -0500
committerTobias Schwarz2012-11-06 07:21:12 -0500
commit0521f21fd2bc5c2edbdad96208a54e75f5ca65d0 (patch)
treee8df890e04fd9d37ac80f6d9b350bffe9c61c763 /target_explorer
parent9a54b160c879a8b69d8d2b16d7596102019956bd (diff)
downloadorg.eclipse.tcf-0521f21fd2bc5c2edbdad96208a54e75f5ca65d0.tar.gz
org.eclipse.tcf-0521f21fd2bc5c2edbdad96208a54e75f5ca65d0.tar.xz
org.eclipse.tcf-0521f21fd2bc5c2edbdad96208a54e75f5ca65d0.zip
[Target Explorer] change launch config persistence für launch config
editor pages
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/activator/CoreBundleActivator.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/DelegatingLaunchConfigurationListener.java83
-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
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java159
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/SourceLookupEditorPage.java5
13 files changed, 261 insertions, 477 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/activator/CoreBundleActivator.java
index 32d1dc6c3..9772e20d4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/activator/CoreBundleActivator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/activator/CoreBundleActivator.java
@@ -11,7 +11,6 @@ package org.eclipse.tcf.te.launch.core.activator;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationListener;
-import org.eclipse.tcf.te.launch.core.internal.DelegatingLaunchConfigurationListener;
import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
import org.osgi.framework.BundleActivator;
@@ -79,9 +78,6 @@ public class CoreBundleActivator implements BundleActivator {
@Override
public void start(BundleContext bundleContext) throws Exception {
CoreBundleActivator.context = bundleContext;
-
- launchConfigListener = new DelegatingLaunchConfigurationListener();
- DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(launchConfigListener);
}
/*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java
index 7f480fc16..0102b4af8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java
@@ -95,7 +95,7 @@ public class LaunchConfigTypeBindingsManager {
LaunchConfigTypeBinding binding = bindings.get(typeId);
ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId);
- return (launchConfigType != null && launchConfigType.isPublic() &&
+ return (launchConfigType != null &&
(selection.getLaunchMode() == null || launchConfigType.supportsMode(selection.getLaunchMode())) &&
binding != null && binding.validate(selection) == EvaluationResult.TRUE);
}
@@ -113,7 +113,7 @@ public class LaunchConfigTypeBindingsManager {
LaunchConfigTypeBinding binding = bindings.get(typeId);
ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId);
- return (launchConfigType != null && launchConfigType.isPublic() &&
+ return (launchConfigType != null &&
(mode == null || launchConfigType.supportsMode(mode)) &&
binding != null && binding.validate(mode, context) != EvaluationResult.FALSE);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/DelegatingLaunchConfigurationListener.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/DelegatingLaunchConfigurationListener.java
deleted file mode 100644
index be699d776..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/DelegatingLaunchConfigurationListener.java
+++ /dev/null
@@ -1,83 +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.internal;
-
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationListener;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
-
-/**
- * DelegatingLaunchConfigurationListener
- */
-public class DelegatingLaunchConfigurationListener implements ILaunchConfigurationListener {
-
- /**
- * Constructor.
- */
- public DelegatingLaunchConfigurationListener() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public void launchConfigurationAdded(ILaunchConfiguration configuration) {
- if (configuration instanceof ILaunchConfigurationWorkingCopy) {
- return;
- }
- ILaunchConfigurationListener listener = getListeningDelegate(configuration);
- if (listener != null) {
- listener.launchConfigurationAdded(configuration);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public void launchConfigurationChanged(ILaunchConfiguration configuration) {
- if (configuration instanceof ILaunchConfigurationWorkingCopy) {
- return;
- }
- ILaunchConfigurationListener listener = getListeningDelegate(configuration);
- if (listener != null) {
- listener.launchConfigurationChanged(configuration);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
- if (configuration instanceof ILaunchConfigurationWorkingCopy) {
- return;
- }
- ILaunchConfigurationListener listener = getListeningDelegate(configuration);
- if (listener != null) {
- listener.launchConfigurationRemoved(configuration);
- }
- }
-
- private ILaunchConfigurationListener getListeningDelegate(ILaunchConfiguration configuration) {
- try {
- ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(configuration.getType(), ""); //$NON-NLS-1$
- if (delegate instanceof ILaunchConfigurationListener) {
- return (ILaunchConfigurationListener)delegate;
- }
- }
- catch (Exception e) {
- }
- return null;
- }
-}
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) {
- }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
index c96ddd178..efcc16e9a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
@@ -9,49 +9,31 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.ui.editor;
-import java.util.EventObject;
-import java.util.HashMap;
-import java.util.Map;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.tcf.core.TransientPeer;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
-import org.eclipse.tcf.te.launch.core.lm.LaunchSpecification;
-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.ui.editor.AbstractLaunchTabContainerEditorPage;
import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
-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.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.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.tcf.core.peers.Peer;
-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;
-import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
-import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
/**
* TCF launch configuration tab container page implementation.
*/
-public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLaunchTabContainerEditorPage {
+public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLaunchTabContainerEditorPage implements ILaunchConfigurationListener {
+
+ protected ILaunchConfigurationListener launchConfigListener = null;
protected static final String PROP_LAUNCH_CONFIG_WC = "launchConfigWorkingCopy.transient.silent"; //$NON-NLS-1$
protected static final String PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES = "launchConfigAttributes.transient.silent"; //$NON-NLS-1$
- private IEventListener eventListener = null;
-
/**
* Get the peer model from the editor input.
* @param input The editor input.
@@ -75,22 +57,19 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
wc = (ILaunchConfigurationWorkingCopy)service.getProperty(peerModel, PROP_LAUNCH_CONFIG_WC);
}
else {
- String launchConfigAttributes = peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES);
- ILaunchSpecification spec = new LaunchSpecification(ILaunchTypes.ATTACH, ILaunchManager.DEBUG_MODE);
- LaunchContextsPersistenceDelegate.setLaunchContexts(spec, new IModelNode[]{peerModel});
+ wc = (ILaunchConfigurationWorkingCopy)Platform.getAdapterManager().getAdapter(peerModel, ILaunchConfigurationWorkingCopy.class);
+ if (wc == null) {
+ wc = (ILaunchConfigurationWorkingCopy)Platform.getAdapterManager().loadAdapter(peerModel, "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"); //$NON-NLS-1$
+ }
+ service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, wc);
+ IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(wc, String.class, false);
+ String launchConfigAttributes = null;
try {
- wc = LaunchManager.getInstance().getLaunchConfiguration(spec, true).getWorkingCopy();
- LaunchContextsPersistenceDelegate.setLaunchContexts(wc, null);
- IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(wc, String.class, false);
- if (launchConfigAttributes != null && launchConfigAttributes.trim().length() > 0) {
- delegate.read(wc, launchConfigAttributes, null);
- }
launchConfigAttributes = (String)delegate.write(wc, String.class, null);
- service.setProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, launchConfigAttributes);
- service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, wc);
}
catch (Exception e) {
}
+ service.setProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, launchConfigAttributes);
}
}
return wc;
@@ -118,30 +97,14 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
ILaunchConfigurationWorkingCopy wc = getLaunchConfig(getPeerModel(getEditorInput()));
if (wc != null && checkLaunchConfigDirty()) {
getLaunchConfigurationTab().performApply(wc);
- IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(wc, String.class, false);
try {
- final String launchConfigAttributes = (String)delegate.write(wc, String.class, null);
- final IPeerModel peerModel = getPeerModel(getEditorInput());
+ wc.doSave();
+ IPeerModel peerModel = getPeerModel(getEditorInput());
IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
- service.setProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, launchConfigAttributes);
- if (peerModel != null) {
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- IPeer oldPeer = peerModel.getPeer();
- Map<String, String> attributes = new HashMap<String, String>(peerModel.getPeer().getAttributes());
- 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 {
- Model.getModel().getService(ILocatorModelUpdateService.class).mergeUserDefinedAttributes(peerModel, newPeer, false);
- }
- checkLaunchConfigDirty();
- }
- });
- return true;
- }
+ Assert.isNotNull(service);
+ service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
+ checkLaunchConfigDirty();
+ return true;
}
catch (Exception e) {
}
@@ -167,15 +130,22 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
}
catch (Exception e) {
}
-
setDirty(dirty);
+ return dirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setDirty(boolean)
+ */
+ @Override
+ public void setDirty(boolean dirty) {
+ super.setDirty(dirty);
ExecutorsUtil.executeInUI(new Runnable() {
@Override
public void run() {
getManagedForm().dirtyStateChanged();
}
});
- return dirty;
}
/* (non-Javadoc)
@@ -184,33 +154,9 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
@Override
public void setActive(boolean active) {
super.setActive(active);
-
- if (eventListener == null) {
- eventListener = new IEventListener() {
- @Override
- public void eventFired(EventObject event) {
- if (event instanceof ChangeEvent && IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES.equals(((ChangeEvent)event).getEventId())) {
- if (event.getSource() instanceof IPeerModel && getPeerModel(getEditorInput()).getUUID().equals(((IPeerModel)event.getSource()).getUUID())) {
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- IPropertiesAccessService service = ServiceManager.getInstance().getService(getPeerModel(getEditorInput()), IPropertiesAccessService.class);
- Assert.isNotNull(service);
- service.setProperty(getPeerModel(getEditorInput()), PROP_LAUNCH_CONFIG_WC, null);
- service.setProperty(getPeerModel(getEditorInput()), PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, null);
- }
- });
- ExecutorsUtil.executeInUI(new Runnable() {
- @Override
- public void run() {
- setActive(isActive());
- }
- });
- }
- }
- }
- };
- EventManager.getInstance().addEventListener(eventListener, ChangeEvent.class);
+ if (active && launchConfigListener == null) {
+ launchConfigListener = this;
+ DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this);
}
}
@@ -220,10 +166,47 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
@Override
public void dispose() {
super.dispose();
- EventManager.getInstance().removeEventListener(eventListener);
IPeerModel peerModel = getPeerModel(getEditorInput());
IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
service.setProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, null);
service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this);
+ launchConfigListener = null;
+ }
+
+ /* (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#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ if (!(configuration instanceof ILaunchConfigurationWorkingCopy)) {
+ IPeerModel peerModel = getPeerModel(getEditorInput());
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
+ ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy)service.getProperty(peerModel, PROP_LAUNCH_CONFIG_WC);
+ if (wc != null && configuration.getName().equals(wc.getName())) {
+ service.setProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, null);
+ service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
+ ExecutorsUtil.executeInUI(new Runnable() {
+ @Override
+ public void run() {
+ setActive(isActive());
+ }
+ });
+ }
+ }
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java
index 5c063930a..1785a5957 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java
@@ -63,17 +63,6 @@ public class MemoryMapEditorPage extends AbstractTcfLaunchTabContainerEditorPage
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setActive(boolean)
- */
- @Override
- public void setActive(boolean active) {
- super.setActive(active);
- if (isActive() && ((TCFMemoryMapTab)getLaunchConfigurationTab()).updateContext()) {
- ((TCFMemoryMapTab)getLaunchConfigurationTab()).initializeFrom(getLaunchConfig(getPeerModel(getEditorInput())));
- }
- }
-
- /* (non-Javadoc)
* @see org.eclipse.tcf.te.tcf.launch.ui.editor.AbstractTcfLaunchTabContainerEditorPage#dispose()
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/SourceLookupEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/SourceLookupEditorPage.java
index d16a12c8e..b9e75bde2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/SourceLookupEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/SourceLookupEditorPage.java
@@ -9,8 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.ui.editor;
+import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupPanel;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -18,6 +18,7 @@ import org.eclipse.swt.widgets.Composite;
/**
* Source lookup launch configuration tab container page implementation.
*/
+@SuppressWarnings("restriction")
public class SourceLookupEditorPage extends AbstractTcfLaunchTabContainerEditorPage {
/* (non-Javadoc)
@@ -25,7 +26,7 @@ public class SourceLookupEditorPage extends AbstractTcfLaunchTabContainerEditorP
*/
@Override
protected AbstractLaunchConfigurationTab createLaunchConfigurationTab() {
- return new SourceLookupTab() {
+ return new SourceLookupPanel() {
@Override
public void createControl(Composite parent) {
super.createControl(parent);

Back to the top