Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2016-04-15 11:15:55 +0000
committerSarika Sinha2016-04-15 11:15:55 +0000
commitf11a8af2a6470b63524d9d14b8110a09850e5dce (patch)
tree566b613c3e32cbc4d99ea9afe1b093b02004d2bd /org.eclipse.debug.ui/ui/org
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')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java24
6 files changed, 53 insertions, 10 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
index 771fd7945..1ddf8b410 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -63,6 +63,8 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
prefs.setDefault(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, false);
prefs.setDefault(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE, true);
+ prefs.setDefault(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION, false);
+
//View Management preference page
prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT);
prefs.setDefault(IInternalDebugUIConstants.PREF_TRACK_VIEWS, true);
@@ -201,8 +203,8 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
if (oldValue != null && !oldValue.equals(newValue))
store.firePropertyChangeEvent(key, oldValue, newValue);
+ }
}
- }
public static void setThemeBasedPreferences(final IPreferenceStore store, final boolean fireEvent) {
Display display= PlatformUI.getWorkbench().getDisplay();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
index df92d2657..34ca10529 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.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
@@ -435,5 +435,15 @@ public interface IInternalDebugUIConstants {
*
* @since 3.4
*/
- public static final String THEME_CONSOLE_COLOR_STD_ERR= "org.eclipse.debug.ui.console.stream.err"; //$NON-NLS-1$
+ public static final String THEME_CONSOLE_COLOR_STD_ERR = "org.eclipse.debug.ui.console.stream.err"; //$NON-NLS-1$
+
+
+ /**
+ * Boolean preference indicating if launch action should launch or terminate
+ * and relaunch by default
+ *
+ * @since 3.11
+ */
+ public static final String PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION = IDebugUIConstants.PLUGIN_ID + ".RelaunchAndTerminateLaunchAction"; //$NON-NLS-1$
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
index 9acd358a8..d28da94aa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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
@@ -85,6 +85,7 @@ public class DebugPreferencesMessages extends NLS {
public static String LaunchingPreferencePage_4;
public static String LaunchingPreferencePage_41;
+ public static String LaunchingPreferencePage_42;
public static String LaunchingPreferencePage_5;
public static String LaunchingPreferencePage_6;
public static String LaunchingPreferencePage_7;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
index 8c219dc75..2e822e249 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2014 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
@@ -84,6 +84,7 @@ LaunchingPreferencePage_39=Launch the associated pro&ject
LaunchingPreferencePage_40=Launch Operation
LaunchingPreferencePage_41=La&unch the previously launched application
LaunchingPreferencePage_confirm_0=Prompt for confirmation when removin&g a configuration from the launch history
+LaunchingPreferencePage_42=Termin&ate and Relaunch while launching (Press 'Shift' to toggle during launch)
ProcessPropertyPage_Command_Line__1=Co&mmand Line:
ProcessPropertyPage_0=Run-&at time:
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java
index 731dbd03a..25e163133 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -48,6 +48,7 @@ public class LaunchingPreferencePage extends FieldEditorPreferencePage implement
private Button fUseOldLaunching;
private Button fLaunchLastIfNotLaunchable;
private Button fCheckParent;
+ private Button fTerminatAndRelaunch;
/**
* The default constructor
@@ -172,7 +173,9 @@ public class LaunchingPreferencePage extends FieldEditorPreferencePage implement
fCheckParent = SWTFactory.createRadioButton(space, DebugPreferencesMessages.LaunchingPreferencePage_39);
fLaunchLastIfNotLaunchable = SWTFactory.createRadioButton(space, DebugPreferencesMessages.LaunchingPreferencePage_41);
- //initialize the buttons
+ fTerminatAndRelaunch = SWTFactory.createCheckButton(group, DebugPreferencesMessages.LaunchingPreferencePage_42, null, false, 1);
+
+ // initialize the buttons
boolean value = getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH);
fUseOldLaunching.setSelection(!value);
fUseContextLaunching.setSelection(value);
@@ -181,6 +184,9 @@ public class LaunchingPreferencePage extends FieldEditorPreferencePage implement
fCheckParent.setEnabled(value);
fLaunchLastIfNotLaunchable.setSelection(!enable);
fLaunchLastIfNotLaunchable.setEnabled(value);
+
+ value = getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION);
+ fTerminatAndRelaunch.setSelection(value);
}
/* (non-Javadoc)
@@ -202,6 +208,8 @@ public class LaunchingPreferencePage extends FieldEditorPreferencePage implement
fCheckParent.setEnabled(value);
fLaunchLastIfNotLaunchable.setSelection(!parent);
fLaunchLastIfNotLaunchable.setEnabled(value);
+ value = getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION);
+ fTerminatAndRelaunch.setSelection(value);
super.performDefaults();
}
@@ -213,6 +221,7 @@ public class LaunchingPreferencePage extends FieldEditorPreferencePage implement
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, fUseContextLaunching.getSelection());
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, fCheckParent.getSelection());
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE, fLaunchLastIfNotLaunchable.getSelection());
+ getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION, fTerminatAndRelaunch.getSelection());
return super.performOk();
}
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