Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java40
1 files changed, 36 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index df2c46e61..e0474df51 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -13,6 +13,7 @@ package org.eclipse.debug.ui;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.Set;
import org.eclipse.core.commands.ExecutionEvent;
@@ -898,14 +899,22 @@ public class DebugUITools {
ILaunch[] launches = launchManager.getLaunches();
for (ILaunch iLaunch : launches) {
if (configuration.contentsEqual(iLaunch.getLaunchConfiguration())) {
- try {
- iLaunch.terminate();
- } catch (DebugException e) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), NLS.bind(ActionMessages.TerminateAndLaunchFailure, iLaunch.getLaunchConfiguration().getName()), e));
+ synchronized (fgLaunchList) {
+ fgLaunchList.add(iLaunch);
}
}
}
}
+ if (!fgLaunchList.isEmpty()) {
+ Thread t = new Thread(fgLaunchTerminate);
+ t.start();
+ try {
+ t.join();
+ } catch (InterruptedException e1) {
+ DebugUIPlugin.log(e1);
+ return;
+ }
+ }
boolean launchInBackground = true;
try {
launchInBackground = configuration.getAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
@@ -919,6 +928,29 @@ public class DebugUITools {
}
}
+
+ private static Set<ILaunch> fgLaunchList = new LinkedHashSet<>();
+ private static Runnable fgLaunchTerminate = new Runnable() {
+ @Override
+ public void run() {
+ String launchConfigName = null;
+ Set<ILaunch> launchList;
+ try {
+ synchronized (fgLaunchList) {
+ launchList = new LinkedHashSet<>(fgLaunchList);
+ fgLaunchList.clear();
+ }
+ for (ILaunch iLaunch : launchList) {
+ launchConfigName = iLaunch.getLaunchConfiguration().getName();
+ iLaunch.terminate();
+ }
+
+ } catch (DebugException e) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), NLS.bind(ActionMessages.TerminateAndLaunchFailure, launchConfigName), e));
+ }
+ }
+ };
+
/**
* Builds the workspace according to current preference settings, and launches

Back to the top