Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/jtag
diff options
context:
space:
mode:
Diffstat (limited to 'jtag')
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/internal/ui/GDBJtagDSFCMainTab.java22
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/Activator.java33
2 files changed, 33 insertions, 22 deletions
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/internal/ui/GDBJtagDSFCMainTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/internal/ui/GDBJtagDSFCMainTab.java
index 1a54d185b4f..f2529a50af2 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/internal/ui/GDBJtagDSFCMainTab.java
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/internal/ui/GDBJtagDSFCMainTab.java
@@ -10,12 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.internal.ui;
-import java.util.HashSet;
-
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainTab;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchDelegate;
/**
* @since 7.0
@@ -25,21 +20,4 @@ public class GDBJtagDSFCMainTab extends CMainTab {
public GDBJtagDSFCMainTab() {
super(CMainTab.DONT_CHECK_PROGRAM | CMainTab.INCLUDE_BUILD_SETTINGS);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- @Override
- public void setDefaults(ILaunchConfigurationWorkingCopy config) {
- super.setDefaults(config);
- HashSet<String> set = new HashSet<String>();
- set.add(getLaunchConfigurationDialog().getMode());
- try {
- ILaunchDelegate preferredDelegate = config.getPreferredDelegate(set);
- if (preferredDelegate == null) {
- config.setPreferredLaunchDelegate(set, "org.eclipse.cdt.debug.gdbjtag.core.dsfLaunchDelegate"); //$NON-NLS-1$
- }
- } catch (CoreException e) {}
- }
-
}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/Activator.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/Activator.java
index 499e3dbcdb3..d169ad8cfd7 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/Activator.java
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/Activator.java
@@ -11,8 +11,15 @@
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.ui;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchDelegate;
+import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -24,6 +31,10 @@ public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbjtag.ui";
+ private static final String HARDWARE_LAUNCH_TYPE = "org.eclipse.cdt.debug.gdbjtag.launchConfigurationType"; //$NON-NLS-1$
+
+ private static final String PREFERRED_DEBUG_HARDWARE_LAUNCH_DELEGATE = "org.eclipse.cdt.debug.gdbjtag.core.dsfLaunchDelegate"; //$NON-NLS-1$
+
// The shared instance
private static Activator plugin;
@@ -40,6 +51,7 @@ public class Activator extends AbstractUIPlugin {
*/
public void start(BundleContext context) throws Exception {
super.start(context);
+ setDefaultLaunchDelegates();
}
/*
@@ -88,4 +100,25 @@ public class Activator extends AbstractUIPlugin {
static void log(Throwable e) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
}
+
+ private void setDefaultLaunchDelegates() {
+ // Set the default launch delegates as early as possible, and do it only once (Bug 312997)
+ ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager();
+
+ HashSet<String> debugSet = new HashSet<String>();
+ debugSet.add(ILaunchManager.DEBUG_MODE);
+
+ ILaunchConfigurationType remoteCfg = launchMgr.getLaunchConfigurationType(HARDWARE_LAUNCH_TYPE);
+ try {
+ if (remoteCfg.getPreferredDelegate(debugSet) == null) {
+ ILaunchDelegate[] delegates = remoteCfg.getDelegates(debugSet);
+ for (ILaunchDelegate delegate : delegates) {
+ if (PREFERRED_DEBUG_HARDWARE_LAUNCH_DELEGATE.equals(delegate.getId())) {
+ remoteCfg.setPreferredDelegate(debugSet, delegate);
+ break;
+ }
+ }
+ }
+ } catch (CoreException e) {}
+ }
}

Back to the top