diff options
author | Darin Wright | 2007-05-07 17:12:11 +0000 |
---|---|---|
committer | Darin Wright | 2007-05-07 17:12:11 +0000 |
commit | 01ad835e4247fa89c626188aa0efc740a92420a6 (patch) | |
tree | c7f489f77cec7c1ca97776b3b2d4bee4c6272ca8 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal | |
parent | 74d4af174a20ccb5a186da654b7f7974e34b34f2 (diff) | |
download | eclipse.platform.debug-01ad835e4247fa89c626188aa0efc740a92420a6.tar.gz eclipse.platform.debug-01ad835e4247fa89c626188aa0efc740a92420a6.tar.xz eclipse.platform.debug-01ad835e4247fa89c626188aa0efc740a92420a6.zip |
Bug 184867 Ok is the new Cancel
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal')
7 files changed, 112 insertions, 12 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java index ee5ddc30d..d95b12694 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java @@ -113,6 +113,7 @@ public interface IDebugHelpContextIds { public static final String SELECT_LAUNCHERS_DIALOG = PREFIX + "select_launchers_dialog"; //$NON-NLS-1$ public static final String SELECT_RESOURCES_TO_SAVE_DIALOG = PREFIX + "select_resources_to_save_dialog"; //$NON-NLS-1$ public static final String SELECT_LAUNCH_METHOD_DIALOG = PREFIX + "select_launch_method_dialog"; //$NON-NLS-1$ + public static final String SELECT_LAUNCH_CONFIGURATION_DIALOG = PREFIX + "select_launch_configuration_dialog"; //$NON-NLS-1$ public static final String SELECT_DIRECTORY_SOURCE_CONTAINER_DIALOG = PREFIX + "select_directory_source_container_dialog"; //$NON-NLS-1$ // Property pages diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java index 77c2c9337..74c6bf37d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java @@ -28,8 +28,6 @@ public class ContextMessages extends NLS { public static String ContextRunner_15; public static String ContextRunner_16; public static String ContextRunner_7; - public static String ContextRunner_8; - public static String ContextRunner_9; public static String LaunchingResourceManager_0; static { // initialize resource bundle diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties index d358fc9bf..08378e02c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties @@ -10,8 +10,6 @@ ############################################################################### ContextRunner_0=Unable To Launch ContextRunner_7=The selection cannot be launched, and there are no recent launches. -ContextRunner_8=&Select a configuration to launch: -ContextRunner_9=Select Configuration ContextRunner_10=There is no way to launch {0}\n\nWould you like to launch its project instead ({1})? ContextRunner_11=Launch Project? ContextRunner_12=&Always launch project if resource cannot be launched 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 2dcd97634..c55a9a2ae 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 @@ -21,9 +21,9 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.DefaultLabelProvider; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationSelectionDialog; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutSelectionDialog; import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; @@ -32,11 +32,9 @@ import org.eclipse.debug.ui.ILaunchGroup; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.window.Window; import org.eclipse.ui.activities.WorkbenchActivityHelper; -import org.eclipse.ui.dialogs.ListDialog; import com.ibm.icu.text.MessageFormat; @@ -211,11 +209,7 @@ public final class ContextRunner { * @return true if something was launched, false otherwise */ protected boolean showConfigurationSelectionDialog(List configurations, String mode) { - ListDialog lsd = new ListDialog(DebugUIPlugin.getShell()); - lsd.setContentProvider(new ArrayContentProvider()); - lsd.setLabelProvider(new DefaultLabelProvider()); - lsd.setMessage(ContextMessages.ContextRunner_8); - lsd.setTitle(ContextMessages.ContextRunner_9); + LaunchConfigurationSelectionDialog lsd = new LaunchConfigurationSelectionDialog(DebugUIPlugin.getShell()); lsd.setInput(configurations); if(lsd.open() == IDialogConstants.OK_ID) { ILaunchConfiguration config = (ILaunchConfiguration) lsd.getResult()[0]; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationSelectionDialog.java new file mode 100644 index 000000000..1b223b96c --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationSelectionDialog.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2007 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.debug.internal.ui.launchConfigurations; + +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.DefaultLabelProvider; +import org.eclipse.debug.internal.ui.IDebugHelpContextIds; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.ListDialog; + +/** + * This class provides a dialog for selecting a given launch configuration from a listing + * + * @since 3.3.0 + * CONTEXTLAUNCHING + */ +public class LaunchConfigurationSelectionDialog extends ListDialog { + + private static final String DIALOG_SETTINGS = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_CONFIGURATION_DIALOG"; //$NON-NLS-1$; + + /** + * Constructor + * @param parent + */ + public LaunchConfigurationSelectionDialog(Shell parent) { + super(parent); + setTitle(LaunchConfigurationsMessages.LaunchConfigurationSelectionDialog_0); + setMessage(LaunchConfigurationsMessages.LaunchConfigurationSelectionDialog_1); + setLabelProvider(new DefaultLabelProvider()); + setContentProvider(new ArrayContentProvider()); + } + + /** + * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite) + */ + protected Control createContents(Composite parent) { + Composite comp = (Composite) super.createContents(parent); + PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_CONFIGURATION_DIALOG); + return comp; + } + + /** + * @see org.eclipse.ui.dialogs.ListDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) + */ + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getOkButton().setEnabled(false); + getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + getOkButton().setEnabled(!event.getSelection().isEmpty()); + } + }); + } + + /** + * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings() + */ + protected IDialogSettings getDialogBoundsSettings() { + IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(DIALOG_SETTINGS); + if (section == null) { + section = settings.addNewSection(DIALOG_SETTINGS); + } + return section; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#getInitialSize() + */ + protected Point getInitialSize() { + IDialogSettings settings = getDialogBoundsSettings(); + if(settings != null) { + try { + int width = settings.getInt("DIALOG_WIDTH"); //$NON-NLS-1$ + int height = settings.getInt("DIALOG_HEIGHT"); //$NON-NLS-1$ + if(width > 0 & height > 0) { + return new Point(width, height); + } + } + catch (NumberFormatException nfe) { + return new Point(450, 450); + } + } + return new Point(450, 450); + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java index 74d9958a8..18f9438f4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java @@ -80,6 +80,8 @@ public class LaunchConfigurationsMessages extends NLS { public static String LaunchConfigurationsDialog_Error_1; public static String LaunchConfigurationsDialog_Warning_2; public static String LaunchConfigurationsDialog_Information_3; + public static String LaunchConfigurationSelectionDialog_0; + public static String LaunchConfigurationSelectionDialog_1; public static String LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3; public static String LaunchConfigurationTabGroupViewer_14; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties index b2900fd9a..a78e339a2 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties @@ -93,6 +93,8 @@ LaunchConfigurationsDialog_0=New launch configuration LaunchConfigurationsDialog_1=Delete selected launch configuration(s) LaunchConfigurationsDialog_4=Filter launch configurations... LaunchConfigurationsDialog_5=Duplicates the currently selected launch configuration +LaunchConfigurationSelectionDialog_0=Select Configuration +LaunchConfigurationSelectionDialog_1=&Select a configuration to launch: LaunchConfigurationView_0=Filter matched {0} of {1} items LaunchConfigurationsDialog_c_ancel=Cancel LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3=No tab group defined for launch configuration type {0} |