Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2016-08-12 07:37:07 +0000
committerSarika Sinha2016-08-12 07:37:07 +0000
commit72ffa77e3f8a4555ca2c3aec6ced697644546044 (patch)
treefe463f8e50a62833a7a0dfabee0d01a7035bc35d
parentc668724f83ea175ecc55095039907e6620bcc13a (diff)
downloadeclipse.platform.debug-72ffa77e3f8a4555ca2c3aec6ced697644546044.tar.gz
eclipse.platform.debug-72ffa77e3f8a4555ca2c3aec6ced697644546044.tar.xz
eclipse.platform.debug-72ffa77e3f8a4555ca2c3aec6ced697644546044.zip
Bug 492182 - Add Terminate and Relaunch from Configurations, RelaunchI20160816-1015I20160816-0800
actions and Context based launch Change-Id: Ie4828a93ec219dd9a5f1298451e42f1b6a765ecb
-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