Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2016-04-15 07:15:55 -0400
committerSarika Sinha2016-04-15 07:15:55 -0400
commitf11a8af2a6470b63524d9d14b8110a09850e5dce (patch)
tree566b613c3e32cbc4d99ea9afe1b093b02004d2bd /org.eclipse.debug.ui/ui/org/eclipse/debug/ui
parentd292d014fed3ec588ec26be7790191ab642ee84d (diff)
downloadeclipse.platform.debug-f11a8af2a6470b63524d9d14b8110a09850e5dce.tar.gz
eclipse.platform.debug-f11a8af2a6470b63524d9d14b8110a09850e5dce.tar.xz
eclipse.platform.debug-f11a8af2a6470b63524d9d14b8110a09850e5dce.zip
Bug 487554 - Add "Terminate and Relaunch" to menu and toolbar
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java
index ccbfff59f..4321268cf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation 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
@@ -15,8 +15,12 @@ import java.util.ArrayList;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugException;
+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;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
@@ -79,7 +83,22 @@ public class LaunchAction extends Action {
public void run() {
DebugUITools.launch(fConfiguration, fMode);
}
-
+
+ private void terminateIfPreferred(boolean isShift) {
+ if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION) != isShift) {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches = launchManager.getLaunches();
+ for (ILaunch iLaunch : launches) {
+ if (fConfiguration.contentsEqual(iLaunch.getLaunchConfiguration())) {
+ try {
+ iLaunch.terminate();
+ } catch (DebugException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
/**
* If the user has control-clicked the launch history item, open the launch
* configuration dialog on the launch configuration, rather than running it.
@@ -122,6 +141,7 @@ public class LaunchAction extends Action {
}
}
else {
+ terminateIfPreferred(((event.stateMask & SWT.SHIFT) > 0) ? true : false);
run();
}
}

Back to the top