Changeset 930 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-09-07T13:34:24+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r873 r930 183 183 184 184 synchronized public void put(final String key, final String value) { 185 if (value == null) 186 properties.remove(key); 187 else 188 properties.put(key, value); 189 save(); 190 firePreferenceChanged(key, value); 185 String oldvalue = properties.get(key); 186 if(value != null && value.length() == 0) 187 value = null; 188 if(!((oldvalue == null && value == null) || (value != null 189 && oldvalue != null && oldvalue.equals(value)))) 190 { 191 if (value == null) 192 properties.remove(key); 193 else 194 properties.put(key, value); 195 save(); 196 firePreferenceChanged(key, value); 197 } 191 198 } 192 199 193 200 synchronized public void put(final String key, final boolean value) { 194 properties.put(key, Boolean.toString(value)); 195 save(); 196 firePreferenceChanged(key, Boolean.toString(value)); 201 put(key, Boolean.toString(value)); 197 202 } 198 203 … … 210 215 final PrintWriter out = new PrintWriter(new FileWriter(getPreferencesDir() + "preferences"), false); 211 216 for (final Entry<String, String> e : properties.entrySet()) { 212 if (!e.getValue().equals("")) 213 out.println(e.getKey() + "=" + e.getValue()); 217 out.println(e.getKey() + "=" + e.getValue()); 214 218 } 215 219 out.close(); -
trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java
r795 r930 71 71 defaults = Main.pref.getDefaults(); 72 72 orig.remove("osm-server.password"); 73 defaults.remove("osm-server.password"); 73 74 TreeSet<String> ts = new TreeSet<String>(orig.keySet()); 74 75 for (String s : defaults.keySet()) -
trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
r906 r930 53 53 * @author imi 54 54 */ 55 public static class PluginDescription {55 public static class PluginDescription implements Comparable { 56 56 // Note: All the following need to be public instance variables of 57 57 // type String. (Plugin description XMLs from the server are parsed … … 68 68 } 69 69 public PluginDescription() { 70 } 71 public int compareTo(Object n) { 72 if(n instanceof PluginDescription) 73 return name.compareToIgnoreCase(((PluginDescription)n).name); 74 else 75 return -1; 70 76 } 71 77 } … … 328 334 329 335 String plugins = ""; 330 for (Entry<PluginDescription, Boolean> entry : pluginMap.entrySet()) 331 if (entry.getValue()) 332 plugins += entry.getKey().name + ","; 333 if (plugins.endsWith(",")) 336 Object pd[] = pluginMap.keySet().toArray(); 337 Arrays.sort(pd); 338 for(Object d : pd) 339 { 340 if(pluginMap.get(d)) 341 plugins += ((PluginDescription)d).name + ","; 342 } 343 if(plugins.endsWith(",")) 334 344 plugins = plugins.substring(0, plugins.length()-1); 345 if(plugins.length() == 0) 346 plugins = null; 335 347 336 348 String oldPlugins = Main.pref.get("plugins");
Note:
See TracChangeset
for help on using the changeset viewer.