Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-08-09 12:50:49 +0000
committerTobias Schwarz2012-08-09 12:50:49 +0000
commit29d22544a699b273494782d92b52909049388ae2 (patch)
tree13d631b9403babdca9606a459ef23c667cbed74e /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui
parent55c7017e1987d1251e3758e9e9cf4a046695b78f (diff)
downloadorg.eclipse.tcf-29d22544a699b273494782d92b52909049388ae2.tar.gz
org.eclipse.tcf-29d22544a699b273494782d92b52909049388ae2.tar.xz
org.eclipse.tcf-29d22544a699b273494782d92b52909049388ae2.zip
Target Explorer: avoid multiple attach launches to the same launch
context
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java
index 95d457cbe..7e479b39d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java
@@ -12,6 +12,7 @@ package org.eclipse.tcf.te.tcf.launch.ui.internal.services;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchManager;
@@ -20,6 +21,7 @@ import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
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;
@@ -77,10 +79,27 @@ public class DebugService extends AbstractService implements IDebugService {
launchConfigs = delegate.getMatchingLaunchConfigurations(launchSpec, launchConfigs);
ILaunchConfiguration config = launchConfigs != null && launchConfigs.length > 0 ? launchConfigs[0] : null;
- config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec);
- delegate.validate(ILaunchManager.DEBUG_MODE, config);
- DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
+ boolean skip = false;
+ if (config != null) {
+
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ for (ILaunch launch : launches) {
+ if (launch.getLaunchConfiguration().getType().getIdentifier().equals(ILaunchTypes.ATTACH)) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launch.getLaunchConfiguration());
+ if (contexts != null && contexts.length == 1 && contexts[0].equals(context)) {
+ skip = true;
+ }
+ }
+ }
+ }
+
+ if (!skip) {
+ config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec);
+
+ delegate.validate(ILaunchManager.DEBUG_MODE, config);
+ DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
+ }
}
}
callback.done(this, Status.OK_STATUS);

Back to the top