Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 54562 Details for
Bug 157059
[launching] extensible launch options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
157059.11.patch (text/plain), 95.84 KB, created by
Michael Rennie
on 2006-11-27 12:42:48 EST
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2006-11-27 12:42:48 EST
Size:
95.84 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.doc.user >Index: contexts_Debugger.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.doc.user/contexts_Debugger.xml,v >retrieving revision 1.91 >diff -u -r1.91 contexts_Debugger.xml >--- contexts_Debugger.xml 26 Oct 2006 20:12:13 -0000 1.91 >+++ contexts_Debugger.xml 27 Nov 2006 17:40:44 -0000 >@@ -595,6 +595,10 @@ > <topic label="Java application launch configuration" href=" tasks\tasks-java-local-configuration.htm"/> > <topic label="Source Attachments" href="reference/ref-124.htm"/> > </context> >+ <context id="launch_configuration_dialog_launchers_tab" > >+ <description>This tab allows you to a specific launchers to use with the selected launch configuration in the event ther is more than one available.</description> >+ <topic label="Java application launch configuration" href=" tasks\tasks-java-local-configuration.htm"/> >+ </context> > > <!-- > Memory View >#P org.eclipse.debug.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.xml,v >retrieving revision 1.381 >diff -u -r1.381 plugin.xml >--- plugin.xml 17 Nov 2006 21:21:20 -0000 1.381 >+++ plugin.xml 27 Nov 2006 17:40:45 -0000 >@@ -147,7 +147,7 @@ > </page> > <page > category="org.eclipse.debug.ui.LaunchingPreferencePage" >- class="org.eclipse.debug.internal.ui.preferences.LaunchDelegatesPreferencePage" >+ class="org.eclipse.debug.internal.ui.preferences.LaunchersPreferencePage" > id="org.eclipse.debug.ui.LaunchDelegatesPreferencePage" > name="%LaunchDelegatesPreferencePage.name"> > <keywordReference >@@ -1452,6 +1452,18 @@ > </or> > </enabledWhen> > </page> >+ <page >+ class="org.eclipse.debug.internal.ui.launchConfigurations.PreferredLaunchersPropertyPage" >+ id="org.eclipse.debug.ui.launchConfigurationPropertyPage" >+ name="%preferredLaunchersPropertyPage.name"> >+ <enabledWhen> >+ <and> >+ <instanceof >+ value="org.eclipse.debug.core.ILaunchConfiguration"> >+ </instanceof> >+ </and> >+ </enabledWhen> >+ </page> > </extension> > <!-- commands and their bindings > NOTE: >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.properties,v >retrieving revision 1.222 >diff -u -r1.222 plugin.properties >--- plugin.properties 17 Nov 2006 21:21:20 -0000 1.222 >+++ plugin.properties 27 Nov 2006 17:40:45 -0000 >@@ -27,6 +27,8 @@ > BreakpointOrganizersName=Breakpoint Organizers > VariableValueEditorsName=Variable Value Editors > >+preferredLaunchersPropertyPage.name=Preferred Launchers >+ > BreakpointActionSet.label=Breakpoints > CollapseAll.label=Collapse All > CollapseAll.tooltip= Collapse All >Index: ui/org/eclipse/debug/internal/ui/SWTUtil.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java,v >retrieving revision 1.24 >diff -u -r1.24 SWTUtil.java >--- ui/org/eclipse/debug/internal/ui/SWTUtil.java 16 Nov 2006 19:03:11 -0000 1.24 >+++ ui/org/eclipse/debug/internal/ui/SWTUtil.java 27 Nov 2006 17:40:45 -0000 >@@ -15,6 +15,7 @@ > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.resource.JFaceResources; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.graphics.Font; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.layout.GridData; >@@ -59,6 +60,30 @@ > } > } > >+ /** >+ * Creates a check box button using the parents' font >+ * @param parent the parent to add the button to >+ * @param label the label for the button >+ * @param image the image for the button >+ * @param checked the initial checked state of the button >+ * @return a new checked button set to the initial checked state >+ * @since 3.3 >+ */ >+ public static Button createCheckButton(Composite parent, String label, Image image, boolean checked) { >+ Button button = new Button(parent, SWT.CHECK); >+ button.setFont(parent.getFont()); >+ button.setSelection(checked); >+ if(image != null) { >+ button.setImage(image); >+ } >+ if(label != null) { >+ button.setText(label); >+ } >+ GridData gd = new GridData(); >+ button.setLayoutData(gd); >+ setButtonDimensionHint(button); >+ return button; >+ } > > /** > * Creates and returns a new push button with the given >@@ -166,6 +191,32 @@ > } > > /** >+ * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified image >+ * @param parent the parent to add this label to >+ * @param text the text for the label >+ * @param image the image for the label >+ * @param hspan the h span to take up in the parent >+ * @param wrapwidth the with to wrap at >+ * @return a new <code>CLabel</code> >+ * @since 3.3 >+ */ >+ public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) { >+ CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP); >+ label.setFont(parent.getFont()); >+ if(text != null) { >+ label.setText(text); >+ } >+ if(image != null) { >+ label.setImage(image); >+ } >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = hspan; >+ gd.widthHint = wrapwidth; >+ label.setLayoutData(gd); >+ return label; >+ } >+ >+ /** > * Creates a wrapping label > * @param parent the parent composite to add this label to > * @param text the text to be displayed in the label >Index: ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java,v >retrieving revision 1.59 >diff -u -r1.59 IDebugHelpContextIds.java >--- ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 26 Oct 2006 20:12:40 -0000 1.59 >+++ ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 27 Nov 2006 17:40:45 -0000 >@@ -111,6 +111,7 @@ > public static final String LAUNCH_CONFIGURATION_DIALOG_PERSPECTIVE_TAB = PREFIX + "launch_configuration_dialog_perspective_tab"; //$NON-NLS-1$ > public static final String LAUNCH_CONFIGURATION_DIALOG_REFRESH_TAB = PREFIX + "launch_configuration_dialog refresh_tab"; //$NON-NLS-1$ > public static final String LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB = PREFIX + "launch_configuration_dialog_environment_tab"; //$NON-NLS-1$ >+ public static final String LAUNCH_CONFIGURATION_DIALOG_LAUNCHERS_TAB = PREFIX + "launch_configuration_dialog_launchers_tab"; //$NON-NLS-1$ > > // Working set page > public static final String WORKING_SET_PAGE = PREFIX + "working_set_page_context"; //$NON-NLS-1$ >Index: ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java,v >retrieving revision 1.89 >diff -u -r1.89 IInternalDebugUIConstants.java >--- ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java 26 Oct 2006 20:12:40 -0000 1.89 >+++ ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java 27 Nov 2006 17:40:45 -0000 >@@ -137,6 +137,12 @@ > public static final String PREF_LAUNCH_PERSPECTIVES = IDebugUIConstants.PLUGIN_ID + ".PREF_LAUNCH_PERSPECTIVES"; //$NON-NLS-1$ > > /** >+ * Represents the empty string >+ * @since 3.3 >+ */ >+ public static final String EMPTY_STRING = ""; //$NON-NLS-1$ >+ >+ /** > * Preference for enabling/disabling launch configuration filtering based on project accessibilty status > * > * @since 3.2 >@@ -263,21 +269,7 @@ > * @since 3.1 > */ > public static final String PREF_MAX_DETAIL_LENGTH = IDebugUIConstants.PLUGIN_ID + ".max_detail_length"; //$NON-NLS-1$ >- >- /** >- * Constant to describe the 'list' action for duplicate launch delegate resolution >- * @since 3.3 >- * EXPERIMENTAL >- */ >- public static final String DELEGATE_ACTION_ID_LIST = "list"; //$NON-NLS-1$ >- >- /** >- * Constant to describe the 'dialog' action for duplicate delegate resolution >- * @since 3.3 >- * EXPERIMENTAL >- */ >- public static final String DELEGATE_ACTION_ID_DIALOG = "dialog"; //$NON-NLS-1$ >- >+ > /** > * Font for Memory View > * >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties,v >retrieving revision 1.161 >diff -u -r1.161 LaunchConfigurationsMessages.properties >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 17 Nov 2006 21:21:19 -0000 1.161 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 27 Nov 2006 17:40:46 -0000 >@@ -34,6 +34,13 @@ > CommonTab_8=No file specified for process output > CommonTab_9=Variable&s... > >+LaunchersTab_0=The settings on this tab all you to specify which launcher to use when multiple launchers are available for a configuration and launch mode. >+LaunchersTab_1=Enable configuration specific settings >+LaunchersTab_2=Launchers >+LaunchersTab_3=<a>Change Workspace Settings...</a> >+LaunchersTab_4=You must select a preferred launcher for >+LaunchersTab_6=You must select a preferred launcher or use the workspace default >+ > CompileErrorPromptStatusHandler_0=Errors in Project{0} > CompileErrorPromptStatusHandler_1=Errors exist in a required project. Continue launch? > CompileErrorPromptStatusHandler_2=Errors exist in required project{0}: {1}.\nProceed with launch? >@@ -56,8 +63,6 @@ > LaunchConfigurationTabGroupViewer_9=The file associated with this launch configuration is read-only and cannot be modified.\n > LaunchConfigurationTabGroupViewer_13=Select a supported <a>launch mode</a>. > LaunchConfigurationTabGroupViewer_14=Mixed launch mode not supported: {0} >-LaunchConfigurationTabGroupViewer_15=Select preferred <a>launch tooling</a> for this type of configuration. >-LaunchConfigurationTabGroupViewer_16=There is duplicate launch tooling for the mixed mode: {0} > > LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations > LaunchConfigurationDialog_Dele_te_14=De&lete >@@ -70,7 +75,7 @@ > LaunchConfigurationDialog_Launch_Configuration_Error_46=Launch Configuration Error > 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_Ne_w_13=Ne&w\t\t > LaunchConfigurationDialog_No_33=No > LaunchConfigurationEditDialog_0=Modify configuration and continue. > LaunchConfigurationEditDialog_1=Con&tinue >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java,v >retrieving revision 1.4 >diff -u -r1.4 LaunchConfigurationTabGroupWrapper.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java 14 Nov 2006 21:28:40 -0000 1.4 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java 27 Nov 2006 17:40:46 -0000 >@@ -1,6 +1,7 @@ > package org.eclipse.debug.internal.ui.launchConfigurations; > > import java.util.ArrayList; >+import java.util.Arrays; > import java.util.List; > > import org.eclipse.core.runtime.CoreException; >@@ -30,6 +31,9 @@ > > private ILaunchConfigurationTabGroup fGroup = null; > private String fGroupId = null; >+ /** >+ * listing of tab extensions that we have to create >+ */ > private List fTabs = null; > private String fMode = null; > private ILaunchConfiguration fConfig = null; >@@ -38,6 +42,7 @@ > * Constructor > * @param group the existing group to wrapper > * @param groupId the string id of the associated tab group >+ * @param config the launch configuration this tab group is opened on > */ > public LaunchConfigurationTabGroupWrapper(ILaunchConfigurationTabGroup group, String groupId, ILaunchConfiguration config) { > fGroup = group; >@@ -60,9 +65,8 @@ > */ > public void dispose() { > if(fTabs != null) { >- ILaunchConfigurationTab[] tabs = getTabs(); >- for(int i = 0; i < tabs.length; i++) { >- tabs[i].dispose(); >+ for(int i = 0; i < fTabs.size(); i++) { >+ ((ILaunchConfigurationTab)fTabs.get(i)).dispose(); > } > fTabs = null; > } >@@ -75,41 +79,24 @@ > if(fTabs == null) { > try { > fTabs = new ArrayList(); >- ILaunchConfigurationTab[] tmp = fGroup.getTabs(); >- for(int i = 0; i < tmp.length; i++) { >- fTabs.add(tmp[i]); >- } >+ //add the tab groups' tabs first (defaults) >+ fTabs.addAll(Arrays.asList(fGroup.getTabs())); >+ //last, add the extensions (if any) > LaunchConfigurationTabExtension[] ext = LaunchConfigurationPresentationManager.getDefault().getTabExtensions(fGroupId, fConfig, fMode); > //copy contributed into correct position or end if no id or id is not found >- AbstractLaunchConfigurationTab alct = null; > String id = null; >- List item = null; > for(int i = 0; i < ext.length; i++) { > id = ext[i].getRelativeTabId(); > if(id != null) { >- //position specified, try to find it >- boolean found = false; >- for(int j = 0; j < tmp.length; j++) { >- if(tmp[j] instanceof AbstractLaunchConfigurationTab) { >- alct = (AbstractLaunchConfigurationTab) tmp[j]; >- if(id.equals(alct.getId())) { >- if(j != tmp.length-1) { >- item = new ArrayList(); >- item.add(ext[i].getTab()); >- fTabs.addAll(j+1, item); >- found = true; >- break; >- } >- } >- } >+ int idx = indexofTab(id); >+ if(idx > -1) { >+ fTabs.add(idx+1, ext[i].getTab()); > } >- if(!found) { >- //id did not match any tabs, add it to the end >+ else { > fTabs.add(ext[i].getTab()); > } > } > else { >- //no position specified, add it to the end > fTabs.add(ext[i].getTab()); > } > } >@@ -120,14 +107,33 @@ > } > > /** >+ * Returns the index of the tab matching the specified id >+ * @param id the id of the tab to find the index for >+ * @return the index of the tab specified by the id or -1 if not found >+ */ >+ private int indexofTab(String id) { >+ if(id != null) { >+ Object o = null; >+ for(int i = 0; i < fTabs.size(); i++) { >+ o = fTabs.get(i); >+ if(o instanceof AbstractLaunchConfigurationTab) { >+ if(id.equals(((AbstractLaunchConfigurationTab)o).getId())) { >+ return i; >+ } >+ } >+ } >+ } >+ return -1; >+ } >+ >+ /** > * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) > */ > public void initializeFrom(ILaunchConfiguration configuration) { >- if(fTabs == null) { >- getTabs(); >- } >- for(int i = 0; i < fTabs.size(); i++) { >- ((ILaunchConfigurationTab)fTabs.get(i)).initializeFrom(configuration); >+ if(fTabs != null) { >+ for(int i = 0; i < fTabs.size(); i++) { >+ ((ILaunchConfigurationTab)fTabs.get(i)).initializeFrom(configuration); >+ } > } > } > >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java,v >retrieving revision 1.43 >diff -u -r1.43 LaunchConfigurationsMessages.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 17 Nov 2006 21:21:19 -0000 1.43 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 27 Nov 2006 17:40:46 -0000 >@@ -94,13 +94,12 @@ > public static String LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3; > > public static String LaunchConfigurationTabGroupViewer_14; >- >- public static String LaunchConfigurationTabGroupViewer_15; >- >- public static String LaunchConfigurationTabGroupViewer_16; >- > public static String LaunchConfigurationTabGroupViewer_9; > public static String LaunchConfigurationTabGroupViewer_13; >+ >+ public static String LaunchersTab_3; >+ public static String LaunchersTab_4; >+ public static String LaunchersTab_6; > 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; >@@ -215,5 +214,9 @@ > public static String SelectLaunchOptionsDialog_2; > public static String SelectLaunchOptionsDialog_3; > public static String SelectLaunchOptionsDialog_4; >+ >+ public static String LaunchersTab_0; >+ public static String LaunchersTab_1; >+ public static String LaunchersTab_2; > > } >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java,v >retrieving revision 1.74 >diff -u -r1.74 LaunchConfigurationTabGroupViewer.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java 17 Nov 2006 22:08:07 -0000 1.74 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java 27 Nov 2006 17:40:46 -0000 >@@ -11,7 +11,6 @@ > package org.eclipse.debug.internal.ui.launchConfigurations; > > >-import java.util.HashSet; > import java.util.List; > import java.util.Set; > >@@ -37,12 +36,10 @@ > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; >-import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.custom.CTabFolder; > import org.eclipse.swt.custom.CTabItem; > import org.eclipse.swt.custom.StackLayout; >@@ -294,6 +291,7 @@ > fOptionsLink.setFont(linkComp.getFont()); > gd = new GridData(GridData.BEGINNING); > fOptionsLink.setLayoutData(gd); >+ fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13); > fOptionsLink.addSelectionListener(new SelectionListener() { > public void widgetSelected(SelectionEvent e) { > //collect the options available >@@ -309,25 +307,10 @@ > modes.remove(getLaunchConfigurationDialog().getMode()); > ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); > wc.setModes(modes); >- refresh(); > refreshStatus(); > } > } > } >- else if(hasDuplicateDelegates()) { >- Set modes = new HashSet(); >- modes.add(getLaunchConfigurationDialog().getMode()); >- modes.addAll(getWorkingCopy().getModes()); >- SelectLaunchDelegatesDialog sld = new SelectLaunchDelegatesDialog(getShell(), fTabType.getDelegates(modes)); >- if(sld.open() == IDialogConstants.OK_ID) { >- Object[] res = sld.getResult(); >- if(res != null) { >- fTabType.setPreferredDelegate(modes, (ILaunchDelegate) res[0]); >- disposeExistingTabs(); >- displayInstanceTabs(); >- } >- } >- } > } catch (CoreException ex) {} > } > public void widgetDefaultSelected(SelectionEvent e) {} >@@ -366,20 +349,6 @@ > } > > /** >- * Simple method to create a spacer in the page >- * >- * @param composite the composite to add the spacer to >- * @param columnSpan the amount of space for the spacer >- * @since 3.2 >- */ >- protected void createSpacer(Composite composite, int columnSpan) { >- Label label = new Label(composite, SWT.NONE); >- GridData gd = new GridData(); >- gd.horizontalSpan = columnSpan; >- label.setLayoutData(gd); >- } >- >- /** > * Creates some help text for the tab group launch types > * @param parent thep arent composite > * @since 3.2 >@@ -387,24 +356,20 @@ > private void createGettingStarted(Composite parent) { > Font font = parent.getFont(); > GridData gd = null; >- createWrapLabel(parent, null, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3); >+ int width = parent.getBounds().width - 30; >+ SWTUtil.createWrapLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1, 1, width); >+ SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG), 1, width); >+ SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), 1, width); >+ SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), 1, width); >+ SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), 1, width); >+ SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), 1, width); > >- createSpacer(parent, 2); >+ SWTUtil.createHorizontalSpacer(parent, 2); > Link link = new Link(parent, SWT.LEFT | SWT.WRAP); > link.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_5); > link.setFont(font); > gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.widthHint = parent.getBounds().width - 30; >+ gd.widthHint = width; > link.setLayoutData(gd); > link.addSelectionListener(new SelectionListener() { > public void widgetSelected(SelectionEvent e) { >@@ -413,22 +378,6 @@ > public void widgetDefaultSelected(SelectionEvent e) {} > }); > } >- >- /** >- * Create a label on the given parent that wraps text. >- * >- * @param parent >- * @param text >- */ >- private void createWrapLabel(Composite parent, Image image, String text) { >- CLabel lbl = new CLabel(parent, SWT.NONE | SWT.WRAP); >- lbl.setImage(image); >- lbl.setFont(parent.getFont()); >- lbl.setText(text); >- GridData gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.widthHint = parent.getBounds().width - 30; >- lbl.setLayoutData(gd); >- } > > /** > * Creates the tab folder for displaying config instances >@@ -519,10 +468,10 @@ > * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() > */ > public ISelection getSelection() { >- if (getActiveTab() == null) { >+ /*if (getActiveTab() == null) { > return new StructuredSelection(); >- } >- return new StructuredSelection(getActiveTab()); >+ } */ >+ return new StructuredSelection(fWorkingCopy/*getActiveTab()*/); > } > > /** >@@ -540,19 +489,19 @@ > // update error ticks > CTabItem item = null; > boolean error = false; >+ Image image = null; > for (int i = 0; i < tabs.length; i++) { >- tabs[i].isValid(getWorkingCopy()); >- error = tabs[i].getErrorMessage() != null; >+ error = tabs[i].getErrorMessage() != null && !tabs[i].isValid(getWorkingCopy()); >+ image = tabs[i].getImage(); > item = fTabFolder.getItem(i); >- setTabIcon(item, error, tabs[i]); >- } >- if(!canLaunchWithModes()) { >- fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13); >- } >- else if(hasDuplicateDelegates()) { >- fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_15); >+ if(error) { >+ item.setImage(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getErrorTabImage(tabs[i])); >+ } >+ else { >+ item.setImage(image); >+ } > } >- fOptionsLink.setVisible(!canLaunchWithModes() || hasDuplicateDelegates()); >+ fOptionsLink.setVisible(!canLaunchWithModes()); > fOptionsLink.getParent().layout(); > } > } >@@ -565,20 +514,6 @@ > fApplyButton.setEnabled(dirty && canSave()); > fRevertButton.setEnabled(dirty); > } >- >- /** >- * Set the specified tab item's icon to an error icon if <code>error</code> is true, >- * or a transparent icon of the same size otherwise. >- */ >- private void setTabIcon(CTabItem tabItem, boolean error, ILaunchConfigurationTab tab) { >- Image image = null; >- if (error) { >- image = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getErrorTabImage(tab); >- } else { >- image = tab.getImage(); >- } >- tabItem.setImage(image); >- } > > /* (non-Javadoc) > * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object) >@@ -673,7 +608,6 @@ > */ > protected void setFocusOnName() { > fNameWidget.setFocus(); >- > } > > /** >@@ -730,39 +664,50 @@ > * launch configuration type. > */ > private void showInstanceTabsFor(ILaunchConfigurationType configType) { >- > // Don't do any work if the current tabs are for the current config type >- if (fTabType != null && fTabType.equals(configType)) { >- return; >- } >- >+/*if (fTabType != null && fTabType.equals(configType)) { >+ return; >+}*/ > // try to keep on same tab > Class tabKind = null; > if (getActiveTab() != null) { > tabKind = getActiveTab().getClass(); > } >- > // Build the new tabs > ILaunchConfigurationTabGroup group = null; > try { >- group = createGroup(configType); >+ group = createGroup(); > } catch (CoreException ce) { > DebugUIPlugin.errorDialog(getShell(), LaunchConfigurationsMessages.LaunchConfigurationDialog_Error_19, LaunchConfigurationsMessages.LaunchConfigurationDialog_Exception_occurred_creating_launch_configuration_tabs_27,ce); // > return; > } >- >- showTabsFor(group); >+ disposeExistingTabs(); > fTabGroup = group; > fTabType = configType; >- >- // select same tab as before, if possible > ILaunchConfigurationTab[] tabs = getTabs(); >+ CTabItem tab = null; >+ String name = EMPTY_STRING; >+ Control control = null; >+ for (int i = 0; i < tabs.length; i++) { >+ tab = new CTabItem(fTabFolder, SWT.BORDER); >+ name = tabs[i].getName(); >+ if (name == null) { >+ name = LaunchConfigurationsMessages.LaunchConfigurationDialog_unspecified_28; >+ } >+ tab.setText(name); >+ tab.setImage(tabs[i].getImage()); >+ tabs[i].createControl(tab.getParent()); >+ control = tabs[i].getControl(); >+ if (control != null) { >+ tab.setControl(control); >+ } >+ } > //set the default tab as the first one > setActiveTab(tabs[0]); >+ // select same tab as before, if possible > for (int i = 0; i < tabs.length; i++) { >- ILaunchConfigurationTab tab = tabs[i]; >- if (tab.getClass().equals(tabKind)) { >- setActiveTab(tab); >+ if (tabs[i].getClass().equals(tabKind)) { >+ setActiveTab(tabs[i]); > break; > } > } >@@ -782,49 +727,19 @@ > String mode = fDialog.getMode(); > description = LaunchConfigurationPresentationManager.getDefault().getDescription(configType, mode); > } >- if (description == null) >+ if (description == null) { > description = EMPTY_STRING; >+ } > return description; > } > > /** >- * Create the tabs in the configuration edit area for the given tab group. >- */ >- private void showTabsFor(ILaunchConfigurationTabGroup tabGroup) { >- // Dispose the current tabs >- disposeExistingTabs(); >- >- fTabGroup = tabGroup; >- >- // Create the Control for each tab >- ILaunchConfigurationTab[] tabs = tabGroup.getTabs(); >- CTabItem tab = null; >- String name = EMPTY_STRING; >- Control control = null; >- for (int i = 0; i < tabs.length; i++) { >- tab = new CTabItem(fTabFolder, SWT.BORDER); >- name = tabs[i].getName(); >- if (name == null) { >- name = LaunchConfigurationsMessages.LaunchConfigurationDialog_unspecified_28; >- } >- tab.setText(name); >- tab.setImage(tabs[i].getImage()); >- tabs[i].createControl(tab.getParent()); >- control = tabs[i].getControl(); >- if (control != null) { >- tab.setControl(control); >- } >- } >- >- } >- >- /** > * Returns tab group for the given type of launch configuration. > * Tabs are initialized to be contained in this dialog. > * > * @exception CoreException if unable to instantiate a tab group > */ >- protected ILaunchConfigurationTabGroup createGroup(final ILaunchConfigurationType configType) throws CoreException { >+ protected ILaunchConfigurationTabGroup createGroup() throws CoreException { > // Use a final Object array to store the tab group and any exception that > // results from the Runnable > final Object[] finalArray = new Object[2]; >@@ -1029,7 +944,6 @@ > return false; > } > } >- > return true; > } > >@@ -1084,7 +998,10 @@ > modes.add(getLaunchConfigurationDialog().getMode()); > ILaunchDelegate[] delegates = LaunchConfigurationManager.filterLaunchDelegates(fTabType, modes); > if(delegates.length > 1) { >- ILaunchDelegate preferred = fTabType.getPreferredDelegate(modes); >+ ILaunchDelegate preferred = config.getPreferredDelegate(modes); >+ if(preferred == null) { >+ preferred = fTabType.getPreferredDelegate(modes); >+ } > if(preferred == null) { > return true; > } >@@ -1141,10 +1058,8 @@ > return temp.toString(); > } > } >- if(getWorkingCopy() != null) { >- if(getWorkingCopy().isReadOnly()) { >- return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9; >- } >+ if(getWorkingCopy().isReadOnly()) { >+ return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9; > } > //EXPERIMENTAL > if(!canLaunchWithModes()) { >@@ -1157,15 +1072,6 @@ > return e.getMessage(); > } > } >- if(hasDuplicateDelegates()) { >- try { >- Set modes = getWorkingCopy().getModes(); >- modes.add(getLaunchConfigurationDialog().getMode()); >- List names = LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(modes); >- return MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_16, new String[] {names.toString()}); >- } >- catch (CoreException e) {DebugUIPlugin.log(e);} >- } > return null; > } > >@@ -1293,8 +1199,6 @@ > } > } > fCurrentTabIndex = fTabFolder.getSelectionIndex(); >- SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection()); >- fireSelectionChanged(event); > } > > /** >@@ -1342,7 +1246,6 @@ > if(fTabGroup != null) { > fTabGroup.initializeFrom(fOriginal); > fWorkingCopy = fOriginal.getWorkingCopy(); >- refresh(); > refreshStatus(); > } > } >@@ -1366,11 +1269,12 @@ > */ > public void setActiveTab(ILaunchConfigurationTab tab) { > ILaunchConfigurationTab[] tabs = getTabs(); >- for (int i = 0; i < tabs.length; i++) { >- ILaunchConfigurationTab configurationTab = tabs[i]; >- if (configurationTab.equals(tab)) { >- setActiveTab(i); >- return; >+ if(tabs != null) { >+ for (int i = 0; i < tabs.length; i++) { >+ if (tabs[i].getClass().equals(tab.getClass())) { >+ setActiveTab(i); >+ return; >+ } > } > } > } >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatesDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatesDialog.java,v >retrieving revision 1.2 >diff -u -r1.2 SelectLaunchDelegatesDialog.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatesDialog.java 14 Nov 2006 21:28:40 -0000 1.2 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatesDialog.java 27 Nov 2006 17:40:46 -0000 >@@ -1,34 +1,22 @@ > package org.eclipse.debug.internal.ui.launchConfigurations; > >-import java.util.Arrays; >+import java.util.ArrayList; > > import org.eclipse.debug.core.ILaunchDelegate; > 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.IDialogConstants; > 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.jface.viewers.ISelectionChangedListener; >-import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.jface.viewers.SelectionChangedEvent; > 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.Group; > import org.eclipse.swt.widgets.Shell; >-import org.eclipse.swt.widgets.Table; >-import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.SelectionDialog; > >@@ -43,37 +31,11 @@ > * EXPERIMENTAL > */ > public class SelectLaunchDelegatesDialog extends SelectionDialog { >- >- /** >- * Builds labels for list control >- */ >- class DelegatesLabelProvider implements ILabelProvider { >- public Image getImage(Object element) {return null;} >- public String getText(Object element) { >- if(element instanceof ILaunchDelegate) { >- ILaunchDelegate ldp = (ILaunchDelegate) element; >- String name = ldp.getName(); >- if(name == null) { >- name = ldp.getContributorName(); >- } >- return name; >- } >- return element.toString(); >- } >- 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_DELEGATES_DIALOG"; //$NON-NLS-1$ > >- private CheckboxTableViewer fTableViewer = null; >- private Table fTable = null; >+ private SelectLaunchDelegatePanel fPanel = null; > private ILaunchDelegate[] fDelegates = null; >- private Text fDescriptionText = null; >- private final String EMPTY_STRING = ""; //$NON-NLS-1$ >- > /** > * Constructor > * @param parentShell the parent shell >@@ -95,34 +57,14 @@ > protected Control createDialogArea(Composite parent) { > initializeDialogUnits(parent); > Composite comp = (Composite) super.createDialogArea(parent); >- SWTUtil.createLabel(comp, LaunchConfigurationsMessages.SelectLaunchDelegatesDialog_2, 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 DelegatesLabelProvider()); >- fTableViewer.setContentProvider(new ArrayContentProvider()); >- fTableViewer.setInput(fDelegates); >- fTableViewer.addCheckStateListener(new ICheckStateListener() { >+ fPanel = new SelectLaunchDelegatePanel(comp); >+ fPanel.initialize(fDelegates); >+ CheckboxTableViewer viewer = fPanel.getTableViewer(); >+ viewer.addCheckStateListener(new ICheckStateListener() { > public void checkStateChanged(CheckStateChangedEvent event) { >- fTableViewer.setAllChecked(false); >- fTableViewer.setChecked(event.getElement(), true); > getButton(IDialogConstants.OK_ID).setEnabled(true); > } > }); >- fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { >- public void selectionChanged(SelectionChangedEvent event) { >- IStructuredSelection ss = (IStructuredSelection) event.getSelection(); >- if(ss != null && !ss.isEmpty()) { >- fDescriptionText.setText(((ILaunchDelegate)ss.getFirstElement()).getDescription()); >- } >- else { >- fDescriptionText.setText(EMPTY_STRING); >- } >- } >- }); >- Group group = SWTUtil.createGroup(comp, LaunchConfigurationsMessages.SelectLaunchDelegatesDialog_3, 1, 1, GridData.FILL_BOTH); >- fDescriptionText = SWTUtil.createText(group, SWT.WRAP | SWT.READ_ONLY, 1, GridData.FILL_BOTH); >- fDescriptionText.setBackground(group.getBackground()); > Dialog.applyDialogFont(comp); > PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_DELEGATES_DIALOG); > return comp; >@@ -140,9 +82,11 @@ > * @see org.eclipse.jface.dialogs.Dialog#okPressed() > */ > protected void okPressed() { >- Object[] o = fTableViewer.getCheckedElements(); >- if(o.length > 0) { >- setResult(Arrays.asList(o)); >+ Object delegate = fPanel.getSelectedDelegate(); >+ if(delegate != null) { >+ ArrayList list = new ArrayList(); >+ list.add(delegate); >+ setResult(list); > } > super.okPressed(); > } >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java,v >retrieving revision 1.31 >diff -u -r1.31 LaunchConfigurationView.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java 8 Nov 2006 14:37:39 -0000 1.31 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java 27 Nov 2006 17:40:46 -0000 >@@ -75,6 +75,7 @@ > private DeleteLaunchConfigurationAction fDeleteAction; > private DuplicateLaunchConfigurationAction fDuplicateAction; > private CollapseAllLaunchConfigurationAction fCollapseAllAction; >+ private LaunchConfigurationPropertiesAction fPropertiesAction; > > /** > * Action for providing filtering to the Launch Configuraiton Dialog >@@ -101,6 +102,11 @@ > fLaunchGroup = launchGroup; > } > >+ /** >+ * Constructor >+ * @param launchGroup >+ * @param filters >+ */ > public LaunchConfigurationView(LaunchGroupExtension launchGroup, ViewerFilter[] filters) { > super(); > fLaunchGroup = launchGroup; >@@ -181,6 +187,10 @@ > > fFilterAction = new FilterLaunchConfigurationAction(); > setAction(FilterLaunchConfigurationAction.ID_FILTER_ACTION, fFilterAction); >+ >+ fPropertiesAction = new LaunchConfigurationPropertiesAction((LaunchConfigurationsDialog) LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog(), getViewer()); >+ setAction(LaunchConfigurationPropertiesAction.ID_PROPERTIES_ACTION, fPropertiesAction); >+ > } > > /** >@@ -198,6 +208,7 @@ > menu.add(fDuplicateAction); > menu.add(fDeleteAction); > menu.add(new Separator()); >+ menu.add(fPropertiesAction); > } > > /** >@@ -223,6 +234,7 @@ > fDuplicateAction.dispose(); > fFilterAction = null; > fCollapseAllAction = null; >+ fPropertiesAction.dispose(); > getLaunchManager().removeLaunchConfigurationListener(this); > } > >@@ -277,8 +289,7 @@ > /** > * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration) > */ >- public void launchConfigurationChanged(ILaunchConfiguration configuration) { >- } >+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {} > > /** > * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration) >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java,v >retrieving revision 1.38 >diff -u -r1.38 LaunchConfigurationPresentationManager.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java 14 Nov 2006 21:28:40 -0000 1.38 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java 27 Nov 2006 17:40:46 -0000 >@@ -175,7 +175,7 @@ > } > > /** >- * Returns the tab group for the given launch configutation, its type and the mode the dialog opened in >+ * Returns the tab group for the given launch configutation and the mode the dialog opened in > * @param type the type of the configuration > * @param config > * @param mode >@@ -195,7 +195,7 @@ > /** > * Returns the proxy elements for all contributed tabs for the specified tab group id > * @param groupid the id of the tab group >- * @param type the type the tab group is opened on >+ * @param config the config the tab group is opened on > * @param mode the mode the associated launch dialog is opened on > * @return the listing of all of the tab extensions or an empty array, never <code>null</code> > * >@@ -241,7 +241,10 @@ > //filter to preferred delegate (if there is one) > HashSet modes = (HashSet) config.getModes(); > modes.add(mode); >- ILaunchDelegate delegate = config.getType().getPreferredDelegate(modes); >+ ILaunchDelegate delegate = config.getPreferredDelegate(modes); >+ if(delegate == null) { >+ delegate = config.getType().getPreferredDelegate(modes); >+ } > if(delegate != null) { > if(tabs[i].getDelegateSet().contains(delegate.getId())) { > set.add(tabs[i]); >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java,v >retrieving revision 1.18 >diff -u -r1.18 CreateLaunchConfigurationAction.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java 14 Nov 2006 21:28:40 -0000 1.18 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java 27 Nov 2006 17:40:45 -0000 >@@ -72,8 +72,7 @@ > tabGroup.createTabs(dialog, dialog.getMode()); > ILaunchConfigurationTab[] tabs = tabGroup.getTabs(); > for (int i = 0; i < tabs.length; i++) { >- ILaunchConfigurationTab tab = tabs[i]; >- tab.setLaunchConfigurationDialog(dialog); >+ tabs[i].setLaunchConfigurationDialog(dialog); > } > tabGroup.setDefaults(wc); > tabGroup.dispose(); >Index: ui/org/eclipse/debug/internal/ui/preferences/LaunchDelegatesPreferencePage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/preferences/LaunchDelegatesPreferencePage.java >diff -N ui/org/eclipse/debug/internal/ui/preferences/LaunchDelegatesPreferencePage.java >--- ui/org/eclipse/debug/internal/ui/preferences/LaunchDelegatesPreferencePage.java 17 Nov 2006 21:21:19 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,312 +0,0 @@ >-/******************************************************************************* >- * 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.preferences; >- >-import java.util.HashMap; >-import java.util.HashSet; >-import java.util.Iterator; >-import java.util.Map; >-import java.util.Set; >- >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.ILaunchConfigurationType; >-import org.eclipse.debug.core.ILaunchDelegate; >-import org.eclipse.debug.internal.core.LaunchManager; >-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.internal.ui.SWTUtil; >-import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager; >-import org.eclipse.jface.preference.PreferencePage; >-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.ISelectionChangedListener; >-import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.jface.viewers.ITreeContentProvider; >-import org.eclipse.jface.viewers.SelectionChangedEvent; >-import org.eclipse.jface.viewers.TreeViewer; >-import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Control; >-import org.eclipse.swt.widgets.Group; >-import org.eclipse.swt.widgets.Table; >-import org.eclipse.swt.widgets.Text; >-import org.eclipse.swt.widgets.Tree; >-import org.eclipse.ui.IWorkbench; >-import org.eclipse.ui.IWorkbenchPreferencePage; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.model.WorkbenchViewerComparator; >- >-/** >- * This class provides a preference page for selecting and changing preferred launch delegates for those of them >- * that have conflicting delegates. >- * >- * Delegates are considered to be conflicting if they are for the same launc configuraiton type, and apply to the same >- * mode sets. >- * >- * @since 3.3 >- * >- * TODO create a help topic for this page....it needs a good description >- * >- * EXPERIMENTAL >- */ >-public class LaunchDelegatesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { >- >- /** >- * Class to collect and persist attributes to sufficiently describe a dupicate launch delegate >- */ >- class DuplicateDelegate { >- private ILaunchConfigurationType fType = null; >- private ILaunchDelegate[] fDelegates = null; >- private Set fModes = null; >- >- public DuplicateDelegate(ILaunchConfigurationType type, ILaunchDelegate[] delegates, Set modes) { >- fModes = modes; >- fType = type; >- fDelegates = delegates; >- } >- >- public ILaunchConfigurationType getType() { >- return fType; >- } >- public ILaunchDelegate[] getDelegates() { >- return fDelegates; >- } >- public Set getModeSet() { >- return fModes; >- } >- } >- >- /** >- * label provider to extend the default one, provides labels to both the tree and table of this page >- */ >- class LabelProvider extends DefaultLabelProvider { >- public String getText(Object element) { >- if(element instanceof ILaunchConfigurationType) { >- return super.getText(element); >- } >- else if(element instanceof DuplicateDelegate) { >- DuplicateDelegate dd = (DuplicateDelegate) element; >- return LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(dd.getModeSet()).toString(); >- } >- else if(element instanceof ILaunchDelegate){ >- return ((ILaunchDelegate) element).getName(); >- } >- return element.toString(); >- } >- } >- >- /** >- * This class is used to provide content to the tree >- */ >- class TreeProvider implements ITreeContentProvider { >- public Object[] getChildren(Object parentElement) { >- if(parentElement instanceof ILaunchConfigurationType) { >- ILaunchConfigurationType type = (ILaunchConfigurationType) parentElement; >- Set dupes = (Set) fDuplicates.get(type); >- if(dupes != null) { >- return dupes.toArray(); >- } >- return null; >- } >- return null; >- } >- public boolean hasChildren(Object element) { >- return element instanceof ILaunchConfigurationType; >- } >- public Object[] getElements(Object inputElement) { >- if(inputElement instanceof Map) { >- return ((Map)inputElement).keySet().toArray(); >- } >- return null; >- } >- public Object getParent(Object element) {return null;} >- public void dispose() {} >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} >- } >- >- private TreeViewer fTreeViewer = null; >- private CheckboxTableViewer fTableViewer = null; >- private Map fDuplicates = null; >- private Map fDupeSelections = null; >- private boolean fDirty = false; >- private Text fDescription = null; >- >- /** >- * Constructor >- */ >- public LaunchDelegatesPreferencePage() { >- setTitle(DebugPreferencesMessages.LaunchDelegatesPreferencePage_0); >- } >- >- /** >- * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) >- */ >- public void createControl(Composite parent) { >- super.createControl(parent); >- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_DELEGATES_PREFERENCE_PAGE); >- } >- >- /** >- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >- */ >- protected Control createContents(Composite parent) { >- Composite comp = SWTUtil.createComposite(parent, 2, 1, GridData.FILL_BOTH); >- SWTUtil.createWrapLabel(comp, DebugPreferencesMessages.LaunchDelegatesPreferencePage_1, 2, 300); >- >- SWTUtil.createVerticalSpacer(comp, 1); >- //tree >- Composite comp1 = SWTUtil.createComposite(comp, 1, 1, GridData.FILL_VERTICAL); >- SWTUtil.createLabel(comp1, DebugPreferencesMessages.LaunchDelegatesPreferencePage_2, 1); >- Tree tree = new Tree(comp1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE); >- GridData gd = new GridData(GridData.FILL_BOTH); >- gd.grabExcessHorizontalSpace = false; >- tree.setLayoutData(gd); >- fTreeViewer = new TreeViewer(tree); >- fTreeViewer.setComparator(new WorkbenchViewerComparator()); >- fTreeViewer.setContentProvider(new TreeProvider()); >- fTreeViewer.setLabelProvider(new LabelProvider()); >- fTreeViewer.setInput(fDuplicates); >- fTreeViewer.expandToLevel(2); >- fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { >- public void selectionChanged(SelectionChangedEvent event) { >- Object obj = ((IStructuredSelection) event.getSelection()).getFirstElement(); >- if(obj instanceof DuplicateDelegate) { >- fTableViewer.setAllChecked(false); >- DuplicateDelegate dd = (DuplicateDelegate) obj; >- fTableViewer.setInput(dd.getDelegates()); >- obj = fDupeSelections.get(dd); >- if(obj != null) { >- fTableViewer.setChecked(obj, true); >- } >- } >- else { >- fTableViewer.setInput(null); >- } >- } >- }); >- >- //table >- Composite comp2 = SWTUtil.createComposite(comp, comp.getFont(), 1, 1, GridData.FILL_BOTH); >- SWTUtil.createLabel(comp2, DebugPreferencesMessages.LaunchDelegatesPreferencePage_3, 1); >- Table table = new Table(comp2, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK | SWT.SINGLE); >- table.setLayoutData(new GridData(GridData.FILL_BOTH)); >- fTableViewer = new CheckboxTableViewer(table); >- fTableViewer.setComparator(new WorkbenchViewerComparator()); >- fTableViewer.setLabelProvider(new LabelProvider()); >- fTableViewer.setContentProvider(new ArrayContentProvider()); >- fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { >- public void selectionChanged(SelectionChangedEvent event) { >- IStructuredSelection ss = (IStructuredSelection) event.getSelection(); >- if(ss != null && !ss.isEmpty()) { >- fDescription.setText(((ILaunchDelegate)ss.getFirstElement()).getDescription()); >- } >- else { >- fDescription.setText(""); //$NON-NLS-1$ >- } >- } >- }); >- fTableViewer.addCheckStateListener(new ICheckStateListener() { >- public void checkStateChanged(CheckStateChangedEvent event) { >- fDirty = true; >- Object element = event.getElement(); >- boolean checked = event.getChecked(); >- fTableViewer.setAllChecked(false); >- //always set checked, this way users cannot 'undo' a change to selecting a preferred delegate >- //The story for this is that on startup if there are dupes, the user is prompted to pick a delegate, after that they cannot >- //return to a state of not being able to launch something, but can pick a different delegate >- fTableViewer.setChecked(element, true); >- //persist the selection >- Object obj = ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement(); >- if(obj instanceof DuplicateDelegate) { >- fDupeSelections.remove(obj); >- if(checked) { >- fDupeSelections.put(obj, element); >- } >- } >- } >- }); >- Group group = SWTUtil.createGroup(comp, DebugPreferencesMessages.LaunchDelegatesPreferencePage_4, 1, 2, GridData.FILL_BOTH); >- fDescription = SWTUtil.createText(group, SWT.WRAP | SWT.READ_ONLY, 1, GridData.FILL_BOTH); >- fDescription.setBackground(group.getBackground()); >- return comp; >- } >- >- /** >- * @see org.eclipse.jface.preference.PreferencePage#performOk() >- */ >- public boolean performOk() { >- if(fDirty && fDupeSelections != null && fDupeSelections.size() > 0) { >- fDirty = false; >- DuplicateDelegate dd = null; >- ILaunchDelegate delegate = null; >- for(Iterator iter = fDupeSelections.keySet().iterator(); iter.hasNext();) { >- dd = (DuplicateDelegate) iter.next(); >- delegate = (ILaunchDelegate) fDupeSelections.get(dd); >- try { >- dd.getType().setPreferredDelegate(dd.getModeSet(), delegate); >- } >- catch (CoreException e) {DebugUIPlugin.log(e);} >- } >- } >- if(getPreferenceStore().needsSaving()) { >- DebugUIPlugin.getDefault().savePluginPreferences(); >- } >- return super.performOk(); >- } >- >- /** >- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) >- */ >- public void init(IWorkbench workbench) { >- //init a listing of duplicate delegates arranged by type >- try { >- setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); >- LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); >- ILaunchConfigurationType[] types = lm.getLaunchConfigurationTypes(); >- fDuplicates = new HashMap(); >- fDupeSelections = new HashMap(); >- Set modes = null; >- ILaunchDelegate[] delegates = null; >- Set modeset = null; >- Set tmp = null; >- ILaunchDelegate prefdelegate = null; >- DuplicateDelegate dd = null; >- for(int i = 0; i < types.length; i++) { >- modes = types[i].getSupportedModeCombinations(); >- for(Iterator iter = modes.iterator(); iter.hasNext();) { >- modeset = (Set) iter.next(); >- delegates = types[i].getDelegates(modeset); >- if(delegates.length > 1) { >- tmp = (Set) fDuplicates.get(types[i]); >- if(tmp == null) { >- tmp = new HashSet(); >- } >- dd = new DuplicateDelegate(types[i], delegates, modeset); >- tmp.add(dd); >- fDuplicates.put(types[i], tmp); >- prefdelegate = types[i].getPreferredDelegate(modeset); >- if(prefdelegate != null) { >- fDupeSelections.put(dd, prefdelegate); >- } >- } >- } >- } >- } >- catch(CoreException e) {DebugUIPlugin.log(e);} >- } >- >-} >Index: schema/launchConfigurationTabs.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/schema/launchConfigurationTabs.exsd,v >retrieving revision 1.5 >diff -u -r1.5 launchConfigurationTabs.exsd >--- schema/launchConfigurationTabs.exsd 16 Nov 2006 20:06:51 -0000 1.5 >+++ schema/launchConfigurationTabs.exsd 27 Nov 2006 17:40:45 -0000 >@@ -66,7 +66,7 @@ > <attribute name="class" type="string" use="required"> > <annotation> > <documentation> >- fully qualified name of the java class that implemnents <code>ILaunchConfigurationTab</code>. >+ fully qualified name of the java class that implements <code>ILaunchConfigurationTab</code>. > </documentation> > <appInfo> > <meta.attribute kind="java" basedOn="org.eclipse.debug.ui.ILaunchConfigurationTab"/> >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatePanel.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatePanel.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatePanel.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatePanel.java 1 Jan 1970 00:00:00 -0000 >@@ -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 org.eclipse.debug.core.ILaunchDelegate; >+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; >+import org.eclipse.debug.internal.ui.SWTUtil; >+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.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.SelectionChangedEvent; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.model.WorkbenchViewerComparator; >+ >+/** >+ * This class provides a reusable panel for the present a listing of <code>ILaunchDelegate</code>s to a user >+ * with a description field >+ * >+ * EXPERIMENTAL >+ * @since 3.3 >+ */ >+public class SelectLaunchDelegatePanel { >+ >+ /** >+ * Builds labels for table control >+ */ >+ class DelegatesLabelProvider implements ILabelProvider { >+ public Image getImage(Object element) {return null;} >+ public String getText(Object element) { >+ if(element instanceof ILaunchDelegate) { >+ ILaunchDelegate ldp = (ILaunchDelegate) element; >+ String name = ldp.getName(); >+ if(name == null) { >+ name = ldp.getContributorName(); >+ } >+ return name; >+ } >+ return element.toString(); >+ } >+ public void addListener(ILabelProviderListener listener) {} >+ public void dispose() {} >+ public boolean isLabelProperty(Object element, String property) {return false;} >+ public void removeListener(ILabelProviderListener listener) {} >+ } >+ >+ private Table fTable = null; >+ private CheckboxTableViewer fTableViewer = null; >+ private Text fDescriptionText = null; >+ >+ /** >+ * Constructor >+ * @param parent >+ * @param initialSelection >+ */ >+ public SelectLaunchDelegatePanel(Composite parent) { >+ createControl(parent); >+ } >+ >+ /** >+ * Creates the selection control on the specified parent composite >+ * @param parent the parent to add this control to >+ */ >+ protected void createControl(Composite parent) { >+ Composite comp = SWTUtil.createComposite(parent, 1, 1, GridData.FILL_BOTH); >+ SWTUtil.createLabel(comp, LaunchConfigurationsMessages.SelectLaunchDelegatesDialog_2, 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 DelegatesLabelProvider()); >+ fTableViewer.setContentProvider(new ArrayContentProvider()); >+ fTableViewer.setComparator(new WorkbenchViewerComparator()); >+ fTableViewer.addCheckStateListener(new ICheckStateListener() { >+ public void checkStateChanged(CheckStateChangedEvent event) { >+ fTableViewer.setCheckedElements(new Object[] {event.getElement()}); >+ } >+ }); >+ fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ IStructuredSelection ss = (IStructuredSelection) event.getSelection(); >+ if(ss != null && !ss.isEmpty()) { >+ fDescriptionText.setText(((ILaunchDelegate)ss.getFirstElement()).getDescription()); >+ } >+ else { >+ fDescriptionText.setText(IInternalDebugUIConstants.EMPTY_STRING); >+ } >+ } >+ }); >+ Group group = SWTUtil.createGroup(comp, LaunchConfigurationsMessages.SelectLaunchDelegatesDialog_3, 1, 1, GridData.FILL_BOTH); >+ fDescriptionText = SWTUtil.createText(group, SWT.WRAP | SWT.READ_ONLY, 1, GridData.FILL_BOTH); >+ fDescriptionText.setBackground(group.getBackground()); >+ } >+ >+ /** >+ * This method initializes the input to the launch delegates viewer, and should be called before trying to set the selection >+ * @param delegates the listing of delegates to set as input for this viewer >+ */ >+ public void initialize(ILaunchDelegate[] delegates) { >+ fTableViewer.setInput(delegates); >+ } >+ >+ /** >+ * Returns the currently checked launch delegate >+ * @return the currently selected launch delegate or <code>null</code> if none are checked >+ */ >+ public ILaunchDelegate getSelectedDelegate() { >+ Object[] checked = fTableViewer.getCheckedElements(); >+ if(checked.length > 0) { >+ return (ILaunchDelegate) checked[0]; >+ } >+ return null; >+ } >+ >+ /** >+ * Sets the enabled state of the panels' usable controls >+ * @param enabled the enabled state desired for the panels' usable controls >+ */ >+ public void setEnabled(boolean enabled) { >+ fTable.setEnabled(enabled); >+ } >+ >+ /** >+ * This method will both select and set as checked the specified delegate, if found in the table viewer >+ * @param delegate the delegate to set as selected AND checked in the table view >+ */ >+ public void setSelection(ILaunchDelegate delegate) { >+ if(delegate != null) { >+ fTableViewer.setSelection(new StructuredSelection(delegate)); >+ fTableViewer.setCheckedElements(new Object[] {delegate}); >+ } >+ else { >+ fTableViewer.setSelection(new StructuredSelection()); >+ fTableViewer.setAllChecked(false); >+ } >+ } >+ >+ /** >+ * Returns the check table viewer so subclasses can work directly with it >+ * @return the check box table viewer from this control >+ */ >+ protected CheckboxTableViewer getTableViewer() { >+ return fTableViewer; >+ } >+ >+} >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesAction.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,72 @@ >+/******************************************************************************* >+ * 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.core.runtime.CoreException; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.jface.viewers.ISelectionProvider; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.window.IShellProvider; >+import org.eclipse.ui.dialogs.PropertyDialogAction; >+ >+/** >+ * Subclass to allow access the the run method of rht eproperrty dialog action >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class LaunchConfigurationPropertiesAction extends PropertyDialogAction { >+ >+ /** >+ * Action identifier for IDebugView#getAction(String) >+ */ >+ public static final String ID_PROPERTIES_ACTION = DebugUIPlugin.getUniqueIdentifier() + ".ID_PROPERTIES_ACTION"; //$NON-NLS-1$ >+ >+ /** >+ * Constructor >+ * @param shell >+ * @param provider >+ */ >+ public LaunchConfigurationPropertiesAction(IShellProvider shell, ISelectionProvider provider) { >+ super(shell, provider); >+ } >+ >+ /** >+ * @see org.eclipse.ui.dialogs.PropertyDialogAction#run() >+ */ >+ public void run() { >+ super.run(); >+ ((LaunchConfigurationsDialog)LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog()).getTabViewer().displayInstanceTabs(); >+ } >+ >+ /** >+ * @see org.eclipse.ui.dialogs.PropertyDialogAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection) >+ */ >+ public void selectionChanged(IStructuredSelection selection) { >+ if(selection != null && !selection.isEmpty()) { >+ Object o = selection.getFirstElement(); >+ if(o instanceof ILaunchConfiguration) { >+ try { >+ ILaunchConfiguration config = (ILaunchConfiguration) o; >+ Set modes = config.getModes(); >+ modes.add(LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog().getMode()); >+ setEnabled(config.getType().getDelegates(modes).length > 1); >+ return; >+ } >+ catch(CoreException ce) {DebugUIPlugin.log(ce);} >+ } >+ } >+ setEnabled(false); >+ } >+} >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/PreferredLaunchersPropertyPage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/PreferredLaunchersPropertyPage.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/PreferredLaunchersPropertyPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/PreferredLaunchersPropertyPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,217 @@ >+/******************************************************************************* >+ * 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.HashSet; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.ILaunchDelegate; >+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.ILaunchConfigurationDialog; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Link; >+import org.eclipse.ui.IWorkbenchPropertyPage; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.dialogs.PropertyPage; >+ >+/** >+ * This class provides a property page for editing the properties of a launch configuration in the launch dialog >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class PreferredLaunchersPropertyPage extends PropertyPage implements IWorkbenchPropertyPage { >+ >+ private Button fUseSystemLauncher = null; >+ private SelectLaunchDelegatePanel fPanel = null; >+ >+ /** >+ * Constructor >+ */ >+ public PreferredLaunchersPropertyPage() {} >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createContents(Composite parent) { >+ Composite comp = SWTUtil.createComposite(parent, 1, 1, GridData.FILL_BOTH); >+ SWTUtil.createWrapLabel(comp, LaunchConfigurationsMessages.LaunchersTab_0, 1); >+ SWTUtil.createVerticalSpacer(comp, 1); >+ Composite c2 = SWTUtil.createComposite(comp, 2, 1, GridData.FILL_HORIZONTAL); >+ fUseSystemLauncher = SWTUtil.createCheckButton(c2, LaunchConfigurationsMessages.LaunchersTab_1, null, true); >+ Link link = new Link(c2, SWT.NONE); >+ link.setText(LaunchConfigurationsMessages.LaunchersTab_3); >+ link.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true, 1, 1)); >+ >+ SWTUtil.createVerticalSpacer(comp, 1); >+ fPanel = new SelectLaunchDelegatePanel(comp); >+ >+ initialize(); >+ >+ //add selection listeners after so we can access the panel >+ fUseSystemLauncher.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ public void widgetSelected(SelectionEvent e) { >+ boolean checked = ((Button)e.widget).getSelection(); >+ fPanel.setEnabled(checked); >+ resetDelegate(); >+ } >+ }); >+ link.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ public void widgetSelected(SelectionEvent e) { >+ SWTUtil.showPreferencePage("org.eclipse.debug.ui.LaunchDelegatesPreferencePage"); //$NON-NLS-1$ >+ if(!fUseSystemLauncher.getSelection()) { >+ resetDelegate(); >+ } >+ } >+ }); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_LAUNCHERS_TAB); >+ return comp; >+ } >+ >+ /** >+ * Resets the selected and checked delegate in the preferred launcher view part to be the one from the workspace >+ */ >+ private void resetDelegate() { >+ ILaunchConfiguration config = getLaunchConfiguration(); >+ if(!fUseSystemLauncher.getSelection()) { >+ try { >+ ILaunchDelegate preferred = config.getType().getPreferredDelegate(getModes()); >+ if(preferred != null) { >+ fPanel.setSelection(preferred); >+ } >+ } >+ catch (CoreException ce) {DebugUIPlugin.log(ce);} >+ } >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults() >+ */ >+ protected void performDefaults() { >+ if(fUseSystemLauncher != null) { >+ fUseSystemLauncher.setSelection(false); >+ } >+ super.performDefaults(); >+ } >+ >+ /** >+ * Initializes the page >+ */ >+ private void initialize() { >+ try { >+ fPanel.initialize(getLaunchConfiguration().getType().getDelegates(getModes())); >+ ILaunchConfigurationWorkingCopy config = getLaunchConfiguration(); >+ Set modes = getModes(); >+ ILaunchDelegate delegate = config.getPreferredDelegate(modes); >+ boolean custom = delegate != null; >+ fUseSystemLauncher.setSelection(custom); >+ fPanel.setEnabled(custom); >+ //load the pref settings >+ fPanel.initialize(config.getType().getDelegates(modes)); >+ if(delegate == null) { >+ delegate = config.getType().getPreferredDelegate(modes); >+ } >+ fPanel.setSelection(delegate); >+ } >+ catch (CoreException e1) {DebugUIPlugin.log(e1);} >+ } >+ >+ /** >+ * @return the launch configuration backing this property page >+ */ >+ private ILaunchConfigurationWorkingCopy getLaunchConfiguration() { >+ LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog) LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog(); >+ return (ILaunchConfigurationWorkingCopy) ((IStructuredSelection)dialog.getTabViewer().getSelection()).getFirstElement(); >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#isValid() >+ */ >+ public boolean isValid() { >+ setErrorMessage(null); >+ if(fPanel.getSelectedDelegate() == null) { >+ ILaunchConfigurationWorkingCopy config = getLaunchConfiguration(); >+ if(fUseSystemLauncher.getSelection()) { >+ setErrorMessage(LaunchConfigurationsMessages.LaunchersTab_4+config.getName()); >+ return false; >+ } >+ else { >+ setErrorMessage(LaunchConfigurationsMessages.LaunchersTab_6); >+ return false; >+ } >+ } >+ return super.isValid(); >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#performOk() >+ */ >+ public boolean performOk() { >+ ILaunchConfigurationWorkingCopy config = getLaunchConfiguration(); >+ Set modes = getModes(); >+ ILaunchDelegate delegate = null; >+ if(fUseSystemLauncher.getSelection()) { >+ delegate = fPanel.getSelectedDelegate(); >+ if(delegate != null) { >+ config.setPreferredLaunchDelegate(modes, delegate.getId()); >+ } >+ } >+ else { >+ config.setPreferredLaunchDelegate(modes, null); >+ } >+ if(config.isDirty()) { >+ try { >+ config.doSave(); >+ } >+ catch (CoreException e) {DebugUIPlugin.log(e);} >+ } >+ updateLaunchDialog(); >+ return super.performOk(); >+ } >+ >+ /** >+ * @return the complete set of modes that the associated launch configuration is concerned with >+ */ >+ private Set getModes() { >+ Set modes = new HashSet(); >+ try { >+ ILaunchConfigurationWorkingCopy config = getLaunchConfiguration().getWorkingCopy(); >+ modes = config.getModes(); >+ modes.add(LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog().getMode()); >+ } >+ catch (CoreException ce) {DebugUIPlugin.log(ce);} >+ return modes; >+ } >+ >+ /** >+ * updates the currently visible launch dialog >+ */ >+ private void updateLaunchDialog() { >+ ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog(); >+ dialog.updateButtons(); >+ dialog.updateMessage(); >+ } >+ >+} >Index: ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java >diff -N ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,312 @@ >+/******************************************************************************* >+ * 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.preferences; >+ >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.Map; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchDelegate; >+import org.eclipse.debug.internal.core.LaunchManager; >+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.internal.ui.SWTUtil; >+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager; >+import org.eclipse.jface.preference.PreferencePage; >+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.ISelectionChangedListener; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.ITreeContentProvider; >+import org.eclipse.jface.viewers.SelectionChangedEvent; >+import org.eclipse.jface.viewers.TreeViewer; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.swt.widgets.Tree; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPreferencePage; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.model.WorkbenchViewerComparator; >+ >+/** >+ * This class provides a preference page for selecting and changing preferred launch delegates for those of them >+ * that have conflicting delegates. >+ * >+ * Delegates are considered to be conflicting if they are for the same launc configuraiton type, and apply to the same >+ * mode sets. >+ * >+ * @since 3.3 >+ * >+ * TODO create a help topic for this page....it needs a good description >+ * >+ * EXPERIMENTAL >+ */ >+public class LaunchersPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { >+ >+ /** >+ * Class to collect and persist attributes to sufficiently describe a dupicate launch delegate >+ */ >+ class DuplicateDelegate { >+ private ILaunchConfigurationType fType = null; >+ private ILaunchDelegate[] fDelegates = null; >+ private Set fModes = null; >+ >+ public DuplicateDelegate(ILaunchConfigurationType type, ILaunchDelegate[] delegates, Set modes) { >+ fModes = modes; >+ fType = type; >+ fDelegates = delegates; >+ } >+ >+ public ILaunchConfigurationType getType() { >+ return fType; >+ } >+ public ILaunchDelegate[] getDelegates() { >+ return fDelegates; >+ } >+ public Set getModeSet() { >+ return fModes; >+ } >+ } >+ >+ /** >+ * label provider to extend the default one, provides labels to both the tree and table of this page >+ */ >+ class LabelProvider extends DefaultLabelProvider { >+ public String getText(Object element) { >+ if(element instanceof ILaunchConfigurationType) { >+ return super.getText(element); >+ } >+ else if(element instanceof DuplicateDelegate) { >+ DuplicateDelegate dd = (DuplicateDelegate) element; >+ return LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(dd.getModeSet()).toString(); >+ } >+ else if(element instanceof ILaunchDelegate){ >+ return ((ILaunchDelegate) element).getName(); >+ } >+ return element.toString(); >+ } >+ } >+ >+ /** >+ * This class is used to provide content to the tree >+ */ >+ class TreeProvider implements ITreeContentProvider { >+ public Object[] getChildren(Object parentElement) { >+ if(parentElement instanceof ILaunchConfigurationType) { >+ ILaunchConfigurationType type = (ILaunchConfigurationType) parentElement; >+ Set dupes = (Set) fDuplicates.get(type); >+ if(dupes != null) { >+ return dupes.toArray(); >+ } >+ return null; >+ } >+ return null; >+ } >+ public boolean hasChildren(Object element) { >+ return element instanceof ILaunchConfigurationType; >+ } >+ public Object[] getElements(Object inputElement) { >+ if(inputElement instanceof Map) { >+ return ((Map)inputElement).keySet().toArray(); >+ } >+ return null; >+ } >+ public Object getParent(Object element) {return null;} >+ public void dispose() {} >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} >+ } >+ >+ private TreeViewer fTreeViewer = null; >+ private CheckboxTableViewer fTableViewer = null; >+ private Map fDuplicates = null; >+ private Map fDupeSelections = null; >+ private boolean fDirty = false; >+ private Text fDescription = null; >+ >+ /** >+ * Constructor >+ */ >+ public LaunchersPreferencePage() { >+ setTitle(DebugPreferencesMessages.LaunchDelegatesPreferencePage_0); >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createControl(Composite parent) { >+ super.createControl(parent); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_DELEGATES_PREFERENCE_PAGE); >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createContents(Composite parent) { >+ Composite comp = SWTUtil.createComposite(parent, 2, 1, GridData.FILL_BOTH); >+ SWTUtil.createWrapLabel(comp, DebugPreferencesMessages.LaunchDelegatesPreferencePage_1, 2, 300); >+ >+ SWTUtil.createVerticalSpacer(comp, 1); >+ //tree >+ Composite comp1 = SWTUtil.createComposite(comp, 1, 1, GridData.FILL_VERTICAL); >+ SWTUtil.createLabel(comp1, DebugPreferencesMessages.LaunchDelegatesPreferencePage_2, 1); >+ Tree tree = new Tree(comp1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE); >+ GridData gd = new GridData(GridData.FILL_BOTH); >+ gd.grabExcessHorizontalSpace = false; >+ tree.setLayoutData(gd); >+ fTreeViewer = new TreeViewer(tree); >+ fTreeViewer.setComparator(new WorkbenchViewerComparator()); >+ fTreeViewer.setContentProvider(new TreeProvider()); >+ fTreeViewer.setLabelProvider(new LabelProvider()); >+ fTreeViewer.setInput(fDuplicates); >+ fTreeViewer.expandToLevel(2); >+ fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ Object obj = ((IStructuredSelection) event.getSelection()).getFirstElement(); >+ if(obj instanceof DuplicateDelegate) { >+ fTableViewer.setAllChecked(false); >+ DuplicateDelegate dd = (DuplicateDelegate) obj; >+ fTableViewer.setInput(dd.getDelegates()); >+ obj = fDupeSelections.get(dd); >+ if(obj != null) { >+ fTableViewer.setChecked(obj, true); >+ } >+ } >+ else { >+ fTableViewer.setInput(null); >+ } >+ } >+ }); >+ >+ //table >+ Composite comp2 = SWTUtil.createComposite(comp, comp.getFont(), 1, 1, GridData.FILL_BOTH); >+ SWTUtil.createLabel(comp2, DebugPreferencesMessages.LaunchDelegatesPreferencePage_3, 1); >+ Table table = new Table(comp2, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK | SWT.SINGLE); >+ table.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ fTableViewer = new CheckboxTableViewer(table); >+ fTableViewer.setComparator(new WorkbenchViewerComparator()); >+ fTableViewer.setLabelProvider(new LabelProvider()); >+ fTableViewer.setContentProvider(new ArrayContentProvider()); >+ fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ IStructuredSelection ss = (IStructuredSelection) event.getSelection(); >+ if(ss != null && !ss.isEmpty()) { >+ fDescription.setText(((ILaunchDelegate)ss.getFirstElement()).getDescription()); >+ } >+ else { >+ fDescription.setText(""); //$NON-NLS-1$ >+ } >+ } >+ }); >+ fTableViewer.addCheckStateListener(new ICheckStateListener() { >+ public void checkStateChanged(CheckStateChangedEvent event) { >+ fDirty = true; >+ Object element = event.getElement(); >+ boolean checked = event.getChecked(); >+ fTableViewer.setAllChecked(false); >+ //always set checked, this way users cannot 'undo' a change to selecting a preferred delegate >+ //The story for this is that on startup if there are dupes, the user is prompted to pick a delegate, after that they cannot >+ //return to a state of not being able to launch something, but can pick a different delegate >+ fTableViewer.setChecked(element, true); >+ //persist the selection >+ Object obj = ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement(); >+ if(obj instanceof DuplicateDelegate) { >+ fDupeSelections.remove(obj); >+ if(checked) { >+ fDupeSelections.put(obj, element); >+ } >+ } >+ } >+ }); >+ Group group = SWTUtil.createGroup(comp, DebugPreferencesMessages.LaunchDelegatesPreferencePage_4, 1, 2, GridData.FILL_BOTH); >+ fDescription = SWTUtil.createText(group, SWT.WRAP | SWT.READ_ONLY, 1, GridData.FILL_BOTH); >+ fDescription.setBackground(group.getBackground()); >+ return comp; >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#performOk() >+ */ >+ public boolean performOk() { >+ if(fDirty && fDupeSelections != null && fDupeSelections.size() > 0) { >+ fDirty = false; >+ DuplicateDelegate dd = null; >+ ILaunchDelegate delegate = null; >+ for(Iterator iter = fDupeSelections.keySet().iterator(); iter.hasNext();) { >+ dd = (DuplicateDelegate) iter.next(); >+ delegate = (ILaunchDelegate) fDupeSelections.get(dd); >+ try { >+ dd.getType().setPreferredDelegate(dd.getModeSet(), delegate); >+ } >+ catch (CoreException e) {DebugUIPlugin.log(e);} >+ } >+ } >+ if(getPreferenceStore().needsSaving()) { >+ DebugUIPlugin.getDefault().savePluginPreferences(); >+ } >+ return super.performOk(); >+ } >+ >+ /** >+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) >+ */ >+ public void init(IWorkbench workbench) { >+ //init a listing of duplicate delegates arranged by type >+ try { >+ setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); >+ LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); >+ ILaunchConfigurationType[] types = lm.getLaunchConfigurationTypes(); >+ fDuplicates = new HashMap(); >+ fDupeSelections = new HashMap(); >+ Set modes = null; >+ ILaunchDelegate[] delegates = null; >+ Set modeset = null; >+ Set tmp = null; >+ ILaunchDelegate prefdelegate = null; >+ DuplicateDelegate dd = null; >+ for(int i = 0; i < types.length; i++) { >+ modes = types[i].getSupportedModeCombinations(); >+ for(Iterator iter = modes.iterator(); iter.hasNext();) { >+ modeset = (Set) iter.next(); >+ delegates = types[i].getDelegates(modeset); >+ if(delegates.length > 1) { >+ tmp = (Set) fDuplicates.get(types[i]); >+ if(tmp == null) { >+ tmp = new HashSet(); >+ } >+ dd = new DuplicateDelegate(types[i], delegates, modeset); >+ tmp.add(dd); >+ fDuplicates.put(types[i], tmp); >+ prefdelegate = types[i].getPreferredDelegate(modeset); >+ if(prefdelegate != null) { >+ fDupeSelections.put(dd, prefdelegate); >+ } >+ } >+ } >+ } >+ } >+ catch(CoreException e) {DebugUIPlugin.log(e);} >+ } >+ >+} >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/core/ILaunchConfiguration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java,v >retrieving revision 1.48 >diff -u -r1.48 ILaunchConfiguration.java >--- core/org/eclipse/debug/core/ILaunchConfiguration.java 23 Oct 2006 13:53:16 -0000 1.48 >+++ core/org/eclipse/debug/core/ILaunchConfiguration.java 27 Nov 2006 17:40:48 -0000 >@@ -89,6 +89,16 @@ > public static final String ATTR_SOURCE_LOCATOR_MEMENTO = DebugPlugin.getUniqueIdentifier() + ".source_locator_memento"; //$NON-NLS-1$ > > /** >+ * Launch configuration attribute storing a list >+ * of preferred launchers for associated mode sets. >+ * This attribute is a list of launchers stored by mode set >+ * and relating to the id of the preferred launcher, which happens to be an <code>ILaunchDelegate</code> >+ * >+ * @since 3.3 >+ */ >+ public static final String ATTR_PREFERRED_LAUNCHERS = DebugPlugin.getUniqueIdentifier() + ".preferred_launchers"; //$NON-NLS-1$ >+ >+ /** > * Returns whether the contents of this launch configuration are > * equal to the contents of the given launch configuration. > * >@@ -345,6 +355,21 @@ > public Set getModes() throws CoreException; > > /** >+ * Returns the preferred launch delegate that has been set on this configuration. >+ * @return this configuration's preferred launch delegate for the specified mode set, or >+ * <code>null</code> if one is not specified >+ * >+ * <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 ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException; >+ >+ /** > * Returns the type of this launch configuration. This is a > * handle-only method. > * >Index: core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java,v >retrieving revision 1.21 >diff -u -r1.21 ILaunchConfigurationWorkingCopy.java >--- core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java 23 Oct 2006 13:53:16 -0000 1.21 >+++ core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java 27 Nov 2006 17:40:48 -0000 >@@ -195,6 +195,22 @@ > public void setModes(Set modes); > > /** >+ * Set the preferred launch delegates' id for the given mode set. Passing in <code>null</code> as a delegate >+ * id will cause the mapping for the specified mode set (if any) to be removed >+ * @param modes the set of modes to set this delegate id for >+ * @param delegateId the id of the delegate to associate as preferred for the specified mode set >+ * >+ * <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 void setPreferredLaunchDelegate(Set modes, String delegateId); >+ >+ /** > * Adds the specified launch modes to this configuration's settings. > * <p> > * Setting launch modes on a configuration allows the configuration to >Index: core/org/eclipse/debug/internal/core/LaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java,v >retrieving revision 1.175 >diff -u -r1.175 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 14 Nov 2006 20:07:24 -0000 1.175 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 27 Nov 2006 17:40:49 -0000 >@@ -1390,10 +1390,10 @@ > * without consulting with the Platform/Debug team. > * </p> > */ >- public LaunchDelegate[] getLaunchDelegates() { >+ public ILaunchDelegate[] getLaunchDelegates() { > initializeLaunchDelegates(); > Collection col = fLaunchDelegates.values(); >- return (LaunchDelegate[]) col.toArray(new LaunchDelegate[col.size()]); >+ return (ILaunchDelegate[]) col.toArray(new ILaunchDelegate[col.size()]); > } > > /** >@@ -1421,6 +1421,26 @@ > } > > /** >+ * This method returns the <code>ILaunchDelegate</code> instance corresponding to the id >+ * of the launch delegate specified >+ * @param id the id of the <code>ILaunchDelegate</code> to find >+ * @return the <code>ILaunchDelegate</code> or <code>null</code> if not found >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+ public ILaunchDelegate getLaunchDelegate(String id) { >+ if(id != null) { >+ ILaunchDelegate[] delegates = getLaunchDelegates(); >+ for(int i = 0; i < delegates.length; i++) { >+ if(id.equals(delegates[i].getId())) { >+ return delegates[i]; >+ } >+ } >+ } >+ return null; >+ } >+ >+ /** > * Initializes the listing of delegates available to the launching framework > * > * <p> >@@ -2197,18 +2217,20 @@ > for(Iterator iter = preferred.keySet().iterator(); iter.hasNext();) { > modes = (Set) iter.next(); > delegate = (ILaunchDelegate) preferred.get(modes); >- child = doc.createElement(DELEGATE); >- child.setAttribute(ID, delegate.getId()); >- child.setAttribute(TYPEID, types[i].getIdentifier()); >- for(Iterator iter2 = modes.iterator(); iter2.hasNext();) { >- modestr += iter2.next(); >- if(iter2.hasNext()) { >- modestr += ","; //$NON-NLS-1$ >+ if(delegate != null) { >+ child = doc.createElement(DELEGATE); >+ child.setAttribute(ID, delegate.getId()); >+ child.setAttribute(TYPEID, types[i].getIdentifier()); >+ for(Iterator iter2 = modes.iterator(); iter2.hasNext();) { >+ modestr += iter2.next(); >+ if(iter2.hasNext()) { >+ modestr += ","; //$NON-NLS-1$ >+ } > } >+ child.setAttribute(MODES, modestr); >+ modestr = EMPTY_STRING; >+ root.appendChild(child); > } >- child.setAttribute(MODES, modestr); >- modestr = EMPTY_STRING; >- root.appendChild(child); > } > } > } >Index: core/org/eclipse/debug/internal/core/LaunchConfiguration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java,v >retrieving revision 1.90 >diff -u -r1.90 LaunchConfiguration.java >--- core/org/eclipse/debug/internal/core/LaunchConfiguration.java 26 Oct 2006 20:12:25 -0000 1.90 >+++ core/org/eclipse/debug/internal/core/LaunchConfiguration.java 27 Nov 2006 17:40:48 -0000 >@@ -624,7 +624,10 @@ > IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "No launch delegate found, canceling launch and returning", null); //$NON-NLS-1$ > throw new CoreException(status); > } else { >- ILaunchDelegate del = getType().getPreferredDelegate(modes); >+ ILaunchDelegate del = getPreferredDelegate(modes); >+ if(del == null) { >+ del = getType().getPreferredDelegate(modes); >+ } > if(del == null) { > IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus); > IStatus status = (IStatus) handler.handleStatus(duplicateDelegates, new Object[] {this, mode}); >@@ -777,6 +780,20 @@ > } > return false; > } >+ >+ /** >+ * @see org.eclipse.debug.core.ILaunchConfiguration#getPreferredDelegate(java.util.Set) >+ */ >+ public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException { >+ Map delegates = getAttribute(ILaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, (Map)null); >+ if(delegates != null) { >+ String id = (String) delegates.get(modes.toString()); >+ if(id != null) { >+ return getLaunchManager().getLaunchDelegate(id); >+ } >+ } >+ return null; >+ } > > } > >Index: core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java,v >retrieving revision 1.63 >diff -u -r1.63 LaunchConfigurationWorkingCopy.java >--- core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 23 Oct 2006 13:53:16 -0000 1.63 >+++ core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 27 Nov 2006 17:40:48 -0000 >@@ -17,6 +17,7 @@ > import java.io.IOException; > import java.io.UnsupportedEncodingException; > import java.util.ArrayList; >+import java.util.HashMap; > import java.util.List; > import java.util.Map; > import java.util.Set; >@@ -408,18 +409,18 @@ > /** > * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setModes(java.util.Set) > */ >- public void setModes(Set options) { >- getInfo().setAttribute(ATTR_LAUNCH_MODES, (options.size() > 0 ? options : null)); >+ public void setModes(Set modes) { >+ getInfo().setAttribute(ATTR_LAUNCH_MODES, (modes.size() > 0 ? modes : null)); > setDirty(); > } > > /** > * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#addModes(java.util.Set) > */ >- public void addModes(Set options) { >+ public void addModes(Set modes) { > try { > Set opts = getModes(); >- if(opts.addAll(options)) { >+ if(opts.addAll(modes)) { > getInfo().setAttribute(ATTR_LAUNCH_MODES, opts); > setDirty(); > } >@@ -611,5 +612,29 @@ > setAttribute(LaunchConfiguration.ATTR_MAPPED_RESOURCE_TYPES, types); > } > >+ /** >+ * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setPreferredLaunchDelegate(java.util.Set, java.lang.String) >+ */ >+ public void setPreferredLaunchDelegate(Set modes, String delegateId) { >+ if(modes != null) { >+ try { >+ Map delegates = getAttribute(ILaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, (Map)null); >+ //copy map to avoid pointer issues >+ Map map = new HashMap(); >+ if(delegates != null) { >+ map.putAll(delegates); >+ } >+ if(delegateId == null) { >+ map.remove(modes.toString()); >+ } >+ else { >+ map.put(modes.toString(), delegateId); >+ } >+ setAttribute(ILaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, map); >+ } >+ catch (CoreException ce) {DebugPlugin.log(ce);} >+ } >+ } >+ > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 157059
:
50306
|
50933
|
51706
|
51719
|
51935
|
51964
|
52144
|
52498
|
52620
|
53657
|
54555
|
54562
|
54584