Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2009-11-12 15:03:34 -0500
committerDarin Wright2009-11-12 15:03:34 -0500
commit92698767bf2efdc2e3593c7bdc85bfef39f0577b (patch)
tree6530987b34d056524c1b14775460593f7dd23933
parent0fa95669809df9a1b738e67cd443931ad5427627 (diff)
downloadeclipse.platform.debug-92698767bf2efdc2e3593c7bdc85bfef39f0577b.tar.gz
eclipse.platform.debug-92698767bf2efdc2e3593c7bdc85bfef39f0577b.tar.xz
eclipse.platform.debug-92698767bf2efdc2e3593c7bdc85bfef39f0577b.zip
REVERT CHANGES FOR Bug 41353 - [launching] Launch config templates
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java115
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java57
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java62
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java54
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java90
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java113
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java28
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java70
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java40
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java257
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java15
11 files changed, 50 insertions, 851 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
index 53050c1ba..5dbbf4e0d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation 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
@@ -90,39 +90,6 @@ public interface ILaunchConfiguration extends IAdaptable {
*/
public static final String ATTR_SOURCE_LOCATOR_MEMENTO = DebugPlugin.getUniqueIdentifier() + ".source_locator_memento"; //$NON-NLS-1$
-
- /**
- * Flag indicating that only this configuration is to be modified by an operation.
- * Any template children referring to this configuration will not be modified.
- *
- * @since 3.6
- */
- public static final int UPDATE_NONE = 0;
-
- /**
- * Flag indicating that this configuration and any effected template children of this template
- * should be updated when this configuration is modified.
- *
- * @since 3.6
- */
- public static final int UPDATE_TEMPLATE_CHILDREN = 1;
-
- /**
- * Type constant (bit mask value 1) which identifies a launch configuration.
- *
- * @see #getKind()
- * @since 3.6
- */
- public static final int CONFIGURATION = 0x1;
-
- /**
- * Type constant (bit mask value 2) which identifies a template.
- *
- * @see #getKind()
- * @since 3.6
- */
- public static final int TEMPLATE = 0x2;
-
/**
* Returns whether the contents of this launch configuration are
* equal to the contents of the given launch configuration.
@@ -157,9 +124,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* Deletes this launch configuration. This configuration's underlying
* storage is deleted. Has no effect if this configuration
* does not exist.
- * <p>
- * Equivalent to #delete(UPDATE_NONE)
- * </p>
+ *
* @exception CoreException if this method fails. Reasons include:
* <ul>
* <li>An exception occurs while deleting this configuration's
@@ -169,24 +134,6 @@ public interface ILaunchConfiguration extends IAdaptable {
public void delete() throws CoreException;
/**
- * Deletes this launch configuration. This configuration's underlying
- * storage is deleted. Has no effect if this configuration
- * does not exist.
- * <p>
- * When UPDATE_TEMPLATE_CHILDREN is specified, back pointers to this template
- * are cleared in any template children.
- * </p>
- * @param flag one of UPDATE_NONE or UPDATE_TEMPLATE_CHILDREN
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while deleting this configuration's
- * underlying storage or updating any template children.</li>
- * </ul>
- * @since 3.6
- */
- public void delete(int flag) throws CoreException;
-
- /**
* Returns whether this launch configuration's underlying
* storage exists. This is a handle-only method.
*
@@ -649,62 +596,4 @@ public interface ILaunchConfiguration extends IAdaptable {
* @since 3.3
*/
public boolean isReadOnly();
-
- /**
- * Returns the template this launch configuration was created from
- * or <code>null</code> if none.
- *
- * @return the template this launch configuration was created from
- * or <code>null</code> if none
- * @throws CoreException if the template could not be retrieved
- * or no longer exists
- * @since 3.6
- */
- public ILaunchConfiguration getTemplate() throws CoreException;
-
- /**
- * Returns a map of attributes in this launch configuration that are
- * different from the specified attributes. Returns an empty map if
- * this launch configuration contains equivalent attributes. A <code>null</code>
- * value is returned for attributes not contained in this launch configuration.
- *
- * @param attributes to compare to
- * @return a map of attributes in this launch configuration that
- * are different from the specified attributes
- * @throws CoreException if an exception occurs while comparing
- * @since 3.6
- */
- public Map findDifferences(Map attributes) throws CoreException;
-
- /**
- * Returns whether this configuration is a template.
- *
- * @return whether this configuration is a template
- * @throws CoreException if unable to determine if this configuration is a template
- * or if this configuration does not exist
- * @since 3.6
- */
- public boolean isTemplate() throws CoreException;
-
- /**
- * Returns all configurations made from this template, possibly an
- * empty collection.
- *
- * @return all configurations made from this template
- * @throws CoreException
- * @since 3.6
- */
- public ILaunchConfiguration[] getTemplateChildren() throws CoreException;
-
- /**
- * Returns this configuration's kind. One of CONFIGURATION or TEMPLATE.
- *
- * @see #CONFIGURATION
- * @see #TEMPLATE
- *
- * @return this configuration's kind
- * @throws CoreException if unable to retrieve this configuration's kind
- * @since 3.6
- */
- public int getKind() throws CoreException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
index d9b744144..ded6948a1 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation 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
@@ -276,7 +276,7 @@ public interface ILaunchConfigurationType extends IAdaptable {
* When <code>container</code> is </code>null</code>, the configuration
* will reside locally in the metadata area.
* Note: a launch configuration is not actually created until the working copy is saved.
- *
+ *
* @param container the container in which the new configuration will
* reside, or <code>null</code> if the configuration should reside
* locally with the metadata.
@@ -289,25 +289,6 @@ public interface ILaunchConfigurationType extends IAdaptable {
public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) throws CoreException;
/**
- * Returns a new launch configuration template working copy of this type,
- * that resides in the specified container, with the given name.
- * When <code>container</code> is </code>null</code>, the configuration
- * will reside locally in the metadata area.
- * Note: a launch configuration is not actually created until the working copy is saved.
- *
- * @param container the container in which the new configuration will
- * reside, or <code>null</code> if the configuration should reside
- * locally with the metadata.
- * @param name name for the launch configuration
- * @return a new launch configuration working copy template of this type
- * @exception CoreException if an instance of this type
- * of launch configuration could not be created for any
- * reason
- * @since 3.6
- */
- public ILaunchConfigurationWorkingCopy newTemplate(IContainer container, String name) throws CoreException;
-
- /**
* Returns whether this type of launch configuration supports
* the specified mode.
*
@@ -325,36 +306,6 @@ public interface ILaunchConfigurationType extends IAdaptable {
* @return name of contributing plug-in
* @since 3.3
*/
- public String getContributorName();
-
- /**
- * Returns all launch configuration templates of the this type, possibly
- * an empty collection.
- *
- * @return all launch configuration templates of the this type
- * @throws CoreException if unable to retrieve the templates
- * @since 3.6
- */
- public ILaunchConfiguration[] getTemplates() throws CoreException;
-
- /**
- * Returns a new launch configuration working copy of this type,
- * that resides in the specified container, with the given name, initialized
- * with values from the given template.
- * When <code>container</code> is </code>null</code>, the configuration
- * will reside locally in the metadata area.
- * Note: a launch configuration is not actually created until the working copy is saved.
- *
- * @param container the container in which the new configuration will
- * reside, or <code>null</code> if the configuration should reside
- * locally with the metadata.
- * @param name name for the launch configuration
- * @param template launch configuration template, or <code>null</code>
- * @return a new launch configuration working copy instance of this type
- * @exception CoreException if an instance of this type
- * of launch configuration could not be created for any
- * reason
- * @since 3.6
- */
- public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name, ILaunchConfiguration template) throws CoreException;
+ public String getContributorName();
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
index d1595452d..2a8ac2a89 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation 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
@@ -64,40 +64,11 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* saved to the parent working copy and the parent working copy is returned without
* effecting the original launch configuration.
* </p>
- * <p>
- * Equivalent to #doSave(UPDATE_NONE).
- * </p>
* @return handle to saved launch configuration
* @exception CoreException if an exception occurs while
* writing this configuration to its underlying file.
- * @see #doSave(int)
*/
public ILaunchConfiguration doSave() throws CoreException;
-
- /**
- * Saves this working copy to its underlying file and returns
- * a handle to the resulting launch configuration.
- * Has no effect if this configuration does not need saving.
- * Creates the underlying file if not yet created.
- * <p>
- * Since 3.3, if this is a nested working copy, the contents of this working copy are
- * saved to the parent working copy and the parent working copy is returned without
- * effecting the original launch configuration.
- * </p>
- * <p>
- * Updates any affected template children based on the given flag. When a working
- * copy is renamed or moved to a new location, template children's back pointers
- * will be updated to refer the proper configuration.
- * </p>
- * @param flag one of {@link ILaunchConfiguration#UPDATE_NONE} or
- * {@link ILaunchConfiguration#UPDATE_TEMPLATE_CHILDREN}
- * @return handle to saved launch configuration
- * @exception CoreException if an exception occurs while
- * writing this configuration or any of its affected template children
- * to underlying storage
- * @since 3.6
- */
- public ILaunchConfiguration doSave(int flag) throws CoreException;
/**
* Sets the integer-valued attribute with the given name.
@@ -292,35 +263,4 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* @since 3.3
*/
public ILaunchConfigurationWorkingCopy getParent();
-
- /**
- * Copies all attributes from the given template to this working.
- * Overwrites any existing attributes with the same key.
- *
- * @param template configuration template
- * @exception CoreException if unable to retrieve attributes from the template
- * @since 3.6
- */
- public void copyAttributes(ILaunchConfiguration template) throws CoreException;
-
- /**
- * Sets the template that this configuration is based on, possibly <code>null</code>,
- * and optionally copies attributes from the template to this working copy.
- * <p>
- * When the specified template is <code>null</code>, this working copy is no longer
- * associated with any template.
- * </p>
- * @param template template or <code>null</code>
- * @param copy whether to copy attributes from the template to this working copy. Has
- * no effect when template is <code>null</code>
- * @exception CoreException if
- * <ul>
- * <li>unable to generate a memento for the given configuration
- * or copy its attributes</li>
- * <li>if attempting to set a template attribute on an existing template - templates
- * cannot be nested</li>
- * </ul>
- * @since 3.6
- */
- public void setTemplate(ILaunchConfiguration template, boolean copy) throws CoreException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
index 4ed20fed0..99c3b17c6 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
@@ -128,7 +128,7 @@ public interface ILaunchManager {
* @param namePrefix the String that the returned name must begin with
* @return launch configuration name
* @since 2.0
- * @deprecated since 3.6 clients should use the {@link #generateLaunchConfigurationName(String)} method which
+ * @deprecated since 3.5 clients should use the {@link #generateLaunchConfigurationName(String)} method which
* will perform validation of the name and correct unsupported name parts.
*/
public String generateUniqueLaunchConfigurationNameFrom(String namePrefix);
@@ -207,9 +207,7 @@ public interface ILaunchManager {
* in the specified file. This method does not check if the specified <code>IFile</code> is
* a launch configuration file or that it exists in the local or
* remote file system.
- * <p>
- * Since 3.6, the returned configuration may be a launch configuration template.
- * </p>
+ *
* @param file launch configuration file
* @return a handle to the launch configuration contained
* in the specified file
@@ -219,9 +217,7 @@ public interface ILaunchManager {
/**
* Returns a handle to the launch configuration specified by
* the given memento. The configuration may not exist.
- * <p>
- * Since 3.6, the returned configuration may be a launch configuration template.
- * </p>
+ *
* @param memento launch configuration memento
* @return a handle to the launch configuration specified by
* the given memento
@@ -233,64 +229,24 @@ public interface ILaunchManager {
public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException;
/**
* Returns all launch configurations defined in the workspace.
- * <p>
- * Does not include launch configuration templates. Equivalent to
- * #getLaunchConfigurations(ILaunchConfiguration.CONFIGURATION).
- * </p>
+ *
* @return all launch configurations defined in the workspace
* @exception CoreException if an exception occurs retrieving configurations
* @since 2.0
- * @see ILaunchConfigurationType#getTemplates()
*/
public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException;
-
- /**
- * Returns all launch configurations defined in the workspace of the specified
- * kind(s) (configurations and/or templates).
- *
- * @param kinds bit mask of kinds of configurations to consider
- * @return all launch configurations defined in the workspace
- * @exception CoreException if an exception occurs retrieving configurations
- * @since 3.6
- * @see ILaunchConfiguration#CONFIGURATION
- * @see ILaunchConfiguration#TEMPLATE
- * @see ILaunchConfiguration#getKind()
- * @see ILaunchConfigurationType#getTemplates()
- */
- public ILaunchConfiguration[] getLaunchConfigurations(int kinds) throws CoreException;
-
/**
* Returns all launch configurations of the specified type defined in the workspace
- * <p>
- * Does not include launch configuration templates.
- * </p>
+ *
* @param type a launch configuration type
* @return all launch configurations of the specified type defined in the workspace
* @exception CoreException if an error occurs while retrieving
* a launch configuration
* @since 2.0
- * @see ILaunchConfigurationType#getTemplates()
*/
public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException;
/**
- * Returns all launch configurations of the specified type defined in the workspace
- * of the specified kind(s) (configurations and/or templates).
- *
- * @param type a launch configuration type
- * @param kinds bit mask of kinds of configurations to consider
- * @return all launch configurations of the specified type defined in the workspace
- * @exception CoreException if an error occurs while retrieving
- * a launch configuration
- * @since 3.6
- * @see ILaunchConfiguration#CONFIGURATION
- * @see ILaunchConfiguration#TEMPLATE
- * @see ILaunchConfiguration#getKind()
- * @see ILaunchConfigurationType#getTemplates()
- */
- public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type, int kinds) throws CoreException;
-
- /**
* Returns the launch configuration type extension with the specified
* id, or <code>null</code> if it does not exist.
*
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
index 4e5c8a73c..141f43e12 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
@@ -17,13 +17,10 @@ import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -110,14 +107,6 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
* @since 3.3
*/
public static final String ATTR_PREFERRED_LAUNCHERS = DebugPlugin.getUniqueIdentifier() + ".preferred_launchers"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute storing a memento identifying the template
- * this configuration was made from, possibly <code>null</code>.
- *
- * @since 3.6
- */
- public static final String ATTR_TEMPLATE = DebugPlugin.getUniqueIdentifier() + ".ATTR_TEMPLATE"; //$NON-NLS-1$
/**
* Status handler to prompt in the UI thread
@@ -312,22 +301,6 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#delete(int)
- */
- public void delete(int flag) throws CoreException {
- if (flag == UPDATE_TEMPLATE_CHILDREN && isTemplate()) {
- // clear back pointers to this configuration
- ILaunchConfiguration[] children = getTemplateChildren();
- for (int i = 0; i < children.length; i++) {
- ILaunchConfigurationWorkingCopy child = children[i].getWorkingCopy();
- child.setTemplate(null, false);
- child.doSave();
- }
- }
- delete();
- }
-
/**
* Returns whether this configuration is equal to the
* given configuration. Two configurations are equal if
@@ -977,69 +950,6 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
public String toString() {
return getName();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#getTemplate()
- */
- public ILaunchConfiguration getTemplate() throws CoreException {
- String memento = getAttribute(ATTR_TEMPLATE, (String)null);
- if (memento != null) {
- return new LaunchConfiguration(memento);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#getTemplateChildren()
- */
- public ILaunchConfiguration[] getTemplateChildren() throws CoreException {
- ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(getType());
- List proteges = new ArrayList();
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration config = configurations[i];
- if (this.equals(config.getTemplate())) {
- proteges.add(config);
- }
- }
- return (ILaunchConfiguration[]) proteges.toArray(new ILaunchConfiguration[proteges.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#isTemplate()
- */
- public boolean isTemplate() throws CoreException {
- return getInfo().isTemplate();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#getKind()
- */
- public int getKind() throws CoreException {
- if (isTemplate()) {
- return TEMPLATE;
- }
- return CONFIGURATION;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfiguration#findDifferences(java.util.Map)
- */
- public Map findDifferences(Map attributes) throws CoreException {
- Map result = new HashMap();
- Set entries = attributes.entrySet();
- Iterator iterator = entries.iterator();
- LaunchConfigurationInfo info = getInfo();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
- String key = (String) entry.getKey();
- Object attr1 = entry.getValue();
- Object attr2 = info.getObjectAttribute(key);
- if (!LaunchConfigurationInfo.compareAttribute(key, attr1, attr2)) {
- result.put(key, attr2);
- }
- }
- return result;
- }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
index 5bbac3fe5..db79a6a4e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
@@ -59,7 +59,6 @@ public class LaunchConfigurationInfo {
private static final String INT_ATTRIBUTE = "intAttribute"; //$NON-NLS-1$
private static final String STRING_ATTRIBUTE = "stringAttribute"; //$NON-NLS-1$
private static final String TYPE = "type"; //$NON-NLS-1$
- private static final String TEMPLATE = "template"; //$NON-NLS-1$
/**
* This configurations attribute table. Keys are <code>String</code>s and
@@ -74,16 +73,6 @@ public class LaunchConfigurationInfo {
private ILaunchConfigurationType fType;
/**
- * Whether this configuration is a template
- */
- private boolean fIsTemplate = false;
-
- /**
- * Static access to the launch manager.
- */
- private static LaunchManager fgLaunchManager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
-
- /**
* Whether running on Sun 1.4 VM - see bug 110215
*/
private static boolean fgIsSun14x = false;
@@ -265,16 +254,6 @@ public class LaunchConfigurationInfo {
}
/**
- * Returns the raw object from the attribute table or <code>null</code> if none.
- *
- * @param key attribute key
- * @return raw attribute value
- */
- protected Object getObjectAttribute(String key) {
- return getAttributeTable().get(key);
- }
-
- /**
* Returns the <code>java.util.Map</code> attribute with the given key or
* the given default value if undefined.
*
@@ -328,7 +307,6 @@ public class LaunchConfigurationInfo {
LaunchConfigurationInfo copy = new LaunchConfigurationInfo();
copy.setType(getType());
copy.setAttributeTable(getAttributes());
- copy.setTemplate(isTemplate());
return copy;
}
@@ -378,9 +356,6 @@ public class LaunchConfigurationInfo {
doc.appendChild(configRootElement);
configRootElement.setAttribute(TYPE, getType().getIdentifier());
- if (isTemplate()) {
- configRootElement.setAttribute(TEMPLATE, Boolean.TRUE.toString());
- }
Iterator keys = getAttributeTable().keySet().iterator();
while (keys.hasNext()) {
@@ -532,13 +507,6 @@ public class LaunchConfigurationInfo {
}
setType(type);
- String template = root.getAttribute(TEMPLATE);
- boolean is = false;
- if (template != null && template.length() > 0) {
- is = Boolean.valueOf(template).booleanValue();
- }
- setTemplate(is);
-
NodeList list = root.getChildNodes();
Node node = null;
Element element = null;
@@ -751,15 +719,38 @@ public class LaunchConfigurationInfo {
* @return whether the two attribute maps are equal
*/
protected boolean compareAttributes(TreeMap map1, TreeMap map2) {
+ LaunchManager manager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
if (map1.size() == map2.size()) {
Iterator attributes = map1.keySet().iterator();
while (attributes.hasNext()) {
String key = (String)attributes.next();
Object attr1 = map1.get(key);
Object attr2 = map2.get(key);
- if (!compareAttribute(key, attr1, attr2)) {
+ if (attr2 == null) {
return false;
}
+ Comparator comp = manager.getComparator(key);
+ if (comp == null) {
+ if (fgIsSun14x) {
+ if(attr2 instanceof String & attr1 instanceof String) {
+ // this is a hack for bug 110215, on SUN 1.4.x, \r
+ // is stripped off when the stream is written to the
+ // DOM
+ // this is not the case for 1.5.x, so to be safe we
+ // are stripping \r off all strings before we
+ // compare for equality
+ attr1 = ((String)attr1).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ attr2 = ((String)attr2).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ if (!attr1.equals(attr2)) {
+ return false;
+ }
+ } else {
+ if (comp.compare(attr1, attr2) != 0) {
+ return false;
+ }
+ }
}
return true;
}
@@ -767,43 +758,6 @@ public class LaunchConfigurationInfo {
}
/**
- * Returns whether the two attributes are equal, considering comparator extensions.
- *
- * @param key attribute key
- * @param attr1 attribute value
- * @param attr2 attribute value to compare to, possibly <code>null</code>
- * @return whether equivalent
- */
- protected static boolean compareAttribute(String key, Object attr1, Object attr2) {
- if (attr2 == null) {
- return false;
- }
- Comparator comp = fgLaunchManager.getComparator(key);
- if (comp == null) {
- if (fgIsSun14x) {
- if(attr2 instanceof String & attr1 instanceof String) {
- // this is a hack for bug 110215, on SUN 1.4.x, \r
- // is stripped off when the stream is written to the
- // DOM
- // this is not the case for 1.5.x, so to be safe we
- // are stripping \r off all strings before we
- // compare for equality
- attr1 = ((String)attr1).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
- attr2 = ((String)attr2).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- if (!attr1.equals(attr2)) {
- return false;
- }
- } else {
- if (comp.compare(attr1, attr2) != 0) {
- return false;
- }
- }
- return true;
- }
-
- /**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
@@ -836,24 +790,5 @@ public class LaunchConfigurationInfo {
}
return null;
}
-
- /**
- * Sets whether this info is a template.
- *
- * @param isTemplate
- * @throws CoreException
- */
- void setTemplate(boolean isTemplate) {
- fIsTemplate = isTemplate;
- }
-
- /**
- * Returns whether this info is a template.
- *
- * @return whether a template
- */
- boolean isTemplate() {
- return fIsTemplate;
- }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
index ef31b20cf..a33a579c6 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation 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
@@ -487,31 +487,5 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
return fModeCombinations.contains(modes);
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationType#getTemplates()
- */
- public ILaunchConfiguration[] getTemplates() throws CoreException {
- return DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(this, ILaunchConfiguration.TEMPLATE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationType#newTemplate(org.eclipse.core.resources.IContainer, java.lang.String)
- */
- public ILaunchConfigurationWorkingCopy newTemplate(IContainer container, String name) throws CoreException {
- LaunchConfigurationWorkingCopy wc = new LaunchConfigurationWorkingCopy(container, name, this);
- wc.setTemplate(true);
- return wc;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationType#newInstance(org.eclipse.core.resources.IContainer, java.lang.String, org.eclipse.debug.core.ILaunchConfiguration)
- */
- public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name, ILaunchConfiguration template) throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newInstance(container, name);
- if (template != null) {
- wc.setTemplate(template, true);
- }
- return wc;
- }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index d65760f08..fffc54a7c 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -17,11 +17,9 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
@@ -717,73 +715,5 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
public Object removeAttribute(String attributeName) {
return getInfo().removeAttribute(attributeName);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#copyAttributes(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void copyAttributes(ILaunchConfiguration template) throws CoreException {
- Map map = template.getAttributes();
- Iterator iterator = map.entrySet().iterator();
- LaunchConfigurationInfo info = getInfo();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
- String attr = (String) entry.getKey();
- info.setAttribute(attr, entry.getValue());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setTemplate(org.eclipse.debug.core.ILaunchConfiguration, boolean)
- */
- public void setTemplate(ILaunchConfiguration template, boolean copy) throws CoreException {
- if (template != null && !template.isTemplate()) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugCoreMessages.LaunchConfigurationWorkingCopy_8));
- }
- if (template != null && template.isWorkingCopy()) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugCoreMessages.LaunchConfigurationWorkingCopy_6));
- }
- if (template == null) {
- removeAttribute(ATTR_TEMPLATE);
- } else {
- if (isTemplate()) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugCoreMessages.LaunchConfigurationWorkingCopy_7));
- }
- if (copy) {
- copyAttributes(template);
- }
- setAttribute(ATTR_TEMPLATE, template.getMemento());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#doSave(int)
- */
- public ILaunchConfiguration doSave(int flag) throws CoreException {
- ILaunchConfiguration[] children = null;
- if (UPDATE_TEMPLATE_CHILDREN == flag) {
- if (!isNew() && isMoved() && getParent() == null) {
- children = getOriginal().getTemplateChildren();
- }
- }
- ILaunchConfiguration saved = doSave();
- if (children != null) {
- for (int i = 0; i < children.length; i++) {
- ILaunchConfigurationWorkingCopy wc = children[i].getWorkingCopy();
- wc.setTemplate(saved, false);
- wc.doSave();
- }
- }
- return saved;
- }
-
- /**
- * Sets whether this working copy is a template.
- *
- * @param template whether a template
- * @since 3.6
- */
- void setTemplate(boolean template) {
- getInfo().setTemplate(template);
- }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index c0d1d62ac..8ad00cb48 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -1108,8 +1108,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*/
protected synchronized String[] getAllSortedConfigNames() {
if (fSortedConfigNames == null) {
- List collection = getAllLaunchConfigurations();
- ILaunchConfiguration[] configs = (ILaunchConfiguration[]) collection.toArray(new ILaunchConfiguration[collection.size()]);
+ ILaunchConfiguration[] configs = getLaunchConfigurations();
fSortedConfigNames = new String[configs.length];
for (int i = 0; i < configs.length; i++) {
fSortedConfigNames[i] = configs[i].getName();
@@ -1377,53 +1376,26 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* @see ILaunchManager#getLaunchConfigurations()
*/
- public synchronized ILaunchConfiguration[] getLaunchConfigurations() throws CoreException {
- return getLaunchConfigurations(ILaunchConfiguration.CONFIGURATION);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchManager#getLaunchConfigurations(int)
- */
- public ILaunchConfiguration[] getLaunchConfigurations(int kinds) throws CoreException {
+ public synchronized ILaunchConfiguration[] getLaunchConfigurations() {
List allConfigs = getAllLaunchConfigurations();
- if (((kinds & ILaunchConfiguration.CONFIGURATION) > 0) && ((kinds & ILaunchConfiguration.TEMPLATE) > 0)) {
- // all kinds
- return (ILaunchConfiguration[])allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]);
- } else {
- List select = new ArrayList(allConfigs.size());
- Iterator iterator = allConfigs.iterator();
- while (iterator.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration) iterator.next();
- if ((config.getKind() & kinds) > 0) {
- select.add(config);
- }
- }
- return (ILaunchConfiguration[]) select.toArray(new ILaunchConfiguration[select.size()]);
- }
- }
+ return (ILaunchConfiguration[])allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]);
+ }
/**
* @see ILaunchManager#getLaunchConfigurations(ILaunchConfigurationType)
*/
public synchronized ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
- return getLaunchConfigurations(type, ILaunchConfiguration.CONFIGURATION);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchManager#getLaunchConfigurations(org.eclipse.debug.core.ILaunchConfigurationType, int)
- */
- public synchronized ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type, int kinds) throws CoreException {
Iterator iter = getAllLaunchConfigurations().iterator();
List configs = new ArrayList();
ILaunchConfiguration config = null;
while (iter.hasNext()) {
config = (ILaunchConfiguration)iter.next();
- if (config.getType().equals(type) && ((config.getKind() & kinds) > 0)) {
+ if (config.getType().equals(type)) {
configs.add(config);
}
}
return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
- }
+ }
/**
* Returns all launch configurations that are stored as resources
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
index c9de10cba..71d9ad534 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
@@ -140,28 +140,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertTrue("Should need saving", wc.isDirty()); //$NON-NLS-1$
return wc;
}
-
- /**
- * Creates and returns a new launch config the given name, local
- * or shared, with 4 attributes:
- * - String1 = "String1"
- * - Int1 = 1
- * - Boolean1 = true
- * - Boolean2 = false
- */
- protected ILaunchConfigurationWorkingCopy newTemplate(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- assertTrue("Should support debug mode", type.supportsMode(ILaunchManager.DEBUG_MODE)); //$NON-NLS-1$
- assertTrue("Should support run mode", type.supportsMode(ILaunchManager.RUN_MODE)); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc = type.newTemplate(container, name);
- wc.setAttribute("String1", "String1"); //$NON-NLS-1$ //$NON-NLS-2$
- wc.setAttribute("Int1", 1); //$NON-NLS-1$
- wc.setAttribute("Boolean1", true); //$NON-NLS-1$
- wc.setAttribute("Boolean2", false); //$NON-NLS-1$
- assertTrue("Should need saving", wc.isDirty()); //$NON-NLS-1$
- return wc;
- }
-
+
/**
* Creates and returns a new launch configuration with the given name, local
* or shared, with no attributes
@@ -172,17 +151,6 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertEquals("Should have no attributes", 0, wc.getAttributes().size());
return wc;
}
-
- /**
- * Creates and returns a new launch configuration template with the given name, local
- * or shared, with no attributes
- */
- protected ILaunchConfigurationWorkingCopy newEmptyTemplate(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- ILaunchConfigurationWorkingCopy wc = type.newTemplate(container, name);
- assertEquals("Should have no attributes", 0, wc.getAttributes().size());
- return wc;
- }
/**
* Returns whether the given handle is contained in the specified
@@ -1077,228 +1045,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
IPath location = workingCopy.getLocation();
assertEquals("Wrong path for local working copy", LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.append("test-get-location.launch"), location);
}
-
- /**
- * Test copying attributes from one configuration to another.
- *
- * @throws CoreException
- */
- public void testCopyAttributes() throws CoreException {
- ILaunchConfigurationWorkingCopy source = newConfiguration(null, "test-copy-attributes-source");
- ILaunchConfigurationWorkingCopy dest = newEmptyConfiguration(null, "test-copy-attributes-dest");
- dest.copyAttributes(source);
- assertTrue("String1 should be String1", dest.getAttribute("String1", "Missing").equals("String1"));
- assertTrue("Int1 should be 1", dest.getAttribute("Int1", 0) == 1);
- assertTrue("Boolean1 should be true", dest.getAttribute("Boolean1", false));
- assertTrue("Boolean2 should be false", !dest.getAttribute("Boolean2", true));
- }
-
- /**
- * Tests that creation from a template works.
- *
- * @throws CoreException
- */
- public void testCreationFromTemplate() throws CoreException {
- ILaunchConfigurationWorkingCopy temp = newTemplate(null, "test-creation-from-template");
- temp.setAttribute("TEMPLATE", "TEMPLATE");
- ILaunchConfiguration template = temp.doSave();
- ILaunchConfigurationType type = temp.getType();
-
- // create a new configuration in project scope priority
- ILaunchConfigurationWorkingCopy config = type.newInstance(null, "test-scopes", template);
- assertNotNull("Made from wrong template", config.getAttribute("TEMPLATE", (String)null));
- assertEquals("Should refer to creation template", template, config.getTemplate());
- }
-
- /**
- * Tests setting the 'isTemplate' attribute.
- *
- * @throws CoreException
- */
- public void testIsTemplate() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newTemplate(null, "test-is-template");
- ILaunchConfiguration template = wc.doSave();
- assertTrue("Should be a template", template.isTemplate());
- ILaunchConfiguration[] templates = wc.getType().getTemplates();
- List list = new ArrayList();
- for (int i = 0; i < templates.length; i++) {
- list.add(templates[i]);
- }
- assertFalse("Expecting at least template", list.isEmpty());
- assertTrue("Missing created template", list.contains(template));
- }
-
- /**
- * Tests finding references to a template.
- *
- * @throws CoreException
- */
- public void testTemplateChildren() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newTemplate(null, "test-references");
- ILaunchConfiguration template = wc.doSave();
-
- ILaunchConfigurationWorkingCopy r1 = newConfiguration(null, "referee-1");
- ILaunchConfigurationWorkingCopy r2 = newConfiguration(null, "referee-2");
-
- r1.setTemplate(template, false);
- r2.setTemplate(template, false);
-
- ILaunchConfiguration s1 = r1.doSave();
- ILaunchConfiguration s2 = r2.doSave();
-
- ILaunchConfiguration[] children = template.getTemplateChildren();
- assertEquals("Wrong number of template children", 2, children.length);
- List list = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- list.add(children[i]);
- }
- assertTrue("Missing reference", list.contains(s1));
- assertTrue("Missing reference", list.contains(s2));
- }
-
- /**
- * Tests that when an attribute is removed from a working copy, it does not
- * get inherited from its template.
- *
- * @throws CoreException
- */
- public void testTemplateRemoveBehavior() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "test-remove");
- ILaunchConfigurationWorkingCopy t1 = newEmptyTemplate(null, "template-1");
- t1.setAttribute("COMMON", "TEMPLATE-1");
- t1.setAttribute("T1", "T1");
- t1.setAttribute("String1", "String2");
- ILaunchConfiguration template = t1.doSave();
-
- assertEquals("String1", wc.getAttribute("String1", "wrong"));
-
- wc.setTemplate(template, true);
- wc.removeAttribute("String1");
- assertEquals("TEMPLATE-1", wc.getAttribute("COMMON", (String)null));
- assertEquals("T1", wc.getAttribute("T1", (String)null));
- assertNull(wc.getAttribute("String1", (String)null));
-
- }
-
- /**
- * Tests that setting a configuration's template to null cleans its template
- * association.
- *
- * @throws CoreException
- */
- public void testUnTemplate() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "test-un-template");
- ILaunchConfigurationWorkingCopy t1 = newEmptyTemplate(null, "template-un");
- t1.setAttribute("COMMON", "TEMPLATE-1");
- t1.setAttribute("T1", "T1");
- t1.setAttribute("String1", "String2");
- ILaunchConfiguration template = t1.doSave();
- wc.setTemplate(template, true);
- ILaunchConfiguration configuration = wc.doSave();
- assertEquals(template, configuration.getTemplate());
- wc = configuration.getWorkingCopy();
- wc.setTemplate(null, false);
- configuration = wc.doSave();
- assertNull(configuration.getTemplate());
- ILaunchConfiguration[] children = t1.getTemplateChildren();
- assertEquals(0, children.length);
- }
-
- /**
- * Tests that nested templates are not allowed.
- *
- * @throws CoreException
- */
- public void testNestedTemplates() throws CoreException {
- ILaunchConfigurationWorkingCopy t1 = newTemplate(null, "test-nest-root");
- ILaunchConfigurationWorkingCopy t2 = newTemplate(null, "template-nested");
- ILaunchConfiguration template = t1.doSave();
- try {
- t2.setTemplate(template, true);
- } catch (CoreException e) {
- return;
- }
- assertTrue("Shoud not be able to nest templates", false);
- }
-
- /**
- * Test that you cannot set a config's template to be a non-template.
- *
- * @throws CoreException
- */
- public void testIllegalTemplate() throws CoreException {
- ILaunchConfigurationWorkingCopy c1 = newConfiguration(null, "test-config");
- ILaunchConfigurationWorkingCopy t1 = newConfiguration(null, "test-not-a-template");
- ILaunchConfiguration config = t1.doSave();
- try {
- c1.setTemplate(config, true);
- } catch (CoreException e) {
- // expected
- return;
- }
- assertTrue("Should not be able to set configration as template", false);
- }
-
- /**
- * Test that a template can be duplicated (and results in a template).
- *
- * @throws CoreException
- */
- public void testCopyTemplate() throws CoreException {
- ILaunchConfigurationWorkingCopy t1 = newEmptyTemplate(null, "template-to-duplicate");
- ILaunchConfigurationWorkingCopy t2 = t1.copy("duplicate-template");
- assertTrue(t2.isTemplate());
- }
-
- /**
- * Tests that a template that adds an attribute is not considered to override any template
- * values.
- *
- * @throws CoreException
- */
- public void testTemplateNoOverride() throws CoreException {
- ILaunchConfigurationWorkingCopy t1 = newTemplate(null, "2-b-the-same");
- ILaunchConfiguration template = t1.doSave();
- ILaunchConfigurationWorkingCopy wc = template.getType().newInstance(null, "will-b-the-same", template);
- wc.setAttribute("EXTEND-ATTRIBUTES", "EXTEND-ATTRIBUTES");
- Map dif = wc.findDifferences(template.getAttributes());
- assertTrue("Should not override any values", dif.isEmpty());
- }
-
- /**
- * Tests that a template that changes an attribute is considered to override its template
- * values.
- *
- * @throws CoreException
- */
- public void testTemplateOverride() throws CoreException {
- ILaunchConfigurationWorkingCopy t1 = newTemplate(null, "2-b-diff");
- ILaunchConfiguration template = t1.doSave();
- ILaunchConfigurationWorkingCopy wc = template.getType().newInstance(null, "will-b-diff", template);
- wc.setAttribute("String1", "String2");
- Map dif = wc.findDifferences(template.getAttributes());
- assertEquals("Should override String1 value", 1, dif.size());
- assertTrue("Should override String1 value", dif.containsKey("String1"));
- assertEquals("Should override String1 value with String2", "String2", dif.get("String1"));
- }
-
- /**
- * Test that a configuration that omits a template value shows the difference with
- * a <code>null</code> entry in the difference map.
- *
- * @throws CoreException
- */
- public void testMissingTemaplteValue() throws CoreException {
- ILaunchConfigurationWorkingCopy t1 = newTemplate(null, "2-b-missing");
- ILaunchConfiguration template = t1.doSave();
- ILaunchConfigurationWorkingCopy wc = template.getType().newInstance(null, "will-b-diff", template);
- wc.removeAttribute("String1");
- Map dif = wc.findDifferences(template.getAttributes());
- assertEquals("Should be missing String1 value", 1, dif.size());
- assertTrue("Should be missing String1 value", dif.containsKey("String1"));
- assertNull("Should be null value", dif.get("String1"));
- }
-
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index a99b47815..1ddbe86c2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -30,7 +30,6 @@ import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.IEvaluationContext;
@@ -572,13 +571,9 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
history.setFavorites(favs);
// add any favorites that have been added to the workspace before this plug-in
// was loaded - @see bug 231600
- try {
- ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(ILaunchConfiguration.CONFIGURATION);
- for (int j = 0; j < configurations.length; j++) {
- history.checkFavorites(configurations[j]);
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e.getStatus());
+ ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations();
+ for (int j = 0; j < configurations.length; j++) {
+ history.checkFavorites(configurations[j]);
}
}
}
@@ -1055,8 +1050,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
* @return the singleton instance of the launch manager
* @since 3.3
*/
- private ILaunchManager getLaunchManager() {
- return DebugPlugin.getDefault().getLaunchManager();
+ private LaunchManager getLaunchManager() {
+ return (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
}
/**

Back to the top