Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2016-07-13 05:23:00 +0000
committerSarika Sinha2016-07-30 09:33:50 +0000
commit8124e2bb15eb3d3793ac8f160e83bddaf1a5c7d8 (patch)
tree2d5ae6749f01aaeb28f90eb7b28100b0c0ceddea /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui
parent9ed73a19c85b0cf7c1f48d0dc5fc370f9d9ced61 (diff)
downloadeclipse.platform.debug-8124e2bb15eb3d3793ac8f160e83bddaf1a5c7d8.tar.gz
eclipse.platform.debug-8124e2bb15eb3d3793ac8f160e83bddaf1a5c7d8.tar.xz
eclipse.platform.debug-8124e2bb15eb3d3793ac8f160e83bddaf1a5c7d8.zip
actions and Context based launch Change-Id: Icef7f143a7d967c5d7126180a359fd4fcbe3422e
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java146
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties2
8 files changed, 246 insertions, 57 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
index 0a7e13f05..c91cc5698 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.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
@@ -21,6 +21,7 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
@@ -59,9 +60,14 @@ public abstract class AbstractDebugActionDelegate implements IViewActionDelegate
private boolean fInitialized = false;
/**
- * It's crucial that delegate actions have a zero-argument constructor so that
- * they can be reflected into existence when referenced in an action set
- * in the plugin's plugin.xml file.
+ * Whether this delegate was started with Shift pressed
+ */
+ private boolean fIsShift = false;
+
+ /**
+ * It's crucial that delegate actions have a zero-argument constructor so
+ * that they can be reflected into existence when referenced in an action
+ * set in the plugin's plugin.xml file.
*/
public AbstractDebugActionDelegate() {}
@@ -83,7 +89,7 @@ public abstract class AbstractDebugActionDelegate implements IViewActionDelegate
// disable the action so it cannot be run again until an event or selection change
// updates the enablement
action.setEnabled(false);
- runInForeground(selection);
+ runInForeground(selection, false);
}
}
@@ -91,7 +97,8 @@ public abstract class AbstractDebugActionDelegate implements IViewActionDelegate
* Runs this action in the UI thread.
* @param selection the current selection
*/
- private void runInForeground(final IStructuredSelection selection) {
+ private void runInForeground(final IStructuredSelection selection, boolean isShift) {
+ fIsShift = isShift;
final MultiStatus status=
new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, getStatusMessage(), null);
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@@ -320,12 +327,27 @@ public abstract class AbstractDebugActionDelegate implements IViewActionDelegate
return true;
}
+ /**
+ * Returns if this action is started with Shift pressed
+ * @return true if it is, false otherwise
+ */
+ protected boolean isShift() {
+ return fIsShift;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
*/
@Override
public void runWithEvent(IAction action, Event event) {
- run(action);
+ if (action.isEnabled()) {
+ IStructuredSelection selection = getSelection();
+ // disable the action so it cannot be run again until an event or
+ // selection change
+ // updates the enablement
+ action.setEnabled(false);
+ runInForeground(selection, ((event.stateMask & SWT.SHIFT) > 0) ? true : false);
+ }
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
index e318c0b53..e554b3ed4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -60,7 +60,7 @@ public class LaunchConfigurationAction extends Action {
*/
@Override
public void run() {
- DebugUITools.launch(fConfig, fMode);
+ runInternal(false);
}
/* (non-Javadoc)
@@ -75,13 +75,17 @@ public class LaunchConfigurationAction extends Action {
DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(fConfig), group.getIdentifier());
}
else {
- run();
+ runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false);
}
}
catch(CoreException ce) {}
}
else {
- run();
+ runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false);
}
}
+
+ private void runInternal(boolean isShift) {
+ DebugUITools.launch(fConfig, fMode, isShift);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java
index ff296338c..c0c3d1c67 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.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
@@ -45,6 +45,7 @@ public class LaunchShortcutAction extends Action {
private String fMode;
private LaunchShortcutExtension fShortcut;
+
/**
* Constructor
* @param groupid the id of the launch group
@@ -65,12 +66,20 @@ public class LaunchShortcutAction extends Action {
*/
@Override
public void run() {
+ runInternal(false);
+ }
+
+ private void runInternal(boolean isShift) {
IStructuredSelection ss = SelectedResourceManager.getDefault().getCurrentSelection();
Object o = ss.getFirstElement();
+ // store if Shift was pressed to toggle terminate before launch
+ // preference
if(o instanceof IEditorPart) {
+ DebugUITools.storeLaunchToggleTerminate(o, isShift);
fShortcut.launch((IEditorPart) o, fMode);
}
else {
+ DebugUITools.storeLaunchToggleTerminate(ss, isShift);
fShortcut.launch(ss, fMode);
}
}
@@ -120,7 +129,7 @@ public class LaunchShortcutAction extends Action {
}
}
else {
- run();
+ runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java
index 3b0f1a059..49ea10867 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.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
@@ -30,19 +30,31 @@ public class RelaunchActionDelegate extends AbstractDebugActionDelegate {
*/
@Override
protected void doAction(Object object) {
- ILaunch launch= DebugUIPlugin.getLaunch(object);
- if (launch != null) {
- relaunch(launch.getLaunchConfiguration(), launch.getLaunchMode());
- }
+ ILaunch launch = DebugUIPlugin.getLaunch(object);
+ if (launch != null) {
+ relaunch(launch.getLaunchConfiguration(), launch.getLaunchMode(), isShift());
+ }
}
-
+
/**
* Re-launches the given configuration in the specified mode.
+ *
*/
public static void relaunch(ILaunchConfiguration config, String mode) {
- DebugUITools.launch(config, mode);
+ DebugUITools.launch(config, mode);
}
-
+
+ /**
+ * Re-launches the given configuration in the specified mode after
+ * terminating the previous if Preferred.
+ *
+ * @param isShift is Shift pressed (use <code>false</code> if no support for
+ * Shift)
+ */
+ public static void relaunch(ILaunchConfiguration config, String mode, boolean isShift) {
+ DebugUITools.launch(config, mode, isShift);
+ }
+
/**
* @see AbstractDebugActionDelegate#isEnabledFor(Object)
*/
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
index fe6b175b2..70e1bb46e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -72,28 +72,59 @@ public final class ContextRunner {
private LaunchingResourceManager fLRM = DebugUIPlugin.getDefault().getLaunchingResourceManager();
/**
- * Performs the context launching given the object context and the mode to launch in.
+ * Performs the context launching given the object context and the mode to
+ * launch in.
+ *
* @param group the launch group to launch using
+ * @deprecated use launch(ILaunchGroup, boolean)
*/
+ @Deprecated
public void launch(ILaunchGroup group) {
+ launch(group, false);
+ }
+
+ /**
+ * Performs the context launching given the object context and the mode to
+ * launch in.
+ *
+ * @param group the launch group to launch using
+ * @param isShift is Shift pressed (use <code>false</code> if no support for
+ * Shift)
+ */
+ public void launch(ILaunchGroup group, boolean isShift) {
IStructuredSelection selection = SelectedResourceManager.getDefault().getCurrentSelection();
IResource resource = SelectedResourceManager.getDefault().getSelectedResource();
- selectAndLaunch(resource, group, selection);
+ selectAndLaunch(resource, group, selection, isShift);
}
-
-
/**
* This method launches the last configuration that was launched, if any.
+ *
* @param group the launch group to launch with
- * @return true if there was a last launch and it was launched, false otherwise
+ * @return true if there was a last launch and it was launched, false
+ * otherwise
+ * @deprecated use launchLast(ILaunchGroup, boolean)
*/
+ @Deprecated
protected boolean launchLast(ILaunchGroup group) {
+ return launchLast(group, false);
+ }
+
+ /**
+ * This method launches the last configuration that was launched, if any.
+ *
+ * @param group the launch group to launch with
+ * @param isShift is Shift pressed (use <code>false</code> if no support for
+ * Shift)
+ * @return true if there was a last launch and it was launched, false
+ * otherwise
+ */
+ protected boolean launchLast(ILaunchGroup group, boolean isShift) {
ILaunchConfiguration config = null;
if(group != null) {
config = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getFilteredLastLaunch(group.getIdentifier());
if(config != null) {
- launch(config, group.getMode());
+ launch(config, group.getMode(), isShift);
return true;
}
}
@@ -101,14 +132,31 @@ public final class ContextRunner {
}
/**
- * Prompts the user to select a way of launching the current resource, where a 'way'
- * is defined as a launch shortcut.
+ * Prompts the user to select a way of launching the current resource, where
+ * a 'way' is defined as a launch shortcut.
*
* @param resource the resource context
* @param group the launch group to launch with
* @param selection the current selection
+ * @deprecated use selectAndLaunch(IResource, ILaunchGroup,
+ * IStructuredSelection, boolean)
*/
+ @Deprecated
protected void selectAndLaunch(IResource resource, ILaunchGroup group, IStructuredSelection selection) {
+ selectAndLaunch(resource, group, selection, false);
+ }
+
+ /**
+ * Prompts the user to select a way of launching the current resource, where
+ * a 'way' is defined as a launch shortcut.
+ *
+ * @param resource the resource context
+ * @param group the launch group to launch with
+ * @param selection the current selection
+ * @param isShift is Shift pressed (use <code>false</code> if no support for
+ * Shift)
+ */
+ protected void selectAndLaunch(IResource resource, ILaunchGroup group, IStructuredSelection selection, boolean isShift) {
if(group != null) {
LaunchConfigurationManager lcm = DebugUIPlugin.getDefault().getLaunchConfigurationManager();
String mode = group.getMode();
@@ -122,33 +170,33 @@ public final class ContextRunner {
//see if the context is a shared configuration
ILaunchConfiguration config = lcm.isSharedConfig(resource);
if(config != null) {
- launch(config, mode);
+ launch(config, mode, isShift);
return;
}
//get the configurations from the resource and participants
List<ILaunchConfiguration> configs = fLRM.getParticipatingLaunchConfigurations(selection, resource, shortcuts, mode);
int csize = configs.size();
if(csize == 1) {
- launch(configs.get(0), mode);
+ launch(configs.get(0), mode, isShift);
}
else if(csize < 1) {
int esize = shortcuts.size();
if(esize == 1) {
- launchShortcut(selection, shortcuts.get(0), mode);
+ launchShortcut(selection, shortcuts.get(0), mode, isShift);
}
else if(esize > 1) {
- showShortcutSelectionDialog(resource, shortcuts, mode, selection);
+ showShortcutSelectionDialog(resource, shortcuts, mode, selection, isShift);
}
else if(esize < 1) {
if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE)) {
- if(!launchLast(group)) {
+ if (!launchLast(group, isShift)) {
MessageDialog.openInformation(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_0, ContextMessages.ContextRunner_7);
}
} else {
if(resource != null) {
IProject project = resource.getProject();
if(project != null && !project.equals(resource)) {
- selectAndLaunch(project, group, new StructuredSelection(project));
+ selectAndLaunch(project, group, new StructuredSelection(project), isShift);
}
else {
String msg = ContextMessages.ContextRunner_7;
@@ -159,7 +207,7 @@ public final class ContextRunner {
}
}
else {
- if (!launchLast(group)) {
+ if (!launchLast(group, isShift)) {
MessageDialog.openInformation(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_0, ContextMessages.ContextRunner_7);
}
}
@@ -169,9 +217,9 @@ public final class ContextRunner {
else if(csize > 1){
config = lcm.getMRUConfiguration(configs, group, resource);
if(config != null) {
- launch(config, mode);
+ launch(config, mode, isShift);
} else {
- showConfigurationSelectionDialog(configs, mode);
+ showConfigurationSelectionDialog(configs, mode, isShift);
}
}
}
@@ -182,28 +230,36 @@ public final class ContextRunner {
*
* @param configuration configuration to launch
* @param mode launch mode identifier
+ * @param isShift is Shift pressed
*/
- private void launch(ILaunchConfiguration configuration, String mode) {
+ private void launch(ILaunchConfiguration configuration, String mode, boolean isShift) {
if (validateMode(configuration, mode)) {
- DebugUITools.launch(configuration, mode);
+ DebugUITools.launch(configuration, mode, isShift);
}
}
/**
- * Delegate method that calls the appropriate launch method on a <code>LaunchShortcutExtension</code> given
- * the current resource and selection context
+ * Delegate method that calls the appropriate launch method on a
+ * <code>LaunchShortcutExtension</code> given the current resource and
+ * selection context
+ *
* @param selection the current selection
* @param shortcut the shortcut that wants to launch
* @param mode the mode to launch in
+ * @param isShift is Shift pressed
*
* @since 3.4
*/
- private void launchShortcut(IStructuredSelection selection, LaunchShortcutExtension shortcut, String mode) {
+ private void launchShortcut(IStructuredSelection selection, LaunchShortcutExtension shortcut, String mode, boolean isShift) {
Object o = selection.getFirstElement();
+ // store if Shift was pressed to toggle terminate before launch
+ // preference
if(o instanceof IEditorPart) {
+ DebugUITools.storeLaunchToggleTerminate(o, isShift);
shortcut.launch((IEditorPart) o, mode);
}
else {
+ DebugUITools.storeLaunchToggleTerminate(selection, isShift);
shortcut.launch(selection, mode);
}
}
@@ -243,17 +299,34 @@ public final class ContextRunner {
}
/**
- * Presents the user with a dialog to pick the launch configuration to launch
- * and launches that configuration.
+ * Presents the user with a dialog to pick the launch configuration to
+ * launch and launches that configuration.
*
* @param configurations the listing of applicable configurations to present
* @param mode the mode
+ * @deprecated use
+ * showConfigurationSelectionDialog(List<ILaunchConfiguration>,
+ * String, boolean)
*/
+ @Deprecated
protected void showConfigurationSelectionDialog(List<ILaunchConfiguration> configurations, String mode) {
+ showConfigurationSelectionDialog(configurations, mode, false);
+ }
+
+ /**
+ * Presents the user with a dialog to pick the launch configuration to
+ * launch and launches that configuration.
+ *
+ * @param configurations the listing of applicable configurations to present
+ * @param mode the mode
+ * @param isShift is Shift pressed (use <code>false</code> if no support for
+ * Shift)
+ */
+ protected void showConfigurationSelectionDialog(List<ILaunchConfiguration> configurations, String mode, boolean isShift) {
LaunchConfigurationSelectionDialog lsd = new LaunchConfigurationSelectionDialog(DebugUIPlugin.getShell(), configurations);
if(lsd.open() == IDialogConstants.OK_ID) {
ILaunchConfiguration config = (ILaunchConfiguration) lsd.getResult()[0];
- launch(config, mode);
+ launch(config, mode, isShift);
}
}
@@ -265,15 +338,34 @@ public final class ContextRunner {
* @param shortcuts the list of applicable shortcuts
* @param mode the mode
* @param selection the current selection
+ * @deprecated use showShortcutSelectionDialog(IResource,
+ * List<LaunchShortcutExtension>, String,IStructuredSelection,
+ * boolean)
*/
+ @Deprecated
protected void showShortcutSelectionDialog(IResource resource, List<LaunchShortcutExtension> shortcuts, String mode, IStructuredSelection selection) {
+ showShortcutSelectionDialog(resource, shortcuts, mode, selection, false);
+ }
+
+ /**
+ * Presents a selection dialog to the user to pick a launch shortcut and
+ * launch using that shortcut.
+ *
+ * @param resource the resource context
+ * @param shortcuts the list of applicable shortcuts
+ * @param mode the mode
+ * @param selection the current selection
+ * @param isShift is Shift pressed (use <code>false</code> if no support for
+ * Shift)
+ */
+ protected void showShortcutSelectionDialog(IResource resource, List<LaunchShortcutExtension> shortcuts, String mode, IStructuredSelection selection, boolean isShift) {
LaunchShortcutSelectionDialog dialog = new LaunchShortcutSelectionDialog(shortcuts, resource, mode);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if(result.length > 0) {
LaunchShortcutExtension method = (LaunchShortcutExtension) result[0];
if(method != null) {
- launchShortcut(selection, method, mode);
+ launchShortcut(selection, method, mode, isShift);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
index e89799379..75da0d6e4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.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
@@ -68,6 +68,8 @@ import org.eclipse.jface.wizard.ProgressMonitorPart;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ViewForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
@@ -78,6 +80,8 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
@@ -161,6 +165,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
private int fOpenMode = LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_LAST_LAUNCHED;
+ private boolean fIsShift = false;
+
/**
* dialog settings
*/
@@ -420,7 +426,20 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return composite;
}
-
+ /**
+ *
+ * @param buttonId
+ */
+ protected void launchButtonPressed(int buttonId) {
+ if (buttonId == ID_LAUNCH_BUTTON) {
+ handleLaunchPressed();
+ } else if (buttonId == ID_CLOSE_BUTTON) {
+ handleClosePressed();
+ } else {
+ super.buttonPressed(buttonId);
+ }
+ }
+
/**
* A launch configuration dialog overrides this method
@@ -434,6 +453,22 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
protected void createButtonsForButtonBar(Composite parent) {
Button button = createButton(parent, ID_LAUNCH_BUTTON, getLaunchButtonText(), true);
button.setEnabled(false);
+ Listener[] listeners = button.getListeners(SWT.Selection);
+ for (Listener listener : listeners) {
+ button.removeListener(SWT.Selection, listener);
+ }
+ listeners = button.getListeners(SWT.DefaultSelection);
+ for (Listener listener : listeners) {
+ button.removeListener(SWT.DefaultSelection, listener);
+ }
+
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ setShift(((event.stateMask & SWT.SHIFT) > 0) ? true : false);
+ handleLaunchPressed();
+ }
+ });
createButton(parent, ID_CLOSE_BUTTON, LaunchConfigurationsMessages.LaunchConfigurationDialog_Close_1, false);
}
@@ -490,6 +525,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
}
+ protected void setShift(boolean isShift) {
+ fIsShift = isShift;
+ }
/**
* Creates the launch configuration selection area of the dialog.
* This area displays a tree of launch configurations that the user
@@ -532,10 +570,20 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
fDoubleClickAction = new Action() {
@Override
public void run() {
+ runInternal(false);
+ }
+
+ @Override
+ public void runWithEvent(Event event) {
+ runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false);
+ }
+
+ void runInternal(boolean isShift) {
IStructuredSelection selection = (IStructuredSelection)fLaunchConfigurationView.getViewer().getSelection();
Object target = selection.getFirstElement();
if (target instanceof ILaunchConfiguration) {
if (fTabViewer.canLaunch() & fTabViewer.canLaunchWithModes() & !fTabViewer.hasDuplicateDelegates()) {
+ setShift(isShift);
handleLaunchPressed();
}
} else {
@@ -974,8 +1022,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
/**
- * Notification the 'launch' button has been pressed.
- * Save and launch.
+ * Notification the 'launch' button has been pressed. Save and launch.
+ *
*/
protected void handleLaunchPressed() {
ILaunchConfiguration config = fTabViewer.getOriginal();
@@ -984,8 +1032,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
if(config != null) {
close();
- DebugUITools.launch(config, getMode());
+ DebugUITools.launch(config, getMode(), fIsShift);
}
+ setShift(false);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
index ab8e23e1b..c342dcbd0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.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
@@ -429,9 +429,10 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
ILaunchShortcut shortcut = getDelegate();
if (shortcut != null) {
shortcut.launch(selection, mode);
- }
+ }
}
-
+
+
/**
* Returns the set of modes this shortcut supports.
*
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 5d7a2de44..a50e596d6 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
@@ -84,7 +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 from history (Press 'Shift' to toggle during launch)
+LaunchingPreferencePage_42=Termin&ate and Relaunch while launching (Press 'Shift' to toggle during launch from menu and toolbar)
ProcessPropertyPage_Command_Line__1=Co&mmand Line:
ProcessPropertyPage_0=Run-&at time:

Back to the top