Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-05-26 10:29:37 -0400
committerUwe Stieber2015-05-26 10:29:37 -0400
commit7899b6e69276fd87bdc9946a3c860e15469676f9 (patch)
tree4c63c39602b9983892474612594aee239fef9260
parente2dc5858a2108badc760082559b1c936370fb56d (diff)
downloadorg.eclipse.tcf-7899b6e69276fd87bdc9946a3c860e15469676f9.tar.gz
org.eclipse.tcf-7899b6e69276fd87bdc9946a3c860e15469676f9.tar.xz
org.eclipse.tcf-7899b6e69276fd87bdc9946a3c860e15469676f9.zip
Target Explorer: Added more preference slots to customize the CDT launch configurations
-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.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/IPreferenceKeys.java34
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/preferences/PreferencesInitializer.java37
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEGdbDebuggerPage.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java31
6 files changed, 109 insertions, 17 deletions
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 e2600f3b9..0953da5a4 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
@@ -135,11 +135,11 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate {
}
// Launch gdbserver on target
- 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, 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);
+ final AtomicReference<String> gdbserverPortNumber = new AtomicReference<String>(config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT, TEHelper.getStringPreferenceValue(isAttachLaunch ? IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH : IPreferenceKeys.PREF_GDBSERVER_PORT)));
+ final AtomicReference<String> gdbserverPortNumberMappedTo = new AtomicReference<String>(config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO, TEHelper.getStringPreferenceValue(isAttachLaunch ? IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH_MAPPED_TO : IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO)));
+ final String gdbserverCommand = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND, TEHelper.getStringPreferenceValue(isAttachLaunch ? IPreferenceKeys.PREF_GDBSERVER_COMMAND_ATTACH : IPreferenceKeys.PREF_GDBSERVER_COMMAND));
+ final List<String> gdbserverPortNumberAlternatives = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_ALTERNATIVES, TEHelper.getListPreferenceValue(isAttachLaunch ? IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH_ALTERNATIVES : IPreferenceKeys.PREF_GDBSERVER_PORT_ALTERNATIVES));
+ final List<String> gdbserverPortNumberMappedToAlternatives = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO_ALTERNATIVES, TEHelper.getListPreferenceValue(isAttachLaunch ? IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH_MAPPED_TO_ALTERNATIVES : IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO_ALTERNATIVES));
// For quick testing.
// final List<String> gdbserverPortNumberAlternatives = new ArrayList<String>(Arrays.asList(new String[] { "49152", "49153", "49154", "49155", "49156" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
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 2594003fa..b8260bb79 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 MontaVista Software, LLC. and others. All rights reserved.
+ * Copyright (c) 2013 - 2015 MontaVista Software, LLC. 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
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
index 2f17eaacb..67aad7392 100644
--- 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
@@ -36,4 +36,38 @@ public interface IPreferenceKeys {
*/
public static final String PREF_GDBSERVER_PORT_MAPPED_TO = PREFIX + ".gdbserver.portMappedTo"; //$NON-NLS-1$
+ /**
+ * The list of alternate (remote) gdbserver port (String, comma-separated).
+ */
+ public static final String PREF_GDBSERVER_PORT_ALTERNATIVES = PREFIX + ".gdbserver.port.alternatives"; //$NON-NLS-1$
+
+ /**
+ * The list of alternate (local) gdbserver port (String, comma-separated).
+ */
+ public static final String PREF_GDBSERVER_PORT_MAPPED_TO_ALTERNATIVES = PREFIX + ".gdbserver.portMappedTo.alternatives"; //$NON-NLS-1$
+
+ /**
+ * The default gdbserver command (String) (attach).
+ */
+ public static final String PREF_GDBSERVER_COMMAND_ATTACH = PREFIX + ".gdbserver.command.attach"; //$NON-NLS-1$
+
+ /**
+ * The default (remote) gdbserver port (String) (attach).
+ */
+ public static final String PREF_GDBSERVER_PORT_ATTACH = PREFIX + ".gdbserver.port.attach"; //$NON-NLS-1$
+
+ /**
+ * The default (local) gdbserver port (String) (attach).
+ */
+ public static final String PREF_GDBSERVER_PORT_ATTACH_MAPPED_TO = PREFIX + ".gdbserver.portMappedTo.attach"; //$NON-NLS-1$
+
+ /**
+ * The list of alternate (remote) gdbserver port (String, comma-separated) (attach).
+ */
+ public static final String PREF_GDBSERVER_PORT_ATTACH_ALTERNATIVES = PREFIX + ".gdbserver.port.attach.alternatives"; //$NON-NLS-1$
+
+ /**
+ * The list of alternate (local) gdbserver port (String, comma-separated) (attach).
+ */
+ public static final String PREF_GDBSERVER_PORT_ATTACH_MAPPED_TO_ALTERNATIVES = PREFIX + ".gdbserver.portMappedTo.attach.alternatives"; //$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
index 7182bb764..dbb5b0b7b 100644
--- 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
@@ -37,8 +37,43 @@ public class PreferencesInitializer extends AbstractPreferenceInitializer {
store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT, "2345"); //$NON-NLS-1$
/**
+ * Gdbserver (remote) port alternatives: N/A
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_ALTERNATIVES, null);
+
+ /**
* Gdbserver default (local) port: N/A
*/
- store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT, null);
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO, null);
+
+ /**
+ * Gdbserver (local) port alternatives: N/A
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO_ALTERNATIVES, null);
+
+ /**
+ * Gdbserver default command (attach): gdbserver
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH, "gdbserver"); //$NON-NLS-1$
+
+ /**
+ * Gdbserver default (remote) port (attach): 2345
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH, "2345"); //$NON-NLS-1$
+
+ /**
+ * Gdbserver (remote) port alternatives (attach): N/A
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH_ALTERNATIVES, "2345"); //$NON-NLS-1$
+
+ /**
+ * Gdbserver default (local) port (attach): N/A
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH_MAPPED_TO, null);
+
+ /**
+ * Gdbserver (local) port alternatives (attach): N/A
+ */
+ store.putDefaultString(IPreferenceKeys.PREF_GDBSERVER_PORT_ATTACH_MAPPED_TO_ALTERNATIVES, 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 ac485c59e..9c9fdf0a9 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
@@ -59,11 +59,11 @@ public class TEGdbDebuggerPage extends GdbDebuggerPage {
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
super.setDefaults(configuration);
configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND,
- TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_COMMAND));
+ TEHelper.getStringPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_COMMAND));
configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT,
- TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT));
+ TEHelper.getStringPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT));
configuration.setAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO,
- TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO));
+ TEHelper.getStringPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO));
}
@Override
@@ -76,15 +76,15 @@ public class TEGdbDebuggerPage extends GdbDebuggerPage {
String portNumberMappedTo = null;
try {
gdbserverCommand = configuration.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND,
- TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_COMMAND));
+ TEHelper.getStringPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_COMMAND));
} catch (CoreException e) {}
try {
gdbserverPortNumber = configuration.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT,
- TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT));
+ TEHelper.getStringPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT));
} catch (CoreException e) {}
try {
portNumberMappedTo = configuration.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO,
- TEHelper.getPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO));
+ TEHelper.getStringPreferenceValue(IPreferenceKeys.PREF_GDBSERVER_PORT_MAPPED_TO));
} catch (CoreException e) {}
if (fGDBServerCommandText != null) fGDBServerCommandText.setText(gdbserverCommand);
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 5dcac2a9d..e262efcab 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
@@ -17,11 +17,13 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@@ -51,7 +53,6 @@ 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;
@@ -312,19 +313,41 @@ public class TEHelper {
}
/**
- * Returns the preference value for the given key. The method
+ * Returns the string preference value for the given key. The method
* allows overwriting the preference value via a system property.
*
+ * @param key The preference key. Must not be <code>null</code>.
* @return The preference value or <code>null</code> if the preference key does not exist.
*/
- public static String getPreferenceValue(String key) {
+ public static String getStringPreferenceValue(String key) {
+ Assert.isNotNull(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);
+ value = Activator.getScopedPreferences().getString(key);
}
return value;
}
+ /**
+ * Returns the list preference value for the given key. The method
+ * allows overwriting the preference value via a system property.
+ *
+ * @param key The preference key. Must not be <code>null</code>.
+ * @return The preference value or <code>null</code> if the preference key does not exist.
+ */
+ public static List<String> getListPreferenceValue(String key) {
+ Assert.isNotNull(key);
+
+ List<String> list = null;
+ String value = getStringPreferenceValue(key);
+ if (value != null && !"".equals(value)) { //$NON-NLS-1$
+ list = Arrays.asList(value.split("\\s*,\\s*")); //$NON-NLS-1$
+ }
+
+ return list;
+ }
+
}

Back to the top