diff options
author | Michael Rennie | 2010-02-03 18:51:38 +0000 |
---|---|---|
committer | Michael Rennie | 2010-02-03 18:51:38 +0000 |
commit | d28b01272633d6ed8eac528fab563941e90a2a6d (patch) | |
tree | 35c479469718d58fa45f4deacb43dd529d8e55d3 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations | |
parent | ee6cd0cd6b64b5bf1eca5139d2f7dab7423155e3 (diff) | |
download | eclipse.platform.debug-d28b01272633d6ed8eac528fab563941e90a2a6d.tar.gz eclipse.platform.debug-d28b01272633d6ed8eac528fab563941e90a2a6d.tar.xz eclipse.platform.debug-d28b01272633d6ed8eac528fab563941e90a2a6d.zip |
Bug 295022 - [launching] Ctrl+click on Debug or Run toolbar button should open launch config shown in tooltip
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations')
2 files changed, 71 insertions, 41 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java index 0da0427f2..437ce2b30 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -13,7 +13,6 @@ package org.eclipse.debug.internal.ui.launchConfigurations; import java.util.Set; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; @@ -21,12 +20,8 @@ import org.eclipse.debug.core.ILaunchConfigurationListener; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.ILaunchConfigurationDialog; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -44,12 +39,6 @@ public class LaunchConfigurationPropertiesDialog extends LaunchConfigurationsDia * The launch configuration to display */ private ILaunchConfiguration fLaunchConfiguration; - - /** - * Whether to set default values when opened - * @since 3.3 - */ - private boolean fSetDefaultOnOpen = false; /** * Constructs a new launch configuration dialog on the given @@ -106,22 +95,9 @@ public class LaunchConfigurationPropertiesDialog extends LaunchConfigurationsDia */ protected void initializeContent() { ILaunchConfiguration launchConfiguration = getLaunchConfiguration(); - if (fSetDefaultOnOpen && launchConfiguration instanceof ILaunchConfigurationWorkingCopy) { + if (shouldSetDefaultsOnOpen() && launchConfiguration instanceof ILaunchConfigurationWorkingCopy) { ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) launchConfiguration; - try { - ILaunchConfigurationTabGroup tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(wc, getMode()); - // this only works because this action is only present when the dialog is open - ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog(); - tabGroup.createTabs(dialog, dialog.getMode()); - ILaunchConfigurationTab[] tabs = tabGroup.getTabs(); - for (int i = 0; i < tabs.length; i++) { - tabs[i].setLaunchConfigurationDialog(dialog); - } - tabGroup.setDefaults(wc); - tabGroup.dispose(); - } catch (CoreException e) { - DebugUIPlugin.log(e.getStatus()); - } + doSetDefaults(wc); } getTabViewer().setInput(launchConfiguration); IStatus status = getInitialStatus(); @@ -255,16 +231,4 @@ public class LaunchConfigurationPropertiesDialog extends LaunchConfigurationsDia * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration) */ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {} - - /** - * Sets whether the tab group should set default values in the launch configuration - * when the dialog is opened. If this method is not called, default values are not - * set. - * - * @param setDefaults whether to set default values - */ - public void setDefaultsOnOpen(boolean setDefaults) { - fSetDefaultOnOpen = setDefaults; - } - } 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 5bced3e76..973925b11 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, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -24,9 +24,11 @@ import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.IStatusHandler; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; +import org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy; import org.eclipse.debug.internal.core.LaunchManager; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; @@ -227,6 +229,12 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun protected Set fReservedNames = null; /** + * Whether to set default values when opened + * @since 3.6 + */ + private boolean fSetDefaultOnOpen = false; + + /** * Constructs a new launch configuration dialog on the given * parent shell. * @@ -238,7 +246,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun setShellStyle(getShellStyle() | SWT.RESIZE); setLaunchGroup(group); } - + /** * Adds content to the dialog area * @@ -1019,10 +1027,45 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun } /** + * Sets the default values for the given {@link LaunchConfigurationWorkingCopy} + * @param wc + * @since 3.6 + */ + protected void doSetDefaults(ILaunchConfigurationWorkingCopy wc) { + try { + ILaunchConfigurationTabGroup tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(wc, getMode()); + // this only works because this action is only present when the dialog is open + ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog(); + tabGroup.createTabs(dialog, dialog.getMode()); + ILaunchConfigurationTab[] tabs = tabGroup.getTabs(); + for (int i = 0; i < tabs.length; i++) { + tabs[i].setLaunchConfigurationDialog(dialog); + } + tabGroup.setDefaults(wc); + tabGroup.dispose(); + } catch (CoreException e) { + DebugUIPlugin.log(e.getStatus()); + } + } + + /** * Performs initialization of the content by setting the initial tree selection */ protected void initializeContent() { + if(fSetDefaultOnOpen) { + try { + Object o = fInitialSelection.getFirstElement(); + if(o instanceof ILaunchConfigurationWorkingCopy) { + ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) o; + doSetDefaults(wc); + setInitialSelection(new StructuredSelection(wc.doSave())); + } + } catch (CoreException e) { + DebugUIPlugin.log(e); + } + } doInitialTreeSelection(); + IStatus status = getInitialStatus(); if (status != null) { handleStatus(status); @@ -1291,6 +1334,29 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun } /** + * Sets whether the tab group should set default values in the launch configuration + * when the dialog is opened. If this method is not called, default values are not + * set. + * + * @param setDefaults whether to set default values + * @since 3.6 + */ + public void setDefaultsOnOpen(boolean setDefaults) { + fSetDefaultOnOpen = setDefaults; + } + + /** + * Returns if the dialog is supposed to be setting the default values for + * the initial configuration when it opens + * + * @return <code>true</code> if the defaults should be set on open, <code>false</code> otherwise + * @since 3.6 + */ + public boolean shouldSetDefaultsOnOpen() { + return fSetDefaultOnOpen; + } + + /** * Sets the launch group to display. * * @param group launch group |