From 5343d22eea13e14946333e76d216e2bda67b959e Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Mon, 27 Jun 2011 16:23:53 -0400 Subject: [PATCH] Bug 348159: Move DSF-GDB preference store to the core plugin. --- dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml | 6 --- .../cdt/dsf/gdb/internal/ui/GdbUIPlugin.java | 19 +++++++++ .../preferences/GdbDebugPreferencePage.java | 3 +- .../preferences/GdbPreferenceInitializer.java | 41 ------------------ .../META-INF/MANIFEST.MF | 2 +- dsf-gdb/org.eclipse.cdt.dsf.gdb/plugin.xml | 7 +++- .../internal/GdbPreferenceInitializer.java | 42 +++++++++++++++++++ .../gdb/launching/FinalLaunchSequence.java | 2 +- .../cdt/dsf/gdb/launching/LaunchUtils.java | 18 +++----- .../cdt/dsf/gdb/service/GDBBackend.java | 2 +- .../cdt/dsf/gdb/service/GDBProcesses.java | 4 +- .../cdt/dsf/gdb/service/GDBProcesses_7_0.java | 4 +- .../OperationsWhileTargetIsRunningTest.java | 13 +++--- .../gdbjtag/ui/GDBJtagDSFDebuggerTab.java | 5 ++- 14 files changed, 90 insertions(+), 78 deletions(-) delete mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml index 92c40ca22a8..0f152c7eba8 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml @@ -291,12 +291,6 @@ name="%gdbPreferencePage.name"> - - - - diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java index 6866babf972..2aedaeb95b0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java @@ -11,18 +11,22 @@ *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.internal.ui; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.internal.ui.console.TracingConsoleManager; import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.osgi.framework.BundleContext; /** @@ -39,6 +43,9 @@ public class GdbUIPlugin extends AbstractUIPlugin { private static BundleContext fgBundleContext; private static TracingConsoleManager fTracingConsoleManager; + + private static IPreferenceStore fCorePreferenceStore; + /** * The constructor */ @@ -97,6 +104,18 @@ public class GdbUIPlugin extends AbstractUIPlugin { return fgBundleContext; } + /** + * Returns the preference store for this UI plug-in. + * It actually uses the preference store of the core plug-in. + */ + @Override + public IPreferenceStore getPreferenceStore() { + if (fCorePreferenceStore == null) { + fCorePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, GdbPlugin.PLUGIN_ID); + } + return fCorePreferenceStore; + } + /** * copied from org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin */ diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java index 85a289061dd..6993e02e459 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java @@ -251,9 +251,8 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements childCountLimitField.setValidRange(1, 10000); childCountLimitField.fillIntoGrid(indentHelper, 3); - IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore(); boolean prettyPrintingEnabled = - store.getBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING); + getPreferenceStore().getBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING); childCountLimitField.setEnabled(prettyPrintingEnabled, indentHelper); addField(childCountLimitField); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java deleted file mode 100644 index 72fd2e2a3f5..00000000000 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Ericsson 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - initial API and implementation - * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) - * Sergey Prigogin (Google) - *******************************************************************************/ -package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; -import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; -import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; - -/** - * Initialize the GDB preferences. - */ -public class GdbPreferenceInitializer extends AbstractPreferenceInitializer { - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore(); - store.setDefault(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, true); - store.setDefault(IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, 500000); - store.setDefault(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true); - store.setDefault(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true); - store.setDefault(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, true); - store.setDefault(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, 100); - store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); - store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT); - store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); - store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF index 8edbcd618da..e5bad1ccc36 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF @@ -19,7 +19,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.cdt.dsf.gdb, org.eclipse.cdt.dsf.gdb.actions, org.eclipse.cdt.dsf.gdb.breakpoints, - org.eclipse.cdt.dsf.gdb.internal;x-internal:=true, + org.eclipse.cdt.dsf.gdb.internal;x-friends:="org.eclipse.cdt.dsf.gdb.ui,org.eclipse.cdt.debug.gdbjtag.ui", org.eclipse.cdt.dsf.gdb.internal.commands;x-internal:=true, org.eclipse.cdt.dsf.gdb.internal.memory;x-internal:=true, org.eclipse.cdt.dsf.gdb.internal.service.command.events;x-internal:=true, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/plugin.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb/plugin.xml index c4e5a78d671..305e3d583c7 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/plugin.xml +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/plugin.xml @@ -61,5 +61,10 @@ contextId="org.eclipse.cdt.debug.ui.debugging" debugModelId="org.eclipse.cdt.dsf.gdb"/> - + + + + diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java new file mode 100644 index 00000000000..e9403f12ba9 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011 Ericsson 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Ericsson - initial API and implementation + * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) + * Sergey Prigogin (Google) + * Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159) + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.internal; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; + +/** + * Initialize the GDB preferences. + */ +public class GdbPreferenceInitializer extends AbstractPreferenceInitializer { + @Override + public void initializeDefaultPreferences() { + IEclipsePreferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, true); + node.putInt(IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, 500000); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, true); + node.putInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, 100); + node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); + node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT); + node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java index ff77183abb2..54b74473a74 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java @@ -197,7 +197,7 @@ public class FinalLaunchSequence extends ReflectionSequence { */ @Execute public void stepEnablePrettyPrinting(final RequestMonitor requestMonitor) { - if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, false, null)) { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java index d294c6a69e2..c1e69f7b392 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java @@ -58,8 +58,6 @@ import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunchConfiguration; public class LaunchUtils { - private static final String GDB_UI_PLUGIN_ID = "org.eclipse.cdt.dsf.gdb.ui"; //$NON-NLS-1$ - /** * A prefix that we use to indicate that a GDB version is for MAC OS * @since 3.0 @@ -213,7 +211,7 @@ public class LaunchUtils { } public static IPath getGDBPath(ILaunchConfiguration configuration) { - String defaultGdbCommand = Platform.getPreferencesService().getString(GDB_UI_PLUGIN_ID, + String defaultGdbCommand = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null); @@ -439,13 +437,7 @@ public class LaunchUtils { public static boolean getIsNonStopMode(ILaunchConfiguration config) { try { return config.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, - // This call causes a race condition with the TraceControlManager - // Don't use it for now, until we find a fix. - // Consequence is that a Debug As->C/C++ application shortcut will not follow - // the preference for non-stop. This is not as bad as not have the gdb traces - // Bug 348159 - IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); -// getIsNonStopModeDefault()); + getIsNonStopModeDefault()); } catch (CoreException e) { } return false; @@ -457,7 +449,7 @@ public class LaunchUtils { * @since 4.0 */ public static boolean getIsNonStopModeDefault() { - return Platform.getPreferencesService().getBoolean(GDB_UI_PLUGIN_ID, + return Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT, null); } @@ -468,7 +460,7 @@ public class LaunchUtils { * @since 4.0 */ public static boolean getStopAtMainDefault() { - return Platform.getPreferencesService().getBoolean(GDB_UI_PLUGIN_ID, + return Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT, null); } @@ -479,7 +471,7 @@ public class LaunchUtils { * @since 4.0 */ public static String getStopAtMainSymbolDefault() { - return Platform.getPreferencesService().getString(GDB_UI_PLUGIN_ID, + return Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, null); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java index f54e30acdab..1eb1c639fd0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java @@ -201,7 +201,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend { public String getGDBInitFile() throws CoreException { if (fGDBInitFile == null) { - String defaultGdbInit = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + String defaultGdbInit = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT, null); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java index d629d6c385f..d3b7e7349fb 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java @@ -362,7 +362,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses { // Also, for a core session, there is no concept of killing the inferior, // so lets kill GDB if (fBackend.getSessionType() == SessionType.CORE || - Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null)) { fGdb.terminate(rm); @@ -635,7 +635,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses { if (e.getDMContext() instanceof IContainerDMContext) { fConnected = false; - if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null)) { // If the inferior finishes, let's terminate GDB diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java index a27adb3b5a8..832e2d1881e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java @@ -1189,7 +1189,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService // so lets kill GDB if (fBackend.getSessionType() == SessionType.CORE || (fNumConnected == 1 && - Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null))) { fCommandControl.terminate(rm); @@ -1405,7 +1405,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService assert fNumConnected > 0; fNumConnected--; - if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null)) { if (fNumConnected == 0 && !fProcRestarting) { diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java index 6439b22acf3..1bb9327f822 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java @@ -26,6 +26,7 @@ import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExitedDMEvent; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses; import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; @@ -109,7 +110,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase { @Test public void restartWhileTargetRunningKillGDB() throws Throwable { // First set the preference to kill GDB (although it should not happen in this test) - Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.cdt.dsf.gdb.ui"); + Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true); // The target is currently stopped. We resume to get it running @@ -132,7 +133,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase { @Test public void restartWhileTargetRunningGDBAlive() throws Throwable { // First set the preference not to kill gdb - Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.cdt.dsf.gdb.ui"); + Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false); // The target is currently stopped. We resume to get it running @@ -155,7 +156,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase { @Test public void terminateWhileTargetRunningKillGDB() throws Throwable { // First set the preference to kill GDB - Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.cdt.dsf.gdb.ui"); + Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true); // The target is currently stopped. We resume to get it running @@ -192,7 +193,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase { @Test public void terminateWhileTargetRunningKeepGDBAlive() throws Throwable { // First set the preference not to kill gdb - Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.cdt.dsf.gdb.ui"); + Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false); // The target is currently stopped. We resume to get it running @@ -244,7 +245,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase { @Test public void detachWhileTargetRunningKillGDB() throws Throwable { // First set the preference to kill GDB - Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.cdt.dsf.gdb.ui"); + Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true); // The target is currently stopped. We resume to get it running @@ -280,7 +281,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase { @Test public void detachWhileTargetRunningGDBAlive() throws Throwable { // First set the preference not to kill gdb - Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.cdt.dsf.gdb.ui"); + Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false); // The target is currently stopped. We resume to get it running diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java index b32278f1044..d9dcb48a28a 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java @@ -35,6 +35,7 @@ import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor; import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryManager; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.ILaunchConfiguration; @@ -362,7 +363,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { public void initializeFrom(ILaunchConfiguration configuration) { try { - String defaultGdbCommand = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + String defaultGdbCommand = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,"", null); //$NON-NLS-1$ String gdbCommandAttr = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand); gdbCommand.setText(gdbCommandAttr); @@ -453,7 +454,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { } public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - String defaultGdbCommand = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ + String defaultGdbCommand = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, "", null); //$NON-NLS-1$ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand);