diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java index bd7b1bb7bad..c2b42e2e959 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.debug.internal.ui.launch; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -47,6 +48,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.ILaunchDelegate; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugModelPresentation; @@ -166,7 +168,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { } if (debugConfig != null) { - configuration = createConfiguration(bin, debugConfig); + configuration = createConfiguration(bin, debugConfig, mode); } } else if (candidateCount == 1) { configuration = (ILaunchConfiguration) candidateConfigs.get(0); @@ -184,7 +186,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { * @param bin * @return ILaunchConfiguration */ - private ILaunchConfiguration createConfiguration(IBinary bin, ICDebugConfiguration debugConfig) { + private ILaunchConfiguration createConfiguration(IBinary bin, ICDebugConfiguration debugConfig, String mode) { ILaunchConfiguration config = null; try { String projectName = bin.getResource().getProjectRelativePath().toString(); @@ -201,6 +203,17 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 { ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN); wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, debugConfig.getID()); + // Workaround for bug 262840: select the standard CDT launcher by default. + HashSet set = new HashSet(); + set.add(mode); + try { + ILaunchDelegate preferredDelegate = wc.getPreferredDelegate(set); + if (preferredDelegate == null) { + wc.setPreferredLaunchDelegate(set, "org.eclipse.cdt.cdi.launch.localCLaunch"); + } + } catch (CoreException e) {} + // End workaround for bug 262840 + ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(bin.getCProject().getProject()); if (projDes != null) { 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 aa803220992..a332b16ca80 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 @@ -13,6 +13,7 @@ package org.eclipse.cdt.launch.ui; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import org.eclipse.cdt.core.CCorePlugin; @@ -42,6 +43,7 @@ import org.eclipse.core.runtime.IPath; 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.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.dialogs.MessageDialog; @@ -86,7 +88,7 @@ public class CMainTab extends CLaunchConfigurationTab { * * @since 6.0 */ - public static final String TAB_ID = "org.eclipse.cdt.cdi.launch.mainTab"; + public static final String TAB_ID = "org.eclipse.cdt.cdi.launch.mainTab"; //$NON-NLS-1$ // Project UI widgets protected Label fProjLabel; @@ -696,6 +698,23 @@ public class CMainTab extends CLaunchConfigurationTab { * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ public void setDefaults(ILaunchConfigurationWorkingCopy config) { + + // Workaround for bug 262840: select the standard CDT launcher by default. + HashSet set = new HashSet(); + set.add(getLaunchConfigurationDialog().getMode()); + try { + ILaunchDelegate preferredDelegate = config.getPreferredDelegate(set); + if (preferredDelegate == null) { + if (config.getType().getIdentifier().equals(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP)) { + config.setPreferredLaunchDelegate(set, "org.eclipse.cdt.cdi.launch.localCLaunch"); + } else if (config.getType().getIdentifier().equals(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH)) { + config.setPreferredLaunchDelegate(set, "org.eclipse.cdt.cdi.launch.localCAttachLaunch"); + } else if (config.getType().getIdentifier().equals(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_POST_MORTEM)) { + config.setPreferredLaunchDelegate(set, "org.eclipse.cdt.cdi.launch.coreFileCLaunch"); + } + } + } catch (CoreException e) {} + // We set empty attributes for project & program so that when one config // is // compared to another, the existence of empty attributes doesn't cause