Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Ove Weichel2015-11-21 13:59:33 +0000
committerJan-Ove Weichel2015-11-21 14:02:46 +0000
commita01ceaa587221fcce5c33460d98140d401809a6d (patch)
tree148013a5894b2cccb75966e3b8963db3b360c60c /bundles/org.eclipse.equinox.preferences
parent9286d0816670791274dce4380eaa75eff4c75a26 (diff)
downloadrt.equinox.bundles-a01ceaa587221fcce5c33460d98140d401809a6d.tar.gz
rt.equinox.bundles-a01ceaa587221fcce5c33460d98140d401809a6d.tar.xz
rt.equinox.bundles-a01ceaa587221fcce5c33460d98140d401809a6d.zip
Bug 474359 - [preferences] Exported preferences should be inI20151203-0800
alphabetical order Extracted SortedProperties from EclipsePreferences to own class and used it in PreferenceService Change-Id: Ifa4668f65e8cff368eb4c6366f73fab9e560173e Signed-off-by: Jan-Ove Weichel <janove.weichel@vogella.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.preferences')
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java36
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java3
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java49
3 files changed, 52 insertions, 36 deletions
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
index f141ebaa..8cd69f39 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
@@ -8,12 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Julian Chen - fix for bug #92572, jclRM
+ * Jan-Ove Weichel (janove.weichel@vogella.com) - bug 474359
*******************************************************************************/
package org.eclipse.core.internal.preferences;
import java.io.*;
import java.util.*;
-import java.util.Map.Entry;
import org.eclipse.core.internal.runtime.RuntimeLog;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.preferences.*;
@@ -77,40 +77,6 @@ public class EclipsePreferences implements IEclipsePreferences, IScope {
DEBUG_PREFERENCE_GET = PreferencesOSGiUtils.getDefault().getBooleanDebugOption(debugPluginName + "/get", false); //$NON-NLS-1$
}
- protected class SortedProperties extends Properties {
-
- private static final long serialVersionUID = 1L;
-
- public SortedProperties() {
- super();
- }
-
-
- @Override
- public synchronized Enumeration<Object> keys() {
- TreeSet<Object> set = new TreeSet<>();
- for (Enumeration<?> e = super.keys(); e.hasMoreElements();)
- set.add(e.nextElement());
- return Collections.enumeration(set);
- }
-
-
- @Override
- public Set<Entry<Object, Object>> entrySet() {
- TreeSet<Entry<Object, Object>> set = new TreeSet<>(new Comparator<Entry<Object, Object>>() {
- @Override
- public int compare(Entry<Object, Object> e1, Entry<Object, Object> e2) {
- String s1 = (String) e1.getKey();
- String s2 = (String) e2.getKey();
- return s1.compareTo(s2);
- }
- });
- for (Iterator<Entry<Object, Object>> i = super.entrySet().iterator(); i.hasNext();)
- set.add(i.next());
- return set;
- }
- }
-
public EclipsePreferences() {
this(null, null);
}
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
index 3ee664c6..4a27537c 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Semion Chichelnitsky (semion@il.ibm.com) - bug 208564
+ * Jan-Ove Weichel (janove.weichel@vogella.com) - bug 474359
*******************************************************************************/
package org.eclipse.core.internal.preferences;
@@ -285,7 +286,7 @@ public class PreferencesService implements IPreferencesService {
* excludesList is guaranteed not to be null
*/
private Properties convertToProperties(IEclipsePreferences preferences, final String[] excludesList) throws BackingStoreException {
- final Properties result = new Properties();
+ final SortedProperties result = new SortedProperties();
final int baseLength = preferences.absolutePath().length();
// create a visitor to do the export
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java
new file mode 100644
index 00000000..88fd878b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2015 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Jan-Ove Weichel (janove.weichel@vogella.com) - bug 474359
+ *******************************************************************************/
+package org.eclipse.core.internal.preferences;
+
+import java.util.*;
+import java.util.Map.Entry;
+
+public class SortedProperties extends Properties {
+
+ private static final long serialVersionUID = 1L;
+
+ public SortedProperties() {
+ super();
+ }
+
+
+ @Override
+ public synchronized Enumeration<Object> keys() {
+ TreeSet<Object> set = new TreeSet<>();
+ for (Enumeration<?> e = super.keys(); e.hasMoreElements();)
+ set.add(e.nextElement());
+ return Collections.enumeration(set);
+ }
+
+
+ @Override
+ public Set<Entry<Object, Object>> entrySet() {
+ TreeSet<Entry<Object, Object>> set = new TreeSet<>(new Comparator<Entry<Object, Object>>() {
+ @Override
+ public int compare(Entry<Object, Object> e1, Entry<Object, Object> e2) {
+ String s1 = (String) e1.getKey();
+ String s2 = (String) e2.getKey();
+ return s1.compareTo(s2);
+ }
+ });
+ for (Iterator<Entry<Object, Object>> i = super.entrySet().iterator(); i.hasNext();)
+ set.add(i.next());
+ return set;
+ }
+} \ No newline at end of file

Back to the top