Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-05-26 09:04:37 -0400
committerUwe Stieber2015-05-26 09:04:37 -0400
commit91ffc72f44582724cb87481d52cdf545ed916a17 (patch)
treedaf12d6d4c10e12cc4571e55e087f4de4672bb4c
parent316806429fcceb48e250604258de85722e554713 (diff)
downloadorg.eclipse.tcf-91ffc72f44582724cb87481d52cdf545ed916a17.tar.gz
org.eclipse.tcf-91ffc72f44582724cb87481d52cdf545ed916a17.tar.xz
org.eclipse.tcf-91ffc72f44582724cb87481d52cdf545ed916a17.zip
Target Explorer: Store default gdbserver command and ports in preferences to allow overwriting the defaults via plugin_customization.ini
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/plugin.xml8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/activator/Activator.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/interfaces/IRemoteTEConfigurationConstants.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/IPreferenceKeys.java39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/PreferencesInitializer.java44
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEGdbDebuggerPage.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java23
9 files changed, 175 insertions, 55 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/plugin.xml
index 23bf6539f..5bb5c8633 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/plugin.xml
@@ -148,4 +148,12 @@ Anna Dushistova (MontaVista) - adapted from org.eclipse.cdt.launch.remote
</tab>
</extension>
+
+<!-- Preference contributions -->
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.tcf.te.tcf.launch.cdt.preferences.PreferencesInitializer">
+ </initializer>
+ </extension>
+
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/activator/Activator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/activator/Activator.java
index 2a1e04997..df18f5e70 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/activator/Activator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/activator/Activator.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.cdt.activator;
+import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -19,11 +20,10 @@ import org.osgi.framework.BundleContext;
*/
public class Activator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.tcf.te.tcf.launch.cdt"; //$NON-NLS-1$
-
// The shared instance
private static Activator plugin;
+ // The scoped preferences instance
+ private static volatile ScopedEclipsePreferences scopedPreferences;
private boolean isTEInitialized = false;
@@ -33,6 +33,35 @@ public class Activator extends AbstractUIPlugin {
public Activator() {
}
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() != null && getDefault().getBundle() != null) {
+ return getDefault().getBundle().getSymbolicName();
+ }
+ return "org.eclipse.tcf.te.tcf.launch.cdt"; //$NON-NLS-1$
+ }
+
+ /**
+ * Return the scoped preferences for this plug-in.
+ */
+ public static ScopedEclipsePreferences getScopedPreferences() {
+ if (scopedPreferences == null) {
+ scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier());
+ }
+ return scopedPreferences;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@@ -51,14 +80,6 @@ public class Activator extends AbstractUIPlugin {
super.stop(context);
}
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
public void initializeTE() {
if(!isTEInitialized ){
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/interfaces/IRemoteTEConfigurationConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/interfaces/IRemoteTEConfigurationConstants.java
index d7a5dae33..1ce30ae53 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/interfaces/IRemoteTEConfigurationConstants.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/interfaces/IRemoteTEConfigurationConstants.java
@@ -24,9 +24,6 @@ public interface IRemoteTEConfigurationConstants {
public static final String ATTR_GDBSERVER_PORT_ALTERNATIVES = DebugPlugin.getUniqueIdentifier() + ".ATTR_GDBSERVER_PORT_ALTERNATIVES"; //$NON-NLS-1$
public static final String ATTR_GDBSERVER_PORT_MAPPED_TO_ALTERNATIVES = DebugPlugin.getUniqueIdentifier() + ".ATTR_GDBSERVER_PORT_MAPPED_TO_ALTERNATIVES"; //$NON-NLS-1$
- public static final String ATTR_GDBSERVER_PORT_DEFAULT = "2345"; //$NON-NLS-1$
- public static final String ATTR_GDBSERVER_COMMAND_DEFAULT = "gdbserver"; //$NON-NLS-1$
-
/*
* Generic Remote Path and Download options:
* ATTR_REMOTE_PATH: Path of the binary on the remote.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java
index 4f7818731..e2600f3b9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java
@@ -50,6 +50,7 @@ import org.eclipse.tcf.te.tcf.launch.cdt.activator.Activator;
import org.eclipse.tcf.te.tcf.launch.cdt.interfaces.IGdbserverLaunchHandlerDelegate;
import org.eclipse.tcf.te.tcf.launch.cdt.interfaces.IRemoteTEConfigurationConstants;
import org.eclipse.tcf.te.tcf.launch.cdt.nls.Messages;
+import org.eclipse.tcf.te.tcf.launch.cdt.preferences.IPreferenceKeys;
import org.eclipse.tcf.te.tcf.launch.cdt.utils.TEHelper;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessLauncher;
@@ -134,9 +135,9 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate {
}
// Launch gdbserver on target
- final AtomicReference<String> gdbserverPortNumber = new AtomicReference<String>(config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT, IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT));
+ final AtomicReference<String> gdbserverPortNumber = new AtomicReference<String>(config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT, TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT)));
final AtomicReference<String> gdbserverPortNumberMappedTo = new AtomicReference<String>(config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO, (String) null));
- final String gdbserverCommand = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND, IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
+ final String gdbserverCommand = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND, TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_COMMAND));
final List<String> gdbserverPortNumberAlternatives = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_ALTERNATIVES, (List<String>) null);
final List<String> gdbserverPortNumberMappedToAlternatives = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO_ALTERNATIVES, (List<String>) null);
@@ -441,9 +442,12 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate {
return args;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate#getPluginID()
+ */
@Override
protected String getPluginID() {
- return Activator.PLUGIN_ID;
+ return Activator.getUniqueIdentifier();
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java
index 34174a699..2594003fa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java
@@ -75,9 +75,12 @@ public class TERunLaunchDelegate extends AbstractCLaunchDelegate {
return exePath;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#getPluginID()
+ */
@Override
protected String getPluginID() {
- return Activator.PLUGIN_ID;
+ return Activator.getUniqueIdentifier();
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/IPreferenceKeys.java
new file mode 100644
index 000000000..2f17eaacb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/IPreferenceKeys.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.cdt.preferences;
+
+import org.eclipse.tcf.te.tcf.launch.cdt.activator.Activator;
+
+
+/**
+ * The CDT launch configuration extensions preference key identifiers.
+ */
+public interface IPreferenceKeys {
+ /**
+ * Common prefix for all core preference keys
+ */
+ public final String PREFIX = Activator.getUniqueIdentifier();
+
+ /**
+ * The default gdbserver command (String).
+ */
+ public static final String PREF_GDBSERVER_COMMAND = PREFIX + ".gdbserver.command"; //$NON-NLS-1$
+
+ /**
+ * The default (remote) gdbserver port (String).
+ */
+ public static final String PREF_GDBSERVER_PORT = PREFIX + ".gdbserver.port"; //$NON-NLS-1$
+
+ /**
+ * The default (local) gdbserver port (String).
+ */
+ public static final String PREF_GDBSERVER_PORT_MAPPED_TO = PREFIX + ".gdbserver.portMappedTo"; //$NON-NLS-1$
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/PreferencesInitializer.java
new file mode 100644
index 000000000..7182bb764
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/PreferencesInitializer.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.cdt.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
+import org.eclipse.tcf.te.tcf.launch.cdt.activator.Activator;
+
+/**
+ * Launch core framework preferences initializer implementation.
+ */
+public class PreferencesInitializer extends AbstractPreferenceInitializer {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ // Get the preferences store
+ ScopedEclipsePreferences store = Activator.getScopedPreferences();
+
+ /**
+ * Gdbserver default command: gdbserver
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT, "gdbserver"); //$NON-NLS-1$
+
+ /**
+ * Gdbserver default (remote) port: 2345
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT, "2345"); //$NON-NLS-1$
+
+ /**
+ * Gdbserver default (local) port: N/A
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT, null);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEGdbDebuggerPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEGdbDebuggerPage.java
index 253b9bfca..ac485c59e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEGdbDebuggerPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEGdbDebuggerPage.java
@@ -31,6 +31,8 @@ import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.te.tcf.launch.cdt.interfaces.IRemoteTEConfigurationConstants;
import org.eclipse.tcf.te.tcf.launch.cdt.nls.Messages;
+import org.eclipse.tcf.te.tcf.launch.cdt.preferences.IPreferenceKeys;
+import org.eclipse.tcf.te.tcf.launch.cdt.utils.TEHelper;
import org.eclipse.tcf.te.ui.controls.validator.PortNumberVerifyListener;
@SuppressWarnings("restriction")
@@ -56,15 +58,12 @@ public class TEGdbDebuggerPage extends GdbDebuggerPage {
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
super.setDefaults(configuration);
- configuration.setAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND,
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
- configuration.setAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT,
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
- configuration.setAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO,
- (String)null);
+ configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND,
+ TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_COMMAND));
+ configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT,
+ TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT));
+ configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO,
+ TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO));
}
@Override
@@ -76,26 +75,18 @@ public class TEGdbDebuggerPage extends GdbDebuggerPage {
String gdbserverPortNumber = null;
String portNumberMappedTo = null;
try {
- gdbserverCommand = configuration
- .getAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND,
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
- } catch (CoreException e) {
- }
+ gdbserverCommand = configuration.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND,
+ TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_COMMAND));
+ } catch (CoreException e) {}
try {
- gdbserverPortNumber = configuration
- .getAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT,
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
- } catch (CoreException e) {
- }
+ gdbserverPortNumber = configuration.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT,
+ TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT));
+ } catch (CoreException e) {}
try {
- portNumberMappedTo = configuration
- .getAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO,
- (String)null);
- } catch (CoreException e) {
- }
+ portNumberMappedTo = configuration.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO,
+ TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO));
+ } catch (CoreException e) {}
+
if (fGDBServerCommandText != null) fGDBServerCommandText.setText(gdbserverCommand);
if (fGDBServerPortNumberText != null) fGDBServerPortNumberText.setText(gdbserverPortNumber);
if (fGDBServerPortNumberMappedToText != null) fGDBServerPortNumberMappedToText.setText(portNumberMappedTo != null ? portNumberMappedTo : ""); //$NON-NLS-1$
@@ -106,15 +97,11 @@ public class TEGdbDebuggerPage extends GdbDebuggerPage {
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
super.performApply(configuration);
String str = fGDBServerCommandText != null ? fGDBServerCommandText.getText().trim() : null;
- configuration.setAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND, str);
+ configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND, str);
str = fGDBServerPortNumberText != null ? fGDBServerPortNumberText.getText().trim() : null;
- configuration.setAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT, str);
+ configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT, str);
str = fGDBServerPortNumberMappedToText != null ? fGDBServerPortNumberMappedToText.getText().trim() : null;
- configuration.setAttribute(
- IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO,
- str != null && !"".equals(str) ? str : null); //$NON-NLS-1$
+ configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO, str != null && !"".equals(str) ? str : null); //$NON-NLS-1$
}
protected void createGdbserverSettingsTab(TabFolder tabFolder) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java
index f225d140b..5dcac2a9d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java
@@ -51,6 +51,7 @@ import org.eclipse.tcf.te.tcf.filesystem.core.services.FileTransferService;
import org.eclipse.tcf.te.tcf.launch.cdt.activator.Activator;
import org.eclipse.tcf.te.tcf.launch.cdt.interfaces.IRemoteTEConfigurationConstants;
import org.eclipse.tcf.te.tcf.launch.cdt.nls.Messages;
+import org.eclipse.tcf.te.tcf.launch.cdt.preferences.IPreferenceKeys;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
@@ -293,13 +294,13 @@ public class TEHelper {
public static void abort(String message, Throwable exception, int code) throws CoreException {
IStatus status;
if (exception != null) {
- MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, code, message, exception);
- multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, exception
+ MultiStatus multiStatus = new MultiStatus(Activator.getUniqueIdentifier(), code, message, exception);
+ multiStatus.add(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), code, exception
.getLocalizedMessage(), exception));
status = multiStatus;
}
else {
- status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, message, null);
+ status = new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), code, message, null);
}
throw new CoreException(status);
}
@@ -310,4 +311,20 @@ public class TEHelper {
return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$
}
+ /**
+ * Returns the preference value for the given key. The method
+ * allows overwriting the preference value via a system property.
+ *
+ * @return The preference value or <code>null</code> if the preference key does not exist.
+ */
+ public static String getPreferenceValue(String key) {
+ // Try system properties first
+ String value = System.getProperty(key, null);
+ // If not set, try the preferences
+ if (value == null || "".equals(value)) { //$NON-NLS-1$
+ value = Activator.getScopedPreferences().getString(IPreferenceKeys.PREF_GDBSERVER_PORT);
+ }
+ return value;
+ }
+
}

Back to the top