diff options
author | Darin Wright | 2006-10-17 20:09:19 +0000 |
---|---|---|
committer | Darin Wright | 2006-10-17 20:09:19 +0000 |
commit | 5cb0ba6fa0ac0d19be3bea93b6021f627f08eeb2 (patch) | |
tree | cd20c21d99c4e748de54bf04116851171e82ae1e /org.eclipse.debug.ui | |
parent | 4fe8f08266ae4b63ac800d5af4c1c274fba9e8d4 (diff) | |
download | eclipse.platform.debug-5cb0ba6fa0ac0d19be3bea93b6021f627f08eeb2.tar.gz eclipse.platform.debug-5cb0ba6fa0ac0d19be3bea93b6021f627f08eeb2.tar.xz eclipse.platform.debug-5cb0ba6fa0ac0d19be3bea93b6021f627f08eeb2.zip |
Bug 157059 [launching] extensible launch options
Diffstat (limited to 'org.eclipse.debug.ui')
24 files changed, 1139 insertions, 108 deletions
diff --git a/org.eclipse.debug.ui/component.xml b/org.eclipse.debug.ui/component.xml index e84d1def6..5323d258b 100644 --- a/org.eclipse.debug.ui/component.xml +++ b/org.eclipse.debug.ui/component.xml @@ -10,6 +10,7 @@ <type name="AbstractDebugView" /> <type name="AbstractLaunchConfigurationTab" /> <type name="AbstractLaunchConfigurationTabGroup" /> + <type name="AbstractOptionLaunchConfigurationTab" /> <type name="BreakpointTypeCategory" /> <type name="CommonTab" subclass="false" /> <type name="DebugElementWorkbenchAdapter" /> diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index e9de2f449..cbe961e93 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -43,6 +43,8 @@ DebugLaunchGroup.label=Debu&g DebugLaunchGroup.title=Select or configure an application to debug DebugModelPresentationExtensionName=Debug Model Presentation +LaunchConfigurationTabsExtension.name=Launch Configuration Tabs + DebugPerspective.name=Debug DebugPerspective.description=This Debug perspective is designed to support application debugging. It incorporates views for displaying the debug stack, variables and breakpoint management. diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index b1488d345..539ba459b 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -18,6 +18,7 @@ <extension-point id="memoryRenderings" name="%memoryRenderingsExtensionPointName" schema="schema/memoryRenderings.exsd"/> <extension-point id="breakpointOrganizers" name="%BreakpointOrganizersName" schema="schema/breakpointOrganizers.exsd"/> <extension-point id="variableValueEditors" name="%VariableValueEditorsName" schema="schema/variableValueEditors.exsd"/> + <extension-point id="launchConfigurationTabs" name="%LaunchConfigurationTabsExtension.name" schema="schema/launchConfigurationTabs.exsd"/> <!-- Extensions --> <extension @@ -1314,7 +1315,13 @@ class="org.eclipse.debug.internal.ui.launchConfigurations.DeleteLaunchConfigurationStatusHandler" code="225" id="org.eclipse.debug.ui.deleteAssociatedLaunchConfigs" - plugin="org.eclipse.debug.core"/> + plugin="org.eclipse.debug.core"/> + <statusHandler + class="org.eclipse.debug.internal.ui.launchConfigurations.LaunchDelegateNotAvailableHandler" + code="226" + id="org.eclipse.debug.ui.statusHandler.launchDelegateNotAvailable" + plugin="org.eclipse.debug.core"> + </statusHandler> </extension> <extension point="org.eclipse.debug.ui.launchGroups"> diff --git a/org.eclipse.debug.ui/schema/launchConfigurationTabs.exsd b/org.eclipse.debug.ui/schema/launchConfigurationTabs.exsd new file mode 100644 index 000000000..94f030609 --- /dev/null +++ b/org.eclipse.debug.ui/schema/launchConfigurationTabs.exsd @@ -0,0 +1,137 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.debug.ui"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTabs" name="Launch Configuration Tabs"/> + </appInfo> + <documentation> + This extension point is to contribute launch configuration tabs (one or more) to an existing launch configuration tab group. + + +<p><strong>EXPERIMENTAL</strong>. This extension point has been added as +part of a work in progress. There is no guarantee that this API will +remain unchanged during the 3.3 release cycle. Please do not use this API +without consulting with the Platform/Debug team.</p> + </documentation> + </annotation> + + <element name="extension"> + <complexType> + <sequence minOccurs="1" maxOccurs="unbounded"> + <element ref="tab"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="tab"> + <annotation> + <documentation> + describes an individual launch configuration tab contribution + </documentation> + </annotation> + <complexType> + <attribute name="id" type="string" use="required"> + <annotation> + <documentation> + the unique id of this contributed tab + </documentation> + </annotation> + </attribute> + <attribute name="group" type="string" use="required"> + <annotation> + <documentation> + the string id of the <code>ILaunchConfigurationTabGroup</code> that this tab should be contributed to + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + a human readable name for this tab. The provided name does not have to be the name that appears on the tab itself, but should sufficiently describe the tab. + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + fully qualified name of the java class that implemnents <code>ILaunchConfigurationTab</code>. + </documentation> + <appInfo> + <meta.attribute kind="java" basedOn="org.eclipse.debug.ui.ILaunchConfigurationTab"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + 3.3 + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + The following example adds the tab "FooTab" to the local java application launch tab group. + +<p> +<pre> +<extension point="org.eclipse.debug.ui.launchConfigurationTabs"> + <tab + class="org.eclipse.jdt.debug.ui.launchConfigurations.FooTab" + group="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.localJavaApplication" + id="org.eclipse.jdt.debug.ui.fooTab" + name="Foo Tab"> + </tab> + </extension> +</pre> +</p> + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + The debug platform provides two abstract classes that clients should subclass when implementing launch tabs. See <code>AbstractLaunchConfigurationTab</code> and <code>AbstractOptionLaunchConfigurationTab</code> in package <code>org.eclipse.debug.ui</code>. + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + Copyright (c) 2006 IBM Corporation and others.<br> +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 +<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> + </documentation> + </annotation> + +</schema> diff --git a/org.eclipse.debug.ui/schema/launchConfigurationTypeImages.exsd b/org.eclipse.debug.ui/schema/launchConfigurationTypeImages.exsd index 74093b9bc..8417605e9 100644 --- a/org.eclipse.debug.ui/schema/launchConfigurationTypeImages.exsd +++ b/org.eclipse.debug.ui/schema/launchConfigurationTypeImages.exsd @@ -2,13 +2,13 @@ <!-- Schema file written by PDE --> <schema targetNamespace="org.eclipse.debug.ui"> <annotation> - <appInfo> - <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTypeImages" name="Launch Configuration Type Images"/> - </appInfo> - <documentation> - This extension point provides a way to associate an image with a launch configuration type. - </documentation> -</annotation> + <appInfo> + <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTypeImages" name="Launch Configuration Type Images"/> + </appInfo> + <documentation> + This extension point provides a way to associate an image with a launch configuration type. + </documentation> + </annotation> <element name="extension"> <complexType> @@ -22,24 +22,15 @@ </documentation> </annotation> </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - an optional identifier of the extension instance - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - an optional name of the extension instance - </documentation> - </annotation> - </attribute> </complexType> </element> <element name="launchConfigurationTypeImage"> + <annotation> + <documentation> + <p>Since 3.3, a launch configuration type image can be specified by a launch configuration type extension.</p> + </documentation> + </annotation> <complexType> <attribute name="id" type="string" use="required"> <annotation> @@ -51,7 +42,7 @@ <attribute name="configTypeID" type="string" use="required"> <annotation> <documentation> - specifies the fully qualified ID of a launch configuration type.(in 2.1, this attribute can also be specified using the "type" attribute, to be consistent with the launchConfigurationTabGroups extension point). + specifies the fully qualified ID of a launch configuration type.(in 2.1, this attribute can also be specified using the "type" attribute, to be consistent with the launchConfigurationTabGroups extension point). </documentation> </annotation> </attribute> @@ -77,24 +68,24 @@ <p> <pre> - <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> - <launchConfigurationTypeImage - id="com.example.FirstLaunchConfigurationTypeImage" - configTypeID="com.example.FirstLaunchConfigurationType" - icon="icons/FirstLaunchConfigurationType.gif"> - </launchConfigurationTypeImage> - </extension> + <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> + <launchConfigurationTypeImage + id="com.example.FirstLaunchConfigurationTypeImage" + configTypeID="com.example.FirstLaunchConfigurationType" + icon="icons/FirstLaunchConfigurationType.gif"> + </launchConfigurationTypeImage> + </extension> </pre> </p> </documentation> </annotation> - + <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> -Copyright (c) 2000, 2005 IBM Corporation and others.<br> + Copyright (c) 2000, 2005 IBM Corporation and others.<br> 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 diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java index e9bfc0a47..7f37a6c40 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java @@ -14,12 +14,17 @@ package org.eclipse.debug.internal.ui; import java.net.URL; +import java.util.HashSet; +import java.util.Set; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.internal.core.IConfigurationElementConstants; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; @@ -230,20 +235,37 @@ public class DebugPluginImages { declareRegistryImage(IInternalDebugUIConstants.IMG_EDIT_SRC_DIR_WIZ, WIZBAN + "editdir_wiz.png"); //$NON-NLS-1$ // launch configuration types - IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPE_IMAGES); - IConfigurationElement[] configElements= extensionPoint.getConfigurationElements(); - for (int i = 0; i < configElements.length; i++) { - IConfigurationElement configElement = configElements[i]; - ImageDescriptor descriptor = DebugUIPlugin.getImageDescriptor(configElement, ATTR_LAUNCH_CONFIG_TYPE_ICON); - if (descriptor == null) { - descriptor = ImageDescriptor.getMissingImageDescriptor(); + //try to get the images from the config types themselves, cache those that could not be found + ILaunchConfigurationType[] types = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); + String path = null; + Set missing = new HashSet(); + ImageDescriptor descriptor = null; + for (int i = 0; i < types.length; i++) { + path = types[i].getImageDescriptorPath(); + if(path == null) { + missing.add(types[i].getIdentifier()); + } + else { + descriptor = DebugUIPlugin.getImageDescriptor(types[i].getContributorName(), path); + imageRegistry.put(types[i].getIdentifier(), (descriptor == null ? ImageDescriptor.getMissingImageDescriptor() : descriptor)); + } + } + if(missing.size() > 0) { + //if we are missing some images try to find them in the deprecated extension point + IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPE_IMAGES); + IConfigurationElement[] configElements = extensionPoint.getConfigurationElements(); + String configTypeID = null; + for (int i = 0; i < configElements.length; i++) { + configTypeID = configElements[i].getAttribute(ATTR_LAUNCH_CONFIG_TYPE_ID); + if (configTypeID == null) { + // bug 12652 + configTypeID = configElements[i].getAttribute(IConfigurationElementConstants.TYPE); + } + if(missing.contains(configTypeID)) { + descriptor = DebugUIPlugin.getImageDescriptor(configElements[i], ATTR_LAUNCH_CONFIG_TYPE_ICON); + imageRegistry.put(configTypeID, (descriptor == null ? ImageDescriptor.getMissingImageDescriptor() : descriptor)); + } } - String configTypeID = configElement.getAttribute(ATTR_LAUNCH_CONFIG_TYPE_ID); - if (configTypeID == null) { - // bug 12652 - configTypeID = configElement.getAttribute("type"); //$NON-NLS-1$ - } - imageRegistry.put(configTypeID, descriptor); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index 1e574c4c7..e361db259 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -1037,6 +1037,26 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { } /** + * Returns an image descriptor for the icon referenced by the given path + * and contributor name, or <code>null</code> if none. + * + * @param name the name of the contributor + * @param path the path of the icon (from the configuration element) + * @return image descriptor or <code>null</code> + * @since 3.3 + */ + public static ImageDescriptor getImageDescriptor(String name, String path) { + Bundle bundle = Platform.getBundle(name); + if (path != null) { + URL iconURL = FileLocator.find(bundle , new Path(path), null); + if (iconURL != null) { + return ImageDescriptor.createFromURL(iconURL); + } + } + return null; + } + + /** * Performs extra filtering for launch configurations based on the prefs set on the * Launch Configurations page * @param config the config to filter 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 841afaf00..3dd5e0b4f 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 @@ -97,6 +97,7 @@ public interface IDebugHelpContextIds { public static final String MAX_DETAILS_LENGTH_DIALOG = PREFIX + "max_details_length_dialog_context"; //$NON-NLS-1$ public static final String SELECT_DEFAULT_WORKINGSET_DIALOG = PREFIX + "select_breakpoint_workingset_dialog"; //$NON-NLS-1$ public static final String DELETE_ASSOCIATED_LAUNCH_CONFIGS_DIALOG = PREFIX + "delete_associated_launch_configs_dialog"; //$NON-NLS-1$ + public static final String SELECT_LAUNCH_OPTIONS_DIALOG = PREFIX + "select_launch_options_dialog"; //$NON-NLS-1$ // Property pages public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java new file mode 100644 index 000000000..f84112dc8 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2006 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; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.debug.internal.core.IConfigurationElementConstants; +import org.eclipse.debug.ui.ILaunchConfigurationTab; + +/** + * Provides a proxy to a launchConfigurationTabs extension point + * + * <p> + * <strong>EXPERIMENTAL</strong>. This method has been added as + * part of a work in progress. There is no guarantee that this API will + * remain unchanged during the 3.3 release cycle. Please do not use this API + * without consulting with the Platform/Debug team. + * </p> + * @since 3.3 + */ +public final class LaunchConfigurationTabExtension { + + /** + * The configuration element backing this proxy + */ + IConfigurationElement fElement = null; + + /** + * Constructor + * @param element the <code>IConfigurationElement</code> for this proxy + */ + public LaunchConfigurationTabExtension(IConfigurationElement element) { + fElement = element; + } + + /** + * Returns the unique id ofthe tab + * @return the unique id of the tab + */ + public String getIdentifier() { + return fElement.getAttribute(IConfigurationElementConstants.ID); + } + + /** + * Returns the human readable name for the tab, not to be confused with the name that appears on the tab itself + * @return the name of the tab + */ + public String getName() { + return fElement.getAttribute(IConfigurationElementConstants.NAME); + } + + /** + * Returns the instantiated class of this tab + * @return the instantiated class of this tab + */ + public ILaunchConfigurationTab getTab() { + try { + Object object = fElement.createExecutableExtension(IConfigurationElementConstants.CLASS); + if(object instanceof ILaunchConfigurationTab) { + return (ILaunchConfigurationTab) object; + } + } catch (CoreException e) {DebugUIPlugin.log(e);} + return null; + } + + /** + * Returns the unique id of the <code>ILaunchConfigurationTabGroup</code> that this tab contributes to + * @return the id of the <code>ILaunchConfigurationTabGroup</code> this tab conributes to + */ + public String getTabGroupId() { + return fElement.getAttribute(IConfigurationElementConstants.GROUP); + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java index 4aa08f7fe..fbce2e742 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java @@ -36,7 +36,8 @@ import org.eclipse.ui.actions.SelectionListenerAction; public class EditLaunchConfigurationAction extends SelectionListenerAction { private ILaunchConfiguration fConfiguration = null; - private String fMode =null; + private String fMode = null; + private boolean fTerminated = false; /** * Constructs a new action. @@ -87,6 +88,7 @@ public class EditLaunchConfigurationAction extends SelectionListenerAction { } setLaunchConfiguration(configuration); setMode(launch.getLaunchMode()); + setIsTerminated(launch.isTerminated()); setText(MessageFormat.format(ActionMessages.EditLaunchConfigurationAction_1, new String[]{configuration.getName()})); ImageDescriptor descriptor = null; try { @@ -123,15 +125,30 @@ public class EditLaunchConfigurationAction extends SelectionListenerAction { return fMode; } + protected boolean isTerminated() { + return fTerminated; + } + + protected void setIsTerminated(boolean terminated) { + fTerminated = terminated; + } + /** * @see org.eclipse.jface.action.IAction#run() */ public void run() { ILaunchGroup group = DebugUITools.getLaunchGroup(getLaunchConfiguration(), getMode()); if (group != null) { - DebugUITools.openLaunchConfigurationDialog( - DebugUIPlugin.getShell(), getLaunchConfiguration(), - group.getIdentifier(), null); + if(isTerminated()) { + DebugUITools.openLaunchConfigurationDialog( + DebugUIPlugin.getShell(), getLaunchConfiguration(), + group.getIdentifier(), null); + } + else { + DebugUITools.openLaunchConfigurationEditDialog( + DebugUIPlugin.getShell(), getLaunchConfiguration(), + group.getIdentifier(), null); + } } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java index 000439503..9ad5b198b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java @@ -68,7 +68,7 @@ public class LaunchConfigurationDialog extends LaunchConfigurationPropertiesDial public void updateButtons() { // Launch button getTabViewer().refresh(); - getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch()); + getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions()); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationEditDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationEditDialog.java new file mode 100644 index 000000000..30c88872d --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationEditDialog.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2006 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.core.ILaunchConfiguration; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; + +/** + * This class is used to construct a launch configuraityon dialog used to edit a launch configuration and continue, + * not allowing a launch to occur. + * + * @since 3.3 + * + * EXPERIMENTAL + */ +public class LaunchConfigurationEditDialog extends LaunchConfigurationDialog { + + public LaunchConfigurationEditDialog(Shell shell, ILaunchConfiguration launchConfiguration, LaunchGroupExtension group) { + super(shell, launchConfiguration, group); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#getTitleAreaTitle() + */ + protected String getTitleAreaTitle() { + return LaunchConfigurationsMessages.LaunchConfigurationEditDialog_0; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) + */ + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, ID_CLOSE_BUTTON, LaunchConfigurationsMessages.LaunchConfigurationEditDialog_1, true); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#updateButtons() + */ + public void updateButtons() { + getTabViewer().refresh(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#getDialogSettingsSectionName() + */ + protected String getDialogSettingsSectionName() { + return IDebugUIConstants.PLUGIN_ID + ".LAUNCH_CONFIGURATION_EDIT_DIALOG_SECTION"; //$NON-NLS-1$ + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java index 5cd2c8b93..2d54570c6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java @@ -11,6 +11,7 @@ package org.eclipse.debug.internal.ui.launchConfigurations; +import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; @@ -22,10 +23,12 @@ import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.internal.core.IConfigurationElementConstants; import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.LaunchConfigurationTabExtension; import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.ILaunchConfigurationTab; import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; import com.ibm.icu.text.MessageFormat; @@ -49,6 +52,16 @@ public class LaunchConfigurationPresentationManager { * used to represent the default tab group (i.e. unspecified mode). */ private Hashtable fTabGroupExtensions; + + /** + * contributed tabs are stored by the tab group id that they contribute to. + * each entry is a futher <code>Hashtable</code> consisting of the corrseponding + * <code>LaunchConfigurationTabExtension</code> objects for each contributed tab stored by their + * id + * + * @since 3.3 + */ + private Hashtable fContributedTabs; /** * Constructs the singleton launch configuration presentation @@ -57,6 +70,7 @@ public class LaunchConfigurationPresentationManager { private LaunchConfigurationPresentationManager() { fgDefault = this; initializeTabGroupExtensions(); + initializeContributedTabExtensions(); } /** @@ -75,52 +89,69 @@ public class LaunchConfigurationPresentationManager { */ private void initializeTabGroupExtensions() { fTabGroupExtensions = new Hashtable(); - IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS); + IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS); IConfigurationElement[] groups = extensionPoint.getConfigurationElements(); + LaunchConfigurationTabGroupExtension group = null; + String typeId = null; + Map map = null; + Set modes = null; for (int i = 0; i < groups.length; i++) { - LaunchConfigurationTabGroupExtension group = new LaunchConfigurationTabGroupExtension(groups[i]); - String typeId = group.getTypeIdentifier(); - if (typeId == null) { - IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION, - MessageFormat.format("Launch configuration tab group extension {0} does not specify launch configuration type.", (new String[] {groups[i].getAttribute("id")})), null); //$NON-NLS-1$ //$NON-NLS-2$ - DebugUIPlugin.log(status); - } else { - // verify it references a valid launch configuration type - ILaunchConfigurationType lct = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId); - if (lct == null) { - IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION, - MessageFormat.format("Launch configuration tab group extension {0} refers to non-existent launch configuration type {1}.", (new String[] {groups[i].getAttribute("id"), typeId})), null); //$NON-NLS-1$ //$NON-NLS-2$ - DebugUIPlugin.log(status); - } + group = new LaunchConfigurationTabGroupExtension(groups[i]); + typeId = group.getTypeIdentifier(); + map = (Map)fTabGroupExtensions.get(typeId); + if (map == null) { + map = new Hashtable(); + fTabGroupExtensions.put(typeId, map); } - if (typeId != null) { - // get the map for the config type - Map map = (Map)fTabGroupExtensions.get(typeId); - if (map == null) { - map = new Hashtable(); - fTabGroupExtensions.put(typeId, map); - } - Set modes = group.getModes(); - if (modes == null) { - // default tabs - store with "*" - map.put("*", group); //$NON-NLS-1$ - } else { - // store per mode - Iterator iterator = modes.iterator(); - while (iterator.hasNext()) { - map.put(iterator.next(), group); - } + modes = group.getModes(); + if (modes == null) { + // default tabs - store with "*" + map.put("*", group); //$NON-NLS-1$ + } else { + // store per mode + Iterator iterator = modes.iterator(); + while (iterator.hasNext()) { + map.put(iterator.next(), group); } } } } /** + * This method is used to collect all of the contributed tabs defined by the <code>launchConfigurationTabs</code> + * extension point + * <p> + * <strong>EXPERIMENTAL</strong>. This method has been added as + * part of a work in progress. There is no guarantee that this API will + * remain unchanged during the 3.3 release cycle. Please do not use this API + * without consulting with the Platform/Debug team. + * </p> + * @since 3.3 + */ + private void initializeContributedTabExtensions() { + fContributedTabs = new Hashtable(); + IExtensionPoint epoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_TABS); + IConfigurationElement[] elements = epoint.getConfigurationElements(); + LaunchConfigurationTabExtension tab = null; + Hashtable element = null; + for(int i = 0; i < elements.length; i++) { + tab = new LaunchConfigurationTabExtension(elements[i]); + element = (Hashtable) fContributedTabs.get(tab.getTabGroupId()); + if(element == null) { + element = new Hashtable(); + element.put(tab.getIdentifier(), tab); + fContributedTabs.put(tab.getTabGroupId(), element); + } + element.put(tab.getIdentifier(), tab); + } + } + + /** * Returns the tab group for the given launch configuration type and mode. * * @param type launch configuration type * @param mode launch mode - * @return the tab group for the given type of launch configuration + * @return the tab group for the given type of launch configuration, or <code>null</code> if none * @exception CoreException if an exception occurs creating the group */ public ILaunchConfigurationTabGroup getTabGroup(ILaunchConfigurationType type, String mode) throws CoreException { @@ -130,7 +161,37 @@ public class LaunchConfigurationPresentationManager { MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3, (new String[] {type.getIdentifier()})), null); throw new CoreException(status); } - return ext.newTabGroup(); + return new LaunchConfigurationTabGroupWrapper(ext.newTabGroup(), ext.getIdentifier()); + } + + /** + * Returns the listing of <code>ILaunchConfigurationTab</code>s for the specified <code>ILaunchConfigurationTabGroup</code>. + * If no tabs are found for the specified id an empty array is returned, never <code>null</code> + * @param groupid + * @return the <code>ILaunchConfigurationTab</code>s for the specified <code>ILaunchConfigurationTabGroup</code> id, + * or an empty array if none are found + * + * <p> + * <strong>EXPERIMENTAL</strong>. This method has been added as + * part of a work in progress. There is no guarantee that this API will + * remain unchanged during the 3.3 release cycle. Please do not use this API + * without consulting with the Platform/Debug team. + * </p> + * @since 3.3 + */ + public ILaunchConfigurationTab[] createContributedTabs(String groupid) { + Hashtable tabs = (Hashtable) fContributedTabs.get(groupid); + ArrayList list = new ArrayList(); + if(tabs != null) { + LaunchConfigurationTabExtension ext = null; + for(Iterator iter = tabs.keySet().iterator(); iter.hasNext();) { + ext = (LaunchConfigurationTabExtension) tabs.get(iter.next()); + if(ext != null) { + list.add(ext.getTab()); + } + } + } + return (ILaunchConfigurationTab[]) list.toArray(new ILaunchConfigurationTab[list.size()]); } /** @@ -187,7 +248,7 @@ public class LaunchConfigurationPresentationManager { */ public String getDescription(ILaunchConfigurationType configType, String mode) { LaunchConfigurationPresentationManager manager = LaunchConfigurationPresentationManager.getDefault(); - LaunchConfigurationTabGroupExtension extension = manager.getExtension(configType.getAttribute("id"), mode); //$NON-NLS-1$ + LaunchConfigurationTabGroupExtension extension = manager.getExtension(configType.getAttribute(IConfigurationElementConstants.ID), mode); return (extension != null ? extension.getDescription(mode) : null); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java index cbb5635a6..fb630ae19 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java @@ -18,6 +18,7 @@ import java.util.Set; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.debug.internal.core.IConfigurationElementConstants; import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; @@ -84,15 +85,18 @@ public class LaunchConfigurationTabGroupExtension { */ protected Set getModes() { if (fModes == null) { - IConfigurationElement[] modes= getConfigurationElement().getChildren("launchMode"); //$NON-NLS-1$ + IConfigurationElement[] modes= getConfigurationElement().getChildren(IConfigurationElementConstants.LAUNCH_MODE); if (modes.length > 0) { fModes = new HashSet(modes.length); fPerspectives = new Hashtable(modes.length); + IConfigurationElement element = null; + String perspective = null; + String mode = null; for (int i = 0; i < modes.length; i++) { - IConfigurationElement element = modes[i]; - String mode = element.getAttribute("mode"); //$NON-NLS-1$ + element = modes[i]; + mode = element.getAttribute(IConfigurationElementConstants.MODE); fModes.add(mode); - String perspective = element.getAttribute("perspective"); //$NON-NLS-1$ + perspective = element.getAttribute(IConfigurationElementConstants.PERSPECTIVE); if (perspective != null) { fPerspectives.put(mode, perspective); } @@ -127,7 +131,7 @@ public class LaunchConfigurationTabGroupExtension { * tab group is associated with */ protected String getTypeIdentifier() { - return getConfigurationElement().getAttribute("type"); //$NON-NLS-1$ + return getConfigurationElement().getAttribute(IConfigurationElementConstants.TYPE); } /** @@ -139,7 +143,17 @@ public class LaunchConfigurationTabGroupExtension { * @since 2.1 */ protected String getHelpContextId() { - return getConfigurationElement().getAttribute("helpContextId"); //$NON-NLS-1$ + return getConfigurationElement().getAttribute(IConfigurationElementConstants.HELP_CONTEXT_ID); + } + + /** + * Returns the identifier of the tab group + * @return the id of the tab group + * + * @since 3.3 + */ + protected String getIdentifier() { + return getConfigurationElement().getAttribute(IConfigurationElementConstants.ID); } /** @@ -150,7 +164,7 @@ public class LaunchConfigurationTabGroupExtension { * the tab group */ public ILaunchConfigurationTabGroup newTabGroup() throws CoreException { - return (ILaunchConfigurationTabGroup)getConfigurationElement().createExecutableExtension("class"); //$NON-NLS-1$ + return (ILaunchConfigurationTabGroup)getConfigurationElement().createExecutableExtension(IConfigurationElementConstants.CLASS); } /** @@ -163,17 +177,18 @@ public class LaunchConfigurationTabGroupExtension { public String getDescription(String mode) { String description = null; - IConfigurationElement[] children = fConfig.getChildren("launchMode"); //$NON-NLS-1$ + IConfigurationElement[] children = fConfig.getChildren(IConfigurationElementConstants.LAUNCH_MODE); if (children!= null && children.length != 0) { + IConfigurationElement child = null; for (int i=0; i<children.length; i++) { - IConfigurationElement child = children[i]; + child = children[i]; if (child.getAttribute("mode").equals(mode)) { //$NON-NLS-1$ - description = child.getAttribute("description"); //$NON-NLS-1$ + description = child.getAttribute(IConfigurationElementConstants.DESCRIPTION); } } } if (description == null){ - description = fConfig.getAttribute("description"); //$NON-NLS-1$ + description = fConfig.getAttribute(IConfigurationElementConstants.DESCRIPTION); } if (description == null) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java index 26a9ad916..3bc87c9ca 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java @@ -11,6 +11,9 @@ package org.eclipse.debug.internal.ui.launchConfigurations; +import java.util.HashSet; +import java.util.Set; + import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -20,6 +23,7 @@ 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.internal.core.LaunchManager; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.SWTUtil; @@ -29,6 +33,7 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab; import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -69,7 +74,7 @@ import com.ibm.icu.text.MessageFormat; * buttons. */ public class LaunchConfigurationTabGroupViewer extends Viewer { - + private final String EMPTY_STRING = ""; //$NON-NLS-1$ /** * Containing launch dialog @@ -162,6 +167,13 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { private Composite fTabPlaceHolder = null; /** + * A link to allow users to select a valid set of launch options for the specified mode + * @since 3.3 + * EXPERIMENTAL + */ + private Link fOptionsLink = null; + + /** * A new composite replacing the perspectives tab * @since 3.2 */ @@ -239,7 +251,6 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { fTabPlaceHolder = new Composite(mainComp, SWT.NONE); fTabPlaceHolder.setLayout(new StackLayout()); gd = new GridData(GridData.FILL_BOTH); - gd.horizontalSpan = 2; fTabPlaceHolder.setLayoutData(gd); fGettingStarted = new Composite(fTabPlaceHolder, SWT.NONE); @@ -256,7 +267,7 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { fTabComposite.setLayout(layout); gd = new GridData(GridData.FILL_BOTH); fTabComposite.setLayoutData(gd); - + fNameLabel = new Label(fTabComposite, SWT.HORIZONTAL | SWT.LEFT); fNameLabel.setText(LaunchConfigurationsMessages.LaunchConfigurationDialog__Name__16); fNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); @@ -272,14 +283,46 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { createTabFolder(fTabComposite); - Composite buttonComp = new Composite(mainComp, SWT.NONE); + Composite blComp = SWTUtil.createComposite(mainComp, mainComp.getFont(), 2, 1, GridData.FILL_HORIZONTAL); + Composite linkComp = SWTUtil.createComposite(blComp, blComp.getFont(), 1, 1, GridData.FILL_HORIZONTAL); +// a link for launch options + fOptionsLink = new Link(linkComp, SWT.NONE); + fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13); + fOptionsLink.setFont(linkComp.getFont()); + gd = new GridData(GridData.BEGINNING); + fOptionsLink.setLayoutData(gd); + fOptionsLink.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + //collect the options available + SelectLaunchOptionsDialog sld = new SelectLaunchOptionsDialog(getShell(), + getLaunchConfigurationDialog().getMode(), + ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(fTabType.getIdentifier())); + if(sld.open() == IDialogConstants.OK_ID) { + //set the options to the config + Object[] res = sld.getResult(); + if(res != null) { + HashSet list = new HashSet(); + for(int i = 0; i < res.length; i++) { + list.add(res[i]); + } + ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); + wc.setOptions(list); + refresh(); + refreshStatus(); + } + } + } + public void widgetDefaultSelected(SelectionEvent e) {} + }); + fOptionsLink.setVisible(false); + + Composite buttonComp = new Composite(blComp, SWT.NONE); GridLayout buttonCompLayout = new GridLayout(); buttonCompLayout.numColumns = 2; buttonComp.setLayout(buttonCompLayout); gd = new GridData(GridData.HORIZONTAL_ALIGN_END); - gd.horizontalSpan = 2; buttonComp.setLayoutData(gd); - + fApplyButton = new Button(buttonComp, SWT.PUSH); fApplyButton.setText(LaunchConfigurationsMessages.LaunchConfigurationDialog__Apply_17); gd = new GridData(GridData.HORIZONTAL_ALIGN_END); @@ -305,6 +348,17 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { } /** + * Shows/hides the options link on the top of the viewer + * @param show true if the link should be visible, false otherwise + * @since 3.3 + * + * EXPERIMENTAL + */ + protected void showOptionsLink(boolean show) { + fOptionsLink.setVisible(show); + } + + /** * Simple method to create a spacer in the page * * @param composite the composite to add the spacer to @@ -485,7 +539,8 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { error = tabs[i].getErrorMessage() != null; item = fTabFolder.getItem(i); setTabIcon(item, error, tabs[i]); - } + } + fOptionsLink.setVisible(!canLaunchWithOptions()); } } @@ -961,10 +1016,43 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { return false; } } + return true; } /** + * Determines if the tab groups that is currently visible can launch with the currently selected + * set of options. + * + * <p> + * <strong>EXPERIMENTAL</strong>. This method has been added as + * part of a work in progress. There is no guarantee that this API will + * remain unchanged during the 3.3 release cycle. Please do not use this API + * without consulting with the Platform/Debug team. + * </p> + * @return + */ + public boolean canLaunchWithOptions() { + if(fInitializingTabs) { + return false; + } + //check if selected options exist and that the selected combination can be launched + try { + ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); + if(wc != null) { + Set options = wc.getOptions(); + if(options.size() > 0) { + return ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(fTabType.getIdentifier(), getLaunchConfigurationDialog().getMode(), options).length > 0; + } + } + } + catch (CoreException e) { + e.printStackTrace(); + } + return true; + } + + /** * Returns the current error message or <code>null</code> if none. */ public String getErrorMesssage() { @@ -991,6 +1079,7 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { return message; } + //EXPERIMENTAL ILaunchConfigurationTab[] allTabs = getTabs(); for (int i = 0; i < allTabs.length; i++) { ILaunchConfigurationTab tab = allTabs[i]; @@ -1012,6 +1101,19 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9; } } + if(!canLaunchWithOptions()) { + try { + Object o = getInput(); + String name = null; + if(o instanceof ILaunchConfiguration) { + ILaunchConfiguration lc = (ILaunchConfiguration) o; + name = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_14+lc.getName(); + } + return (name == null ? LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_10 : name) + LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_11+getLaunchConfigurationDialog().getMode()+LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_12+getWorkingCopy().getOptions().toString(); + } catch (CoreException e) { + e.printStackTrace(); + } + } return null; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java new file mode 100644 index 000000000..266941e0a --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java @@ -0,0 +1,128 @@ +package org.eclipse.debug.internal.ui.launchConfigurations; + +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; + +/** + * This class is used to wrap a contributed <code>ILaunchConfigurationTabGroup</code> with any contributed tabs + * for that group (from a <code>launchConfigurationTabs</code> extension point). + * + * <p> + * <strong>EXPERIMENTAL</strong>. This class has been added as + * part of a work in progress. There is no guarantee that this API will + * remain unchanged during the 3.3 release cycle. Please do not use this API + * without consulting with the Platform/Debug team. + * </p> + * @since 3.3 + */ +public class LaunchConfigurationTabGroupWrapper implements ILaunchConfigurationTabGroup { + + private ILaunchConfigurationTabGroup fGroup = null; + private String fGroupId = null; + private ILaunchConfigurationTab[] fContributedTabs = null; + + /** + * Constructor + * @param group the existing group to wrapper + */ + public LaunchConfigurationTabGroupWrapper(ILaunchConfigurationTabGroup group, String groupId) { + fGroup = group; + fGroupId = groupId; + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String) + */ + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + if(fGroup != null) { + fGroup.createTabs(dialog, mode); + } + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#dispose() + */ + public void dispose() { + if(fGroup != null) { + fGroup.dispose(); + } + if(fContributedTabs != null) { + for(int i = 0; i < fContributedTabs.length; i++) { + fContributedTabs[i].dispose(); + } + } + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#getTabs() + */ + public ILaunchConfigurationTab[] getTabs() { + if(fContributedTabs == null) { + fContributedTabs = LaunchConfigurationPresentationManager.getDefault().createContributedTabs(fGroupId); + } + ILaunchConfigurationTab[] grouptabs = fGroup.getTabs(); + ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[grouptabs.length + fContributedTabs.length]; + System.arraycopy(grouptabs, 0, tabs, 0, grouptabs.length); + System.arraycopy(fContributedTabs, 0, tabs, grouptabs.length, fContributedTabs.length); + return tabs; + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) + */ + public void initializeFrom(ILaunchConfiguration configuration) { + if(fGroup != null) { + fGroup.initializeFrom(configuration); + } + if(fContributedTabs == null) { + getTabs(); + } + for(int i = 0; i < fContributedTabs.length; i++) { + fContributedTabs[i].initializeFrom(configuration); + } + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#launched(org.eclipse.debug.core.ILaunch) + */ + public void launched(ILaunch launch) { + if(fGroup != null) { + fGroup.launched(launch); + } + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) + */ + public void performApply(ILaunchConfigurationWorkingCopy configuration) { + if(fGroup != null) { + fGroup.performApply(configuration); + if(fContributedTabs == null) { + getTabs(); + } + for(int i = 0; i < fContributedTabs.length; i++) { + fContributedTabs[i].performApply(configuration); + } + } + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) + */ + public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { + if(fGroup != null) { + fGroup.setDefaults(configuration); + if(fContributedTabs == null) { + getTabs(); + } + for(int i = 0; i < fContributedTabs.length; i++) { + fContributedTabs[i].setDefaults(configuration); + } + } + } + +} 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 f1f800c82..da037c38c 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 @@ -526,7 +526,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun IStructuredSelection selection = (IStructuredSelection)fLaunchConfigurationView.getViewer().getSelection(); Object target = selection.getFirstElement(); if (target instanceof ILaunchConfiguration) { - if (getTabViewer().canLaunch()) { + if (getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions()) { handleLaunchPressed(); } } else { @@ -1431,7 +1431,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun getDeleteAction().setEnabled(getDeleteAction().isEnabled()); getDuplicateAction().setEnabled(getDuplicateAction().isEnabled()); getTabViewer().refresh(); - getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch()); + getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions()); } /* (non-Javadoc) 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 32a9cce1a..53d710230 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 @@ -58,6 +58,10 @@ public class LaunchConfigurationsMessages extends NLS { public static String LaunchConfigurationDialog__Apply_17; public static String LaunchConfigurationDialog__Name__16; public static String LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20; + + public static String LaunchConfigurationEditDialog_0; + + public static String LaunchConfigurationEditDialog_1; public static String LaunchConfigurationTabGroupViewer_0; public static String LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8; public static String LaunchConfigurationDialog_Dele_te_14; @@ -89,7 +93,13 @@ public class LaunchConfigurationsMessages extends NLS { public static String LaunchConfigurationsDialog_Information_3; public static String LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3; + public static String LaunchConfigurationTabGroupViewer_14; + public static String LaunchConfigurationTabGroupViewer_9; + public static String LaunchConfigurationTabGroupViewer_10; + public static String LaunchConfigurationTabGroupViewer_11; + public static String LaunchConfigurationTabGroupViewer_12; + public static String LaunchConfigurationTabGroupViewer_13; public static String PerspectiveManager_Error_1; public static String PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4; public static String PerspectiveManager_Unable_to_switch_to_perspective___0__2; @@ -203,4 +213,16 @@ public class LaunchConfigurationsMessages extends NLS { public static String CollapseAllLaunchConfigurationAction_2; + public static String SelectLaunchOptionsDialog_0; + + public static String SelectLaunchOptionsDialog_1; + + public static String SelectLaunchOptionsDialog_2; + + public static String SelectLaunchOptionsDialog_3; + + public static String SelectLaunchOptionsDialog_4; + + public static String SelectLaunchOptionsDialog_5; + } 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 626889f5f..7a8502a43 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 @@ -44,6 +44,7 @@ EnvironmentTab_22=New Environment Variable LaunchConfigurationDialog__Apply_17=Appl&y LaunchConfigurationDialog__Name__16=&Name: LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20=An exception occurred while retrieving launch configurations + LaunchConfigurationTabGroupViewer_0={0} is an invalid character in launch configuration name {1} LaunchConfigurationTabGroupViewer_1=Configure launch settings from this dialog: LaunchConfigurationTabGroupViewer_2=- Press the 'New' button to create a configuration of the selected type. @@ -53,6 +54,12 @@ LaunchConfigurationTabGroupViewer_6=- Press the 'Duplicate' button to copy the s LaunchConfigurationTabGroupViewer_5=Configure launch perspective settings from the <a>Perspectives</a> preference page. LaunchConfigurationTabGroupViewer_8=- Press the 'Filter' button to configure filtering options. LaunchConfigurationTabGroupViewer_9=The file associated with this launch configuration is read-only and cannot be modified.\n +LaunchConfigurationTabGroupViewer_10=The selected configuration +LaunchConfigurationTabGroupViewer_11=\ cannot be launched with the set of options: +LaunchConfigurationTabGroupViewer_12=\ and +LaunchConfigurationTabGroupViewer_13=Select a supported set of <a>launch options</a> for this mode. +LaunchConfigurationTabGroupViewer_14=Configuration + LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations LaunchConfigurationDialog_Dele_te_14=De&lete LaunchConfigurationDialog_Discard_changes__38=Discard changes? @@ -66,6 +73,8 @@ LaunchConfigurationDialog_Launch_Configurations_18=Launch Configurations LaunchConfigurationDialog_Name_required_for_launch_configuration_11=Name required for launch configuration LaunchConfigurationDialog_Ne_w_13=Ne&w LaunchConfigurationDialog_No_33=No +LaunchConfigurationEditDialog_0=Modify configuration and continue. +LaunchConfigurationEditDialog_1=Continue LaunchConfigurationDialog_Ready_to_launch_2=Ready to launch LaunchConfigurationDialog_Save_changes__31=Save changes? LaunchConfigurationDialog_The_configuration___29=The configuration "{0}" has unsaved changes. Do you wish to save them? @@ -97,7 +106,7 @@ LaunchShortcutExtension_Unable_to_use_launch_shortcut_5=Unable to use launch sho LaunchConfigurationPropertiesDialog_Edit_launch_configuration_properties_1=Edit launch configuration properties LaunchConfigurationPropertiesDialog_Properties_for__0__2=Properties for {0} -LaunchConfigurationDialog_Modify_attributes_and_launch__1=Modify attributes and launch. +LaunchConfigurationDialog_Modify_attributes_and_launch__1=Edit configuration and launch. LaunchConfigurationTabGroupViewer_No_tabs_defined_for_launch_configuration_type__0__1=No tabs defined for launch configuration type {0} @@ -163,3 +172,9 @@ FilterDropDownMenuCreator_4=Apply Window &Working Set(s) CollapseAllLaunchConfigurationAction_0=Collapse All CollapseAllLaunchConfigurationAction_1=Collapses all expanded launch configurations. CollapseAllLaunchConfigurationAction_2=This action collapses all of the launch configurations currently visible and expanded. +SelectLaunchOptionsDialog_0=\ (with no options) +SelectLaunchOptionsDialog_1=: +SelectLaunchOptionsDialog_2=A plugin that once provided the ability to launch the saved set of launch options for the current launch configuration is no longer available. As such, you must select a valid set of launch options that can be launched +SelectLaunchOptionsDialog_3=Select Launch Options +SelectLaunchOptionsDialog_4=&Select a supported options combination: +SelectLaunchOptionsDialog_5=\ for diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java new file mode 100644 index 000000000..b099d8ff4 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2006 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.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.IStatusHandler; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.ui.DebugUITools; + +/** + * This class provides a mechanism to prompt users in the UI thread from debug.core in the case where + * a launch delegate has gone missing and a new choice needs to be made in the launch dialog. + * + * @since 3.3 + * + * EXPERIMENTAL + */ +public class LaunchDelegateNotAvailableHandler implements IStatusHandler { + + /** + * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object) + */ + public Object handleStatus(IStatus status, Object source) throws CoreException { + if(source instanceof Object[]) { + Object[] infos = (Object[]) source; + if(infos.length == 2) { + ILaunchConfiguration config = (ILaunchConfiguration) infos[0]; + String mode = (String) infos[1]; + DebugUITools.openLaunchConfigurationEditDialog(DebugUIPlugin.getShell(), + config, + DebugUITools.getLaunchGroup(config, mode).getIdentifier(), + null); + } + } + return Status.OK_STATUS; + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchOptionsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchOptionsDialog.java new file mode 100644 index 000000000..c025d932f --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchOptionsDialog.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * Copyright (c) 2006 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 java.util.Set; + +import org.eclipse.debug.internal.core.LaunchDelegate; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.IDebugHelpContextIds; +import org.eclipse.debug.internal.ui.SWTUtil; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.SelectionDialog; + +/** + * This class provides a dialog to present the user with a list of of viable launch options in the event + * the plugin that provides either a launch option or a contributed launch delegate is no longer available. + * The user can select one of the launch mode/option configuration sform this dialog and repair the option + * configuration state of the the current launch configuration + * + * @since 3.3 + * + * EXPERIMENTAL + */ +public class SelectLaunchOptionsDialog extends SelectionDialog { + + /** + * Builds labels for list control of the form: Mode + (no options) | [optionslist] + */ + class OptionsLabelProvider implements ILabelProvider { + public Image getImage(Object element) {return null;} + public String getText(Object element) { + LaunchDelegate del = (LaunchDelegate) element; + Set set = del.getOptions(); + return del.getName() + LaunchConfigurationsMessages.SelectLaunchOptionsDialog_5 + fMode + (set.isEmpty() ? LaunchConfigurationsMessages.SelectLaunchOptionsDialog_0 : LaunchConfigurationsMessages.SelectLaunchOptionsDialog_1 + set); + } + public void addListener(ILabelProviderListener listener) {} + public void dispose() {} + public boolean isLabelProperty(Object element, String property) {return false;} + public void removeListener(ILabelProviderListener listener) {} + } + + private static final String SETTINGS_ID = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_OPTIONS_DIALOG"; //$NON-NLS-1$ + + private LaunchDelegate[] fDelegates = null; + private String fMode = null; + private Object[] fResult = null; + private CheckboxTableViewer fTableViewer = null; + private Table fTable = null; + + /** + * Constructor + * @param parentShell the parent shell + * @param message the message for the dialog + * @param options the listing of arrays of options (each entry in the list must be an <code>Set</code> of options) + */ + public SelectLaunchOptionsDialog(Shell parentShell, String mode, LaunchDelegate[] delegates) { + super(parentShell); + super.setMessage(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_2); + super.setTitle(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_3); + setShellStyle(getShellStyle() | SWT.RESIZE); + fDelegates = delegates; + fMode = mode; + } + + /** + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected Control createDialogArea(Composite parent) { + initializeDialogUnits(parent); + Composite comp = (Composite) super.createDialogArea(parent); + SWTUtil.createLabel(comp, LaunchConfigurationsMessages.SelectLaunchOptionsDialog_4, 1); + fTable = new Table(comp, SWT.BORDER | SWT.SINGLE | SWT.CHECK); + fTable.setLayoutData(new GridData(GridData.FILL_BOTH)); + fTableViewer = new CheckboxTableViewer(fTable); + fTableViewer.setLabelProvider(new OptionsLabelProvider()); + fTableViewer.setContentProvider(new ArrayContentProvider()); + fTableViewer.setInput(fDelegates); + fTableViewer.addCheckStateListener(new ICheckStateListener() { + public void checkStateChanged(CheckStateChangedEvent event) { + fTableViewer.setAllChecked(false); + fTableViewer.setChecked(event.getElement(), true); + } + }); + Dialog.applyDialogFont(comp); + PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_OPTIONS_DIALOG); + return comp; + } + + /** + * @see org.eclipse.ui.dialogs.SelectionDialog#getResult() + */ + public Object[] getResult() { + return fResult; + } + + /** + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + protected void okPressed() { + Object[] o = fTableViewer.getCheckedElements(); + if(o.length > 0) { + fResult = ((LaunchDelegate)o[0]).getOptions().toArray(); + } + super.okPressed(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings() + */ + protected IDialogSettings getDialogBoundsSettings() { + IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(SETTINGS_ID); + if (section == null) { + section = settings.addNewSection(SETTINGS_ID); + } + 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(350, 400); + } + } + return new Point(350, 400); + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractOptionLaunchConfigurationTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractOptionLaunchConfigurationTab.java new file mode 100644 index 000000000..7256fb953 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractOptionLaunchConfigurationTab.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2006 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.ui; + +import java.util.Set; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationListener; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.swt.widgets.Composite; + +/** + * Common function for a launch tab that edits a launch option. + * <p> + * This class is intended to be subclassed by clients contributing launch tabs + * that modify launch options. + * </p> + * @since 3.3 + * + * <p> + * <strong>EXPERIMENTAL</strong>. This class has been added as + * part of a work in progress. There is no guarantee that this API will + * remain unchanged during the 3.3 release cycle. Please do not use this API + * without consulting with the Platform/Debug team. + * </p> + */ +public abstract class AbstractOptionLaunchConfigurationTab extends AbstractLaunchConfigurationTab implements ILaunchConfigurationListener { + + /** + * Returns the set of the options this tab modifies. + * + * @return set of the options this tab modifies + */ + public abstract Set getOptions(); + + /** + * Updates the controls associated with this tab's launch options. + * Called when a launch configuration has changed, which can occur when a tab + * is de-activated, or if an option is modified outside of the tabs' control. + * + * @param options the current set of options specified by the working copy being edited + */ + public abstract void updateOptionControls(Set options); + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) + */ + public void createControl(Composite parent) { + DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this); + } + + /** + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose() + */ + public void dispose() { + DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this); + super.dispose(); + } + + /** + * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration) + */ + public void launchConfigurationAdded(ILaunchConfiguration configuration) {} + + /** + * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration) + */ + public void launchConfigurationRemoved(ILaunchConfiguration configuration) {} + + /** + * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration) + */ + public void launchConfigurationChanged(ILaunchConfiguration configuration) { + try { + updateOptionControls(configuration.getOptions()); + } + catch (CoreException e) {DebugUIPlugin.log(e);} + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java index f7e5bfe97..bcbef008a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java @@ -35,6 +35,7 @@ import org.eclipse.debug.internal.ui.DelegatingModelPresentation; import org.eclipse.debug.internal.ui.LazyModelPresentation; import org.eclipse.debug.internal.ui.contexts.DebugContextManager; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationEditDialog; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog; @@ -458,7 +459,39 @@ public class DebugUITools { return Window.CANCEL; } - + + /** + * Open the launch configuration dialog on the specified launch + * configuration. The dialog displays the tabs for a single configuration + * only (a tree of launch configuration is not displayed) + * <p> + * If a status is specified, a status handler is consulted to handle the + * status. The status handler is passed the instance of the launch + * configuration dialog that is opened. This gives the status handler an + * opportunity to perform error handling/initialization as required. + * </p> + * @param shell the parent shell for the launch configuration dialog + * @param configuration the configuration to display + * @param groupIdentifier group identifier of the launch group the launch configuration + * belongs to + * @param status the status to display, or <code>null</code> if none + * @return the return code from opening the launch configuration dialog - + * one of <code>Window.OK</code> or <code>Window.CANCEL</code> + * + * @since 3.3 + * + * EXPERIMENTAL + */ + public static int openLaunchConfigurationEditDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status) { + LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier); + if (group != null) { + LaunchConfigurationEditDialog dialog = new LaunchConfigurationEditDialog(shell, configuration, group); + dialog.setInitialStatus(status); + return dialog.open(); + } + return Window.CANCEL; + } + /** * Saves all dirty editors and builds the workspace according to current * preference settings, and returns whether a launch should proceed. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java index bd04c1adb..6e18e9b99 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java @@ -927,6 +927,20 @@ public interface IDebugUIConstants { public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS= "launchConfigurationTabGroups"; //$NON-NLS-1$ /** + * Contributed Launch Configuration Tab extension point identifier + * (value <code>"launchConfigurationTabs"</code>). + * <p> + * <strong>EXPERIMENTAL</strong>. This constant has been added as + * part of a work in progress. There is no guarantee that this API will + * remain unchanged during the 3.3 release cycle. Please do not use this API + * without consulting with the Platform/Debug team. + * </p> + * + * @since 3.3 + */ + public static final String EXTENSION_POINT_LAUNCH_TABS = "launchConfigurationTabs"; //$NON-NLS-1$ + + /** * Launch shortcuts extension point identifier * (value <code>"launchShortcuts"</code>). * |