diff options
author | Darin Wright | 2009-11-12 20:03:34 +0000 |
---|---|---|
committer | Darin Wright | 2009-11-12 20:03:34 +0000 |
commit | 92698767bf2efdc2e3593c7bdc85bfef39f0577b (patch) | |
tree | 6530987b34d056524c1b14775460593f7dd23933 /org.eclipse.debug.core | |
parent | 0fa95669809df9a1b738e67cd443931ad5427627 (diff) | |
download | eclipse.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
Diffstat (limited to 'org.eclipse.debug.core')
9 files changed, 43 insertions, 586 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 |