mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
[270469] - [launch] The standard launcher should be selected by default.
This commit is contained in:
parent
a1a4c150c3
commit
f8440ac182
2 changed files with 35 additions and 3 deletions
|
@ -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<String> set = new HashSet<String>();
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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<String> set = new HashSet<String>();
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue