diff options
author | Michael Rennie | 2007-12-06 17:16:08 +0000 |
---|---|---|
committer | Michael Rennie | 2007-12-06 17:16:08 +0000 |
commit | dcb51d24e918d80eef57db657d751fb2fd0b997b (patch) | |
tree | e978dbd46d71c7eb002f170ac7403ed27ab7704d /org.eclipse.debug.ui | |
parent | 90f111fc32ddd8057969374d0458dd786c4b8b39 (diff) | |
download | eclipse.platform.debug-dcb51d24e918d80eef57db657d751fb2fd0b997b.tar.gz eclipse.platform.debug-dcb51d24e918d80eef57db657d751fb2fd0b997b.tar.xz eclipse.platform.debug-dcb51d24e918d80eef57db657d751fb2fd0b997b.zip |
Bug 208034 [launching] Unexpected error when opening launch config dialog from resource properties
Diffstat (limited to 'org.eclipse.debug.ui')
4 files changed, 71 insertions, 5 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java index 2dda18074..7338eca88 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java @@ -1122,7 +1122,31 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici } /** - * Returns the private launch configuration used as a placeholder to represent/store + * Returns the {@link ILaunchGroup} for the given mode set and + * {@link ILaunchConfigurationType}. + * @param type the type + * @param modeset the set of modes, which are combined to one mode string + * @return the associated {@link ILaunchGroup} or <code>null</code> + * + * @since 3.4.0 + */ + public ILaunchGroup getLaunchGroup(ILaunchConfigurationType type, Set modeset) { + StringBuffer buff = new StringBuffer(); + Object item = null; + for(Iterator iter = modeset.iterator(); iter.hasNext();) { + item = iter.next(); + if(item instanceof String) { + buff.append(item); + if(iter.hasNext()) { + buff.append(","); //$NON-NLS-1$ + } + } + } + return getLaunchGroup(type, buff.toString()); + } + + /** + * Returns the private launch configuration used as a place-holder to represent/store * the information associated with a launch configuration type. * * @param type launch configuration type diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java index 4e6474bc2..b5264d596 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java @@ -189,4 +189,6 @@ public class DebugPreferencesMessages extends NLS { public static String DebugPreferencePage_28; + public static String RunDebugPropertiesPage_0; + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties index 914673f56..35638a678 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties @@ -151,3 +151,4 @@ DefaultLaunchConfigurationsPropertiesPage_8=De&lete DefaultLaunchConfigurationsPropertiesPage_9=Delete selected launch configuration DefaultLaunchConfigurationsPropertiesPage_11=Select Configuration Type DefaultLaunchConfigurationsPropertiesPage_12=&Select the type of configuration to create: +RunDebugPropertiesPage_0=There was a problem trying to edit {0} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java index 77937c1ef..42f7e03e7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java @@ -25,6 +25,7 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.internal.core.LaunchManager; import org.eclipse.debug.internal.ui.AbstractDebugListSelectionDialog; import org.eclipse.debug.internal.ui.DebugUIPlugin; @@ -32,7 +33,8 @@ import org.eclipse.debug.internal.ui.DefaultLabelProvider; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; import org.eclipse.debug.internal.ui.SWTFactory; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationComparator; -import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; +import org.eclipse.debug.ui.ILaunchGroup; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ISelection; @@ -182,6 +184,7 @@ public class RunDebugPropertiesPage extends PropertyPage { fEditButton.setEnabled(!empty && size == 1); fDuplicateButton.setEnabled(!empty && size == 1); fDeleteButton.setEnabled(!empty); + setErrorMessage(null); } } }); @@ -393,10 +396,14 @@ public class RunDebugPropertiesPage extends PropertyPage { */ private void handleEdit() { ILaunchConfigurationWorkingCopy config = getSelectedConfigurations()[0]; - if(edit(config, false) == IDialogConstants.OK_ID) { + int ret = edit(config, false); + if(ret == IDialogConstants.OK_ID) { fChangedConfigurations.add(config); fViewer.refresh(config, true, true); } + else if(ret == IDialogConstants.ABORT_ID) { + setErrorMessage(MessageFormat.format(DebugPreferencesMessages.RunDebugPropertiesPage_0, new String[] {config.getName()})); + } } /** @@ -408,7 +415,35 @@ public class RunDebugPropertiesPage extends PropertyPage { * @return dialog return code - OK or CANCEL */ private int edit(ILaunchConfigurationWorkingCopy configuration, boolean setDefaults) { - return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, IDebugUIConstants.ID_RUN_LAUNCH_GROUP, getConfigurationNames(), null, setDefaults); + try { + LaunchConfigurationManager lcm = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); + ILaunchGroup group = null; + // bug 208034, we should try modes we know about first then guess + ILaunchConfigurationType type = configuration.getType(); + if(type.supportsMode(ILaunchManager.RUN_MODE)) { + group = lcm.getLaunchGroup(type, ILaunchManager.RUN_MODE); + } + else if(type.supportsMode(ILaunchManager.DEBUG_MODE)) { + group = lcm.getLaunchGroup(type, ILaunchManager.DEBUG_MODE); + } + else if(type.supportsMode(ILaunchManager.PROFILE_MODE)) { + group = lcm.getLaunchGroup(type, ILaunchManager.PROFILE_MODE); + } + else { + Set modes = type.getSupportedModeCombinations(); + for(Iterator iter = modes.iterator(); iter.hasNext();) { + group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(type, (Set)iter.next()); + if(group != null) { + break; + } + } + } + if(group != null) { + return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, group.getIdentifier(), getConfigurationNames(), null, setDefaults); + } + } + catch(CoreException ce) {} + return IDialogConstants.ABORT_ID; } /** @@ -459,11 +494,15 @@ public class RunDebugPropertiesPage extends PropertyPage { ILaunchConfigurationWorkingCopy wc = type.newInstance(null, ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()). generateUniqueLaunchConfigurationNameFrom("New_configuration", getConfigurationNames())); //$NON-NLS-1$ - if (edit(wc, true) == Window.OK) { + int ret = edit(wc, true); + if (ret == Window.OK) { fChangedConfigurations.add(wc); fViewer.add(wc); fViewer.setSelection(new StructuredSelection(wc)); } + else if(ret == IDialogConstants.ABORT_ID) { + setErrorMessage(MessageFormat.format(DebugPreferencesMessages.RunDebugPropertiesPage_0, new String[] {wc.getName()})); + } } catch (CoreException e) { setErrorMessage(e.getMessage()); } |