diff options
author | Marc Khouzam | 2010-05-14 01:50:46 +0000 |
---|---|---|
committer | Marc Khouzam | 2010-05-14 01:50:46 +0000 |
commit | fe3c6d028fabd799ab3a83385ce2cf2001adbf97 (patch) | |
tree | fd9d51556cc3ba95e31777f4213918d6372d6968 /launch | |
parent | b3ddbdf187eea2ab8e4d1a9b9def176f742e977c (diff) | |
download | org.eclipse.cdt-fe3c6d028fabd799ab3a83385ce2cf2001adbf97.tar.gz org.eclipse.cdt-fe3c6d028fabd799ab3a83385ce2cf2001adbf97.tar.xz org.eclipse.cdt-fe3c6d028fabd799ab3a83385ce2cf2001adbf97.zip |
Bug 281970: No longer show the Debugger, Refresh and Source tabs for a Run Configuration. Also, make sure a Run configuration can be used for Debug and vice versa.
Diffstat (limited to 'launch')
3 files changed, 94 insertions, 9 deletions
diff --git a/launch/org.eclipse.cdt.launch/plugin.xml b/launch/org.eclipse.cdt.launch/plugin.xml index c761efe985c..895e9e16553 100644 --- a/launch/org.eclipse.cdt.launch/plugin.xml +++ b/launch/org.eclipse.cdt.launch/plugin.xml @@ -187,6 +187,39 @@ <associatedDelegate delegate="org.eclipse.cdt.cdi.launch.coreFileCLaunch"/> <placement after="org.eclipse.debug.ui.sourceLookupTab"/> </tab> + + <!-- Run launch tabs--> + <tab + id="org.eclipse.cdt.cdi.launch.runApplicationLaunch.mainTab" + group="org.eclipse.cdt.launch.applicationRunLaunchTabGroup" + name="%MainLaunchTab.name" + class="org.eclipse.cdt.launch.ui.CMainTab"> + <associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCLaunch"/> + </tab> + <tab + id="org.eclipse.cdt.cdi.launch.runApplicationLaunch.argumentsTab" + group="org.eclipse.cdt.launch.applicationRunLaunchTabGroup" + name="%ArgumentsLaunchTab.name" + class="org.eclipse.cdt.launch.ui.CArgumentsTab"> + <associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCLaunch"/> + <placement after="org.eclipse.cdt.cdi.launch.mainTab"/> + </tab> + <tab + id="org.eclipse.cdt.cdi.launch.runApplicationLaunch.environmentTab" + group="org.eclipse.cdt.launch.applicationRunLaunchTabGroup" + name="%EnvironmentLaunchTab.name" + class="org.eclipse.debug.ui.EnvironmentTab"> + <associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCLaunch"/> + <placement after="org.eclipse.cdt.cdi.launch.argumentsTab"/> + </tab> + <tab + id="org.eclipse.cdt.cdi.launch.runApplicationLaunch.commonTab" + group="org.eclipse.cdt.launch.applicationRunLaunchTabGroup" + name="%CommonLaunchTab.name" + class="org.eclipse.debug.ui.CommonTab"> + <associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCLaunch"/> + <placement after="org.eclipse.debug.ui.environmentTab"/> + </tab> </extension> <extension point="org.eclipse.debug.core.statusHandlers"> diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/ApplicationCDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/ApplicationCDebuggerTab.java index e5567beb20d..474537b8358 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/ApplicationCDebuggerTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/ApplicationCDebuggerTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems and others. + * Copyright (c) 2008, 2010 Wind River Systems 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 @@ -10,13 +10,53 @@ *******************************************************************************/ package org.eclipse.cdt.launch.ui; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; + /** * CDebugger tab to use for an application launch configuration. * * @since 6.0 */ public class ApplicationCDebuggerTab extends CDebuggerTab { - public ApplicationCDebuggerTab() { + /* + * When the launch configuration is created for Run mode, + * this Debugger tab is not created because it is not used + * for Run mode but only for Debug mode. + * When we then open the same configuration in Debug mode, the launch + * configuration already exists and initializeFrom() is called + * instead of setDefaults(). + * We therefore call setDefaults() ourselves and update the configuration. + * If we don't then the user will be required to press Apply to get the + * default settings saved. + * Bug 281970 + */ + private boolean fSetDefaultCalled; + + public ApplicationCDebuggerTab() { super (false); } + + @Override + public void setDefaults(ILaunchConfigurationWorkingCopy config) { + fSetDefaultCalled = true; + + super.setDefaults(config); + } + + @Override + public void initializeFrom(ILaunchConfiguration config) { + if (fSetDefaultCalled == false) { + try { + ILaunchConfigurationWorkingCopy wc; + wc = config.getWorkingCopy(); + setDefaults(wc); + wc.doSave(); + } catch (CoreException e) { + } + } + + super.initializeFrom(config); + } } diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java index 66bb5f51a50..93a618d4155 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java @@ -35,6 +35,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchDelegate; +import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.dialogs.MessageDialog; @@ -534,19 +535,30 @@ public class CMainTab extends CAbstractMainTab { */ public void setDefaults(ILaunchConfigurationWorkingCopy config) { - // Workaround for bug 262840: select the standard CDT launcher by default. - HashSet<String> set = new HashSet<String>(); - set.add(getLaunchConfigurationDialog().getMode()); + // Workaround for bug 262840 try { + HashSet<String> set = new HashSet<String>(); + set.add(ILaunchManager.DEBUG_MODE); ILaunchDelegate preferredDelegate = config.getPreferredDelegate(set); if (preferredDelegate == null) { if (config.getType().getIdentifier().equals(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP)) { - config.setPreferredLaunchDelegate(set, "org.eclipse.cdt.dsf.gdb.launch.localCLaunch"); //$NON-NLS-1$ + config.setPreferredLaunchDelegate(set, ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE); } else if (config.getType().getIdentifier().equals(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH)) { - config.setPreferredLaunchDelegate(set, "org.eclipse.cdt.dsf.gdb.launch.attachCLaunch"); //$NON-NLS-1$ + config.setPreferredLaunchDelegate(set, ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE); } else if (config.getType().getIdentifier().equals(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_POST_MORTEM)) { - config.setPreferredLaunchDelegate(set, "org.eclipse.cdt.dsf.gdb.launch.coreCLaunch"); //$NON-NLS-1$ - } + config.setPreferredLaunchDelegate(set, ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_POSTMORTEM_LAUNCH_DELEGATE); + } + } + } catch (CoreException e) {} + + // We must also set the preferred delegate for Run mode, because this configuration + // can be used in Run mode. + try { + HashSet<String> set = new HashSet<String>(); + set.add(ILaunchManager.RUN_MODE); + ILaunchDelegate preferredDelegate = config.getPreferredDelegate(set); + if (preferredDelegate == null) { + config.setPreferredLaunchDelegate(set, ICDTLaunchConfigurationConstants.PREFERRED_RUN_LAUNCH_DELEGATE); } } catch (CoreException e) {} |