Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-05-16 11:26:50 +0000
committerUwe Stieber2012-05-16 11:28:58 +0000
commita7169af26fdc4587176181834fb52930965ab87a (patch)
tree5801b61fb0fd20e0279c1ed334978551f29b691b /target_explorer/plugins/org.eclipse.tcf.te.launch.core
parent23928d4dbc8a573bfd3f96bf794ef77e19dc5a7d (diff)
downloadorg.eclipse.tcf-a7169af26fdc4587176181834fb52930965ab87a.tar.gz
org.eclipse.tcf-a7169af26fdc4587176181834fb52930965ab87a.tar.xz
org.eclipse.tcf-a7169af26fdc4587176181834fb52930965ab87a.zip
Target Explorer: ADD DnD support for launches
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java234
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchSpecification.java528
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java64
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java5
6 files changed, 434 insertions, 460 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java
index 1a5119fe9..2cec6cff7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java
@@ -1,108 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.launch.core.lm;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.ILaunchMode;
-
-/**
- * Static launch configuration utility implementations.
- */
-public class LaunchConfigHelper {
-
- /**
- * Get a sorted list of all launch modes for the given launch configuration type.
- *
- * @param launchConfigType The launch configuration type.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of supported launch modes.
- */
- public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType launchConfigType, boolean reverse) {
- return getLaunchConfigTypeModes(new ILaunchConfigurationType[] { launchConfigType }, reverse);
- }
-
- /**
- * Get a sorted list of all launch modes for the given launch configuration types.
- *
- * @param launchConfigTypes The launch configuration types.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of supported launch modes.
- */
- public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType[] launchConfigTypes, boolean reverse) {
- List<String> modes = new ArrayList<String>();
- for (ILaunchConfigurationType launchConfigType : launchConfigTypes) {
- for (Object modeCombination : launchConfigType.getSupportedModeCombinations()) {
- if (((Set<?>) modeCombination).size() == 1) {
- String mode = (String) ((Set<?>) modeCombination).toArray()[0];
- if (!modes.contains(mode)) {
- modes.add(mode);
- }
- }
- }
- }
- return getLaunchModesSorted(modes.toArray(new String[modes.size()]), reverse);
- }
-
- /**
- * Gets a sorted list of launch mode identifiers.
- *
- * @param launchModes The launch modes. Must not be <code>null</code>.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of launch mode identifiers.
- */
- public static String[] getLaunchModesSorted(ILaunchMode[] launchModes, boolean reverse) {
- Assert.isNotNull(launchModes);
-
- String[] modes = new String[launchModes.length];
- for (int i = 0; i < launchModes.length; i++) {
- modes[i] = launchModes[i].getIdentifier();
- }
- return getLaunchModesSorted(modes, reverse);
- }
-
- /**
- * Gets a sorted list of launch mode identifiers.
- *
- * @param launchModes The unsorted list of launch modes identifiers. Must not be <code>null</code>.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of launch mode identifiers.
- */
- public static String[] getLaunchModesSorted(String[] launchModes, final boolean reverse) {
- Assert.isNotNull(launchModes);
-
- // sort the list of launch modes
- // Run is always the first, followed by Debug.
- // All other modes are sorted alphabetically at the end of the list.
- Arrays.sort(launchModes, new Comparator<String>() {
- @Override
- public int compare(String o1, String o2) {
- if (o1.equals(ILaunchManager.RUN_MODE) && !o2.equals(ILaunchManager.RUN_MODE)) return reverse ? 1 : -1;
- if (o2.equals(ILaunchManager.RUN_MODE) && !o1.equals(ILaunchManager.RUN_MODE)) return reverse ? -1 : 1;
- if (o1.equals(ILaunchManager.DEBUG_MODE) && !o2.equals(ILaunchManager.DEBUG_MODE)) return reverse ? 1 : -1;
- if (o2.equals(ILaunchManager.DEBUG_MODE) && !o1.equals(ILaunchManager.DEBUG_MODE)) return reverse ? -1 : 1;
- return reverse ? o2.compareTo(o1) : o1.compareTo(o2);
- }
- });
-
- return launchModes;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.launch.core.lm;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchMode;
+
+/**
+ * Static launch configuration utility implementations.
+ */
+public class LaunchConfigHelper {
+
+ /**
+ * Generate a unique launch config name.
+ * @param name The suggested name.
+ * @return The unique name.
+ */
+ public static String getUniqueLaunchConfigName(String name) {
+ return DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name);
+ }
+
+ /**
+ * Get a sorted list of all launch modes for the given launch configuration type.
+ *
+ * @param launchConfigType The launch configuration type.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of supported launch modes.
+ */
+ public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType launchConfigType, boolean reverse) {
+ return getLaunchConfigTypeModes(new ILaunchConfigurationType[] { launchConfigType }, reverse);
+ }
+
+ /**
+ * Get a sorted list of all launch modes for the given launch configuration types.
+ *
+ * @param launchConfigTypes The launch configuration types.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of supported launch modes.
+ */
+ public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType[] launchConfigTypes, boolean reverse) {
+ List<String> modes = new ArrayList<String>();
+ for (ILaunchConfigurationType launchConfigType : launchConfigTypes) {
+ for (Object modeCombination : launchConfigType.getSupportedModeCombinations()) {
+ if (((Set<?>) modeCombination).size() == 1) {
+ String mode = (String) ((Set<?>) modeCombination).toArray()[0];
+ if (!modes.contains(mode)) {
+ modes.add(mode);
+ }
+ }
+ }
+ }
+ return getLaunchModesSorted(modes.toArray(new String[modes.size()]), reverse);
+ }
+
+ /**
+ * Gets a sorted list of launch mode identifiers.
+ *
+ * @param launchModes The launch modes. Must not be <code>null</code>.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of launch mode identifiers.
+ */
+ public static String[] getLaunchModesSorted(ILaunchMode[] launchModes, boolean reverse) {
+ Assert.isNotNull(launchModes);
+
+ String[] modes = new String[launchModes.length];
+ for (int i = 0; i < launchModes.length; i++) {
+ modes[i] = launchModes[i].getIdentifier();
+ }
+ return getLaunchModesSorted(modes, reverse);
+ }
+
+ /**
+ * Gets a sorted list of launch mode identifiers.
+ *
+ * @param launchModes The unsorted list of launch modes identifiers. Must not be <code>null</code>.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of launch mode identifiers.
+ */
+ public static String[] getLaunchModesSorted(String[] launchModes, final boolean reverse) {
+ Assert.isNotNull(launchModes);
+
+ // sort the list of launch modes
+ // Run is always the first, followed by Debug.
+ // All other modes are sorted alphabetically at the end of the list.
+ Arrays.sort(launchModes, new Comparator<String>() {
+ @Override
+ public int compare(String o1, String o2) {
+ if (o1.equals(ILaunchManager.RUN_MODE) && !o2.equals(ILaunchManager.RUN_MODE)) {
+ return reverse ? 1 : -1;
+ }
+ if (o2.equals(ILaunchManager.RUN_MODE) && !o1.equals(ILaunchManager.RUN_MODE)) {
+ return reverse ? -1 : 1;
+ }
+ if (o1.equals(ILaunchManager.DEBUG_MODE) && !o2.equals(ILaunchManager.DEBUG_MODE)) {
+ return reverse ? 1 : -1;
+ }
+ if (o2.equals(ILaunchManager.DEBUG_MODE) && !o1.equals(ILaunchManager.DEBUG_MODE)) {
+ return reverse ? -1 : 1;
+ }
+ return reverse ? o2.compareTo(o1) : o1.compareTo(o2);
+ }
+ });
+
+ return launchModes;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java
index 23cb4e8bf..45022fd48 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java
@@ -218,11 +218,7 @@ public class LaunchManager extends PlatformObject {
.equals(launchConfigTypeId)) {
try {
// create the launch configuration working copy instance
- wc = launchConfigType.newInstance(null, DebugPlugin
- .getDefault()
- .getLaunchManager()
- .generateLaunchConfigurationName(launchSpec
- .getLaunchConfigName()));
+ wc = launchConfigType.newInstance(null, LaunchConfigHelper.getUniqueLaunchConfigName(launchSpec.getLaunchConfigName()));
// initialize the launch configuration working copy
delegate.initLaunchConfigAttributes(wc, launchSpec);
// and save the launch configuration
@@ -420,18 +416,4 @@ public class LaunchManager extends PlatformObject {
throw new LaunchServiceException(e);
}
}
-
- /**
- * Remove all illegal characters in the launch configuration name candidate.
- *
- * @param candidate The launch configuration name candidate.
- * @return The unified launch configuration name.
- */
- public static String getUnifiedLaunchConfigName(String candidate) {
- if (candidate != null) {
- candidate = candidate.replaceAll("[/\\\"&?:@*]", "_"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return candidate;
- }
-
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchSpecification.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchSpecification.java
index ab5716ab0..114d0160a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchSpecification.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchSpecification.java
@@ -1,262 +1,266 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.launch.core.lm;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchAttribute;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
-import org.eclipse.tcf.te.launch.core.nls.Messages;
-
-/**
- * Default launch specification implementation.
- */
-public class LaunchSpecification extends PlatformObject implements ILaunchSpecification {
- private final Map<String, ILaunchAttribute> attributes = new Hashtable<String, ILaunchAttribute>();
- private final String typeId;
- private final String mode;
- private String launchConfigName;
- private String launchActionLabel;
- private boolean readOnly;
- private boolean valid = true;
- private String errorMessage = null;
-
- /**
- * Constructor.
- * <p>
- * Creates a new launch specification instance for the specified launch configuration type
- * id and the specified launch mode. The launch specification is not locked against modifications
- * by default!
- *
- * @param typeId The launch configuration type id of the described launch configuration.
- * @param mode The launch mode. @see <code>org.eclipse.debug.core.ILaunchManager</code>!
- */
- public LaunchSpecification(String typeId, String mode) {
- super();
- this.typeId = typeId;
- this.mode = mode;
- this.attributes.clear();
- setReadOnly(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchConfigurationTypeId()
- */
- @Override
- public String getLaunchConfigurationTypeId() {
- return typeId;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchMode()
- */
- @Override
- public String getLaunchMode() {
- return mode;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isReadOnly()
- */
- @Override
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setReadOnly(boolean)
- */
- @Override
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#addAttribute(java.lang.String, java.lang.Object)
- */
- @Override
- public void addAttribute(String key, Object value) {
- addAttribute(key, value, false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#addAttribute(java.lang.String, java.lang.Object, boolean)
- */
- @Override
- public void addAttribute(String key, Object value, boolean createOnly) {
- Assert.isNotNull(key);
-
- if (isReadOnly()) return;
-
- // Attention: If the value == null -> remove the key from the map!!!
- if (value != null) {
- attributes.put(key, new LaunchAttribute(key, value, createOnly));
- }
- else {
- attributes.remove(key);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#hasAttribute(java.lang.String)
- */
- @Override
- public boolean hasAttribute(String key) {
- Assert.isNotNull(key);
- return attributes.containsKey(key);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#removeAttribute(java.lang.String)
- */
- @Override
- public Object removeAttribute(String key) {
- Assert.isNotNull(key);
- if (isReadOnly()) return null;
- return attributes.remove(key);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isCreateOnlyAttribute(java.lang.String)
- */
- @Override
- public boolean isCreateOnlyAttribute(String key) {
- Assert.isNotNull(key);
- ILaunchAttribute attribute = getAttribute(key);
- return attribute != null && attribute.isCreateOnlyAttribute();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getAttribute(java.lang.String, java.lang.Object)
- */
- @Override
- public Object getAttribute(String key, Object defaultValue) {
- Assert.isNotNull(key);
- ILaunchAttribute attribute = getAttribute(key);
- return (attribute != null && attribute.getValue() != null) ? attribute.getValue() : defaultValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#clear()
- */
- @Override
- public void clear() {
- if (isReadOnly()) {
- return;
- }
- attributes.clear();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#size()
- */
- @Override
- public int size() {
- return attributes.size();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isEmpty()
- */
- @Override
- public boolean isEmpty() {
- return attributes.isEmpty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getAttribute(java.lang.String)
- */
- @Override
- public ILaunchAttribute getAttribute(String key) {
- Assert.isNotNull(key);
- return attributes.get(key);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getAllAttributes()
- */
- @Override
- public ILaunchAttribute[] getAllAttributes() {
- return attributes.values().toArray(new ILaunchAttribute[attributes.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchActionLabel()
- */
- @Override
- public String getLaunchActionLabel() {
- return launchActionLabel;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchConfigName()
- */
- @Override
- public String getLaunchConfigName() {
- return launchConfigName != null ? launchConfigName : Messages.DefaultLaunchManagerDelegate_defaultLaunchName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setLaunchActionLabel(java.lang.String)
- */
- @Override
- public void setLaunchActionLabel(String launchActionLabel) {
- this.launchActionLabel = launchActionLabel;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setLaunchConfigName(java.lang.String)
- */
- @Override
- public void setLaunchConfigName(String launchConfigName) {
- this.launchConfigName = LaunchManager.getUnifiedLaunchConfigName(launchConfigName);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isValid()
- */
- @Override
- public boolean isValid() {
- return valid;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setIsValid(boolean)
- */
- @Override
- public void setIsValid(boolean valid) {
- this.valid = valid;
- if (valid) {
- errorMessage = null;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getErrorMessage()
- */
- @Override
- public String getErrorMessage() {
- if (!isValid()) {
- return errorMessage;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setErrorMessage(java.lang.String)
- */
- @Override
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.launch.core.lm;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchAttribute;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.nls.Messages;
+
+/**
+ * Default launch specification implementation.
+ */
+public class LaunchSpecification extends PlatformObject implements ILaunchSpecification {
+ private final Map<String, ILaunchAttribute> attributes = new Hashtable<String, ILaunchAttribute>();
+ private final String typeId;
+ private final String mode;
+ private String launchConfigName;
+ private String launchActionLabel;
+ private boolean readOnly;
+ private boolean valid = true;
+ private String errorMessage = null;
+
+ /**
+ * Constructor.
+ * <p>
+ * Creates a new launch specification instance for the specified launch configuration type
+ * id and the specified launch mode. The launch specification is not locked against modifications
+ * by default!
+ *
+ * @param typeId The launch configuration type id of the described launch configuration.
+ * @param mode The launch mode. @see <code>org.eclipse.debug.core.ILaunchManager</code>!
+ */
+ public LaunchSpecification(String typeId, String mode) {
+ super();
+ this.typeId = typeId;
+ this.mode = mode;
+ this.attributes.clear();
+ setReadOnly(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchConfigurationTypeId()
+ */
+ @Override
+ public String getLaunchConfigurationTypeId() {
+ return typeId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchMode()
+ */
+ @Override
+ public String getLaunchMode() {
+ return mode;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setReadOnly(boolean)
+ */
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#addAttribute(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void addAttribute(String key, Object value) {
+ addAttribute(key, value, false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#addAttribute(java.lang.String, java.lang.Object, boolean)
+ */
+ @Override
+ public void addAttribute(String key, Object value, boolean createOnly) {
+ Assert.isNotNull(key);
+
+ if (isReadOnly()) {
+ return;
+ }
+
+ // Attention: If the value == null -> remove the key from the map!!!
+ if (value != null) {
+ attributes.put(key, new LaunchAttribute(key, value, createOnly));
+ }
+ else {
+ attributes.remove(key);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#hasAttribute(java.lang.String)
+ */
+ @Override
+ public boolean hasAttribute(String key) {
+ Assert.isNotNull(key);
+ return attributes.containsKey(key);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#removeAttribute(java.lang.String)
+ */
+ @Override
+ public Object removeAttribute(String key) {
+ Assert.isNotNull(key);
+ if (isReadOnly()) {
+ return null;
+ }
+ return attributes.remove(key);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isCreateOnlyAttribute(java.lang.String)
+ */
+ @Override
+ public boolean isCreateOnlyAttribute(String key) {
+ Assert.isNotNull(key);
+ ILaunchAttribute attribute = getAttribute(key);
+ return attribute != null && attribute.isCreateOnlyAttribute();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getAttribute(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public Object getAttribute(String key, Object defaultValue) {
+ Assert.isNotNull(key);
+ ILaunchAttribute attribute = getAttribute(key);
+ return (attribute != null && attribute.getValue() != null) ? attribute.getValue() : defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#clear()
+ */
+ @Override
+ public void clear() {
+ if (isReadOnly()) {
+ return;
+ }
+ attributes.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#size()
+ */
+ @Override
+ public int size() {
+ return attributes.size();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isEmpty()
+ */
+ @Override
+ public boolean isEmpty() {
+ return attributes.isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getAttribute(java.lang.String)
+ */
+ @Override
+ public ILaunchAttribute getAttribute(String key) {
+ Assert.isNotNull(key);
+ return attributes.get(key);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getAllAttributes()
+ */
+ @Override
+ public ILaunchAttribute[] getAllAttributes() {
+ return attributes.values().toArray(new ILaunchAttribute[attributes.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchActionLabel()
+ */
+ @Override
+ public String getLaunchActionLabel() {
+ return launchActionLabel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getLaunchConfigName()
+ */
+ @Override
+ public String getLaunchConfigName() {
+ return launchConfigName != null ? launchConfigName : Messages.DefaultLaunchManagerDelegate_defaultLaunchName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setLaunchActionLabel(java.lang.String)
+ */
+ @Override
+ public void setLaunchActionLabel(String launchActionLabel) {
+ this.launchActionLabel = launchActionLabel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setLaunchConfigName(java.lang.String)
+ */
+ @Override
+ public void setLaunchConfigName(String launchConfigName) {
+ this.launchConfigName = LaunchConfigHelper.getUniqueLaunchConfigName(launchConfigName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ return valid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setIsValid(boolean)
+ */
+ @Override
+ public void setIsValid(boolean valid) {
+ this.valid = valid;
+ if (valid) {
+ errorMessage = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#getErrorMessage()
+ */
+ @Override
+ public String getErrorMessage() {
+ if (!isValid()) {
+ return errorMessage;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification#setErrorMessage(java.lang.String)
+ */
+ @Override
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
index 458b6ed1a..9c482faf5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
@@ -22,7 +22,6 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
@@ -54,11 +53,6 @@ import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransfer
* Default launch manager delegate implementation.
*/
public class DefaultLaunchManagerDelegate extends ExecutableExtension implements ILaunchManagerDelegate {
- protected final static int NO_MATCH = 0;
- protected final static int PARTIAL_MATCH = 1;
- protected final static int FULL_MATCH = 2;
-
- protected String errorMessage = null;
/**
* Constructor.
@@ -97,6 +91,15 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
validateLaunchSpecification(launchSpec);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#updateLaunchConfig(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext, boolean)
+ */
+ @Override
+ public void updateLaunchConfig(ILaunchConfigurationWorkingCopy wc, ISelectionContext selContext, boolean replace) {
+ Assert.isNotNull(wc);
+ Assert.isNotNull(selContext);
+ }
+
@Override
public boolean isDefaultAttribute(String attributeKey, Object specValue, Object confValue, ILaunchSpecification launchSpec, ILaunchConfiguration launchConfig, String launchMode) {
Assert.isNotNull(attributeKey);
@@ -216,9 +219,14 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
*/
@Override
public String getDefaultLaunchName(ILaunchSpecification launchSpec) {
- if (launchSpec.getLaunchConfigName() != null) {
- return launchSpec.getLaunchConfigName();
- }
+ return Messages.DefaultLaunchManagerDelegate_defaultLaunchName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#getDefaultLaunchName(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public String getDefaultLaunchName(ILaunchConfiguration launchConfig) {
return Messages.DefaultLaunchManagerDelegate_defaultLaunchName;
}
@@ -577,7 +585,7 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
* @see #getAttributeRanking(String)
*/
protected int getFullMatchRanking() {
- return 0;
+ return 1;
}
/**
@@ -747,34 +755,6 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#showLaunchConfigOnly()
- */
- @Override
- public boolean showLaunchConfigOnly() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#showLaunchConfigSelectionDialog(org.eclipse.debug.core.ILaunchConfigurationType, org.eclipse.debug.core.ILaunchConfiguration[])
- */
- @Override
- public boolean showLaunchConfigSelectionDialog(ILaunchConfigurationType type, ILaunchConfiguration[] launchConfigs) {
- if (type != null) {
- String key = type.getIdentifier() + ".hideLaunchConfigSelectionDialog"; //$NON-NLS-1$
- return !CoreBundleActivator.getScopedPreferences().getBoolean(key);
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#getErrorMessage()
- */
- @Override
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#equals(org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext)
*/
@Override
@@ -782,14 +762,6 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
return (ctx1 == null && ctx2 == null) || (ctx1 != null && ctx1.equals(ctx2));
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#useDefaultConnection()
- */
- @Override
- public boolean useDefaultConnection() {
- return true;
- }
-
@Override
public String getDescription(ILaunchConfiguration config) {
return config.getName();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java
index 2c8135f00..7a012a753 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java
@@ -10,7 +10,6 @@
package org.eclipse.tcf.te.launch.core.lm.interfaces;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.tcf.te.launch.core.exceptions.LaunchServiceException;
import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection;
@@ -72,6 +71,16 @@ public interface ILaunchManagerDelegate extends IExecutableExtension {
public void updateLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec);
/**
+ * Updates a launch configuration with the given selection context.
+ *
+ * @param wc The launch configuration working copy.
+ * @param selContext The selection context to use for the update.
+ * @param replace <code>true</code> if existing attribute values should be replaced,
+ * <code>false</code> if data from the selection context should be added to existing values.
+ */
+ public void updateLaunchConfig(ILaunchConfigurationWorkingCopy wc, ISelectionContext selContext, boolean replace);
+
+ /**
* Test the specified attribute if or if not the specified attribute value is an default value or not.
*
* @param attributeKey The attribute key/name. Must not be <code>null</code>.
@@ -106,6 +115,14 @@ public interface ILaunchManagerDelegate extends IExecutableExtension {
public String getDefaultLaunchName(ILaunchSpecification launchSpec);
/**
+ * Get the default launch configuration name.
+ *
+ * @param launchConfig The launch configuration to create a default name for the launch config. Must not be <code>null</code>.
+ * @return The default launch configuration name.
+ */
+ public String getDefaultLaunchName(ILaunchConfiguration launchConfig);
+
+ /**
* Get a launch specification with all needed attributes for this delegate taken from the selection to find or create a new
* launch configuration.
*
@@ -142,25 +159,6 @@ public interface ILaunchManagerDelegate extends IExecutableExtension {
public boolean showLaunchDialog(int situation);
/**
- * Returns true, if the launch dialog should only show the given launch configuration (no launch configuration type tree).
- */
- public boolean showLaunchConfigOnly();
-
- /**
- * Returns <code>true</code> if a dialog should pop up when at least one matching
- * launch configuration was found.
- * If <code>false</code> is returned, the first matching launch configuration will be used.
- *
- * @param type The launch configuration type to check.
- */
- public boolean showLaunchConfigSelectionDialog(ILaunchConfigurationType type, ILaunchConfiguration[] launchConfigs);
-
- /**
- * Returns the error message when not valid, otherwise <code>null</code>.
- */
- public String getErrorMessage();
-
- /**
* Return <code>true</code> if the two selection contexts are equal
* for this launch configuration type.
*
@@ -172,11 +170,6 @@ public interface ILaunchManagerDelegate extends IExecutableExtension {
public boolean equals(ISelectionContext ctx1, ISelectionContext ctx2);
/**
- * Return <code>true</code> if a default connection should be used when the connection selection is empty.
- */
- public boolean useDefaultConnection();
-
- /**
* Get a short description for the given launch configuration.
* @param config The launch configuration.
* @return The description.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
index 5140628c5..ca39a9b9a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
@@ -25,6 +25,11 @@ public class ReferencedProjectItem extends PropertiesContainer implements IRefer
setProperty(PROPERTY_ENABLED, true);
}
+ public ReferencedProjectItem(String projectName) {
+ this();
+ setProperty(PROPERTY_PROJECT_NAME, projectName);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem#isEnabled()
*/

Back to the top