Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/internal/DelegatingLaunchConfigurationListener.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/LaunchConfigurationListenerDelegate.java)6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java51
4 files changed, 73 insertions, 10 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 f4606ecb4..32d1dc6c3 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,7 @@ 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.LaunchConfigurationListenerDelegate;
+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;
@@ -80,7 +80,7 @@ public class CoreBundleActivator implements BundleActivator {
public void start(BundleContext bundleContext) throws Exception {
CoreBundleActivator.context = bundleContext;
- launchConfigListener = new LaunchConfigurationListenerDelegate();
+ 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/internal/LaunchConfigurationListenerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/DelegatingLaunchConfigurationListener.java
index 338294ef9..be699d776 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/LaunchConfigurationListenerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/DelegatingLaunchConfigurationListener.java
@@ -17,14 +17,14 @@ import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
/**
- * LaunchConfigurationListenerDelegate
+ * DelegatingLaunchConfigurationListener
*/
-public class LaunchConfigurationListenerDelegate implements ILaunchConfigurationListener {
+public class DelegatingLaunchConfigurationListener implements ILaunchConfigurationListener {
/**
* Constructor.
*/
- public LaunchConfigurationListenerDelegate() {
+ public DelegatingLaunchConfigurationListener() {
}
/* (non-Javadoc)
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 bab988fa3..2c5cff6fb 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
@@ -18,6 +18,8 @@ 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;
@@ -32,6 +34,8 @@ 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;
@@ -39,8 +43,6 @@ 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.interfaces.services.ILocatorModelUpdateService;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
/**
@@ -209,7 +211,13 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate im
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
try {
IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(configuration);
- if (contexts != null && contexts.length == 1 && contexts[0] instanceof IPeerModel) {
+ 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());
@@ -231,6 +239,7 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate im
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);
}
@@ -241,8 +250,13 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate im
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);
+ 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));
}
});
}
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 16f1dff8c..c96ddd178 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,6 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.ui.editor;
+import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
@@ -24,6 +25,10 @@ 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;
@@ -45,6 +50,8 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
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.
@@ -162,16 +169,58 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
}
setDirty(dirty);
- getManagedForm().dirtyStateChanged();
+ ExecutorsUtil.executeInUI(new Runnable() {
+ @Override
+ public void run() {
+ getManagedForm().dirtyStateChanged();
+ }
+ });
return dirty;
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setActive(boolean)
+ */
+ @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);
+ }
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#dispose()
*/
@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);

Back to the top