diff options
author | Darin Wright | 2010-02-24 18:02:26 +0000 |
---|---|---|
committer | Darin Wright | 2010-02-24 18:02:26 +0000 |
commit | cbcecded1ee69948e9068393ca411af9fe51a925 (patch) | |
tree | 3210d0f790aedf30f7e4d7dcb0e834c6e4697f62 /org.eclipse.debug.core | |
parent | b0745d2d957e45339c2f5af5f2d9e3a08dc2497e (diff) | |
download | eclipse.platform.debug-cbcecded1ee69948e9068393ca411af9fe51a925.tar.gz eclipse.platform.debug-cbcecded1ee69948e9068393ca411af9fe51a925.tar.xz eclipse.platform.debug-cbcecded1ee69948e9068393ca411af9fe51a925.zip |
Bug 295843 - Sort tracingOptions' mapEntries by key
Diffstat (limited to 'org.eclipse.debug.core')
3 files changed, 32 insertions, 5 deletions
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 2a8ac2a89..a7ffcb85a 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, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -111,6 +111,18 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I public void setAttribute(String attributeName, Map value); /** + * Sets the <code>java.util.Set</code>-valued attribute with the given name. + * The specified Set <em>must</em> contain only String values. + * If the value is <code>null</code>, the attribute is removed from + * this launch configuration. + * + * @param attributeName the name of the attribute, cannot be <code>null</code> + * @param value the value, or <code>null</code> if the attribute is to be undefined + * @since 3.6 + */ + public void setAttribute(String attributeName, Set value); + + /** * Sets the boolean-valued attribute with the given name. * * @param attributeName the name of the attribute, cannot be <code>null</code> 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 db79a6a4e..25edca831 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -13,6 +13,7 @@ package org.eclipse.debug.internal.core; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -445,8 +446,11 @@ public class LaunchConfigurationInfo { protected Element createSetElement(Document doc, String elementType, String setKey, Set set) { Element setElement = doc.createElement(elementType); setElement.setAttribute(KEY, setKey); + // persist in sorted order + List list = new ArrayList(set); + Collections.sort(list); Element element = null; - for(Iterator iter = set.iterator(); iter.hasNext();) { + for(Iterator iter = list.iterator(); iter.hasNext();) { element = doc.createElement(SET_ENTRY); element.setAttribute(VALUE, (String) iter.next()); setElement.appendChild(element); @@ -467,8 +471,11 @@ public class LaunchConfigurationInfo { */ protected Element createMapElement(Document doc, String elementType, String mapKey, Map map) { Element mapElement = doc.createElement(elementType); - mapElement.setAttribute(KEY, mapKey); - Iterator iterator = map.keySet().iterator(); + mapElement.setAttribute(KEY, mapKey); + // persist in sorted order based on keys + List keys = new ArrayList(map.keySet()); + Collections.sort(keys); + Iterator iterator = keys.iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); String value = (String) map.get(key); 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 e7e2d854a..fb2820235 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 @@ -440,6 +440,14 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen getInfo().setAttribute(attributeName, value); setDirty(); } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setAttribute(java.lang.String, java.util.Set) + */ + public void setAttribute(String attributeName, Set value) { + getInfo().setAttribute(attributeName, value); + setDirty(); + } /** * @see ILaunchConfigurationWorkingCopy#getOriginal() |