Changeset 3451 in josm for trunk/src/org
- Timestamp:
- 2010-08-20T22:10:26+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r3438 r3451 324 324 } 325 325 326 synchronized public boolean put(final String key, String value) { 327 String oldvalue = properties.get(key); 328 if(value != null && value.length() == 0) { 329 value = null; 330 } 331 if(!((oldvalue == null && (value == null || value.equals(defaults.get(key)))) 332 || (value != null && oldvalue != null && oldvalue.equals(value)))) 333 { 334 if (value == null) { 335 properties.remove(key); 336 } else { 337 properties.put(key, value); 338 } 339 try { 340 save(); 341 } catch(IOException e){ 342 System.out.println(tr("Warning: failed to persist preferences to ''{0}''", getPreferenceFile().getAbsoluteFile())); 343 } 344 firePrefrenceChanged(key, oldvalue, value); 345 return true; 346 } 347 return false; 326 public boolean put(final String key, String value) { 327 328 boolean changed = false; 329 String oldValue = null; 330 331 synchronized (this) { 332 oldValue = properties.get(key); 333 if(value != null && value.length() == 0) { 334 value = null; 335 } 336 if(!((oldValue == null && (value == null || value.equals(defaults.get(key)))) 337 || (value != null && oldValue != null && oldValue.equals(value)))) 338 { 339 if (value == null) { 340 properties.remove(key); 341 } else { 342 properties.put(key, value); 343 } 344 try { 345 save(); 346 } catch(IOException e){ 347 System.out.println(tr("Warning: failed to persist preferences to ''{0}''", getPreferenceFile().getAbsoluteFile())); 348 } 349 changed = true; 350 } 351 } 352 if (changed) { 353 // Call outside of synchronized section in case some listener wait for other thread that wait for preference lock 354 firePrefrenceChanged(key, oldValue, value); 355 } 356 return changed; 348 357 } 349 358 … … 699 708 } 700 709 if(s != null && s.length() != 0) 701 {702 710 return Arrays.asList(s.split("\u001e")); 703 }704 711 return def; 705 712 } -
trunk/src/org/openstreetmap/josm/data/preferences/BooleanProperty.java
r3246 r3451 15 15 16 16 public boolean get() { 17 return Main.pref.getBoolean( key, defaultValue);17 return Main.pref.getBoolean(getKey(), isDefaultValue()); 18 18 } 19 19 20 20 public boolean put(boolean value) { 21 return Main.pref.put(key, value); 21 return Main.pref.put(getKey(), value); 22 } 23 24 public String getKey() { 25 return key; 26 } 27 28 public boolean isDefaultValue() { 29 return defaultValue; 22 30 } 23 31 -
trunk/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java
r3246 r3451 16 16 17 17 public Collection<String> get() { 18 return Main.pref.getCollection( key, defaultValue);18 return Main.pref.getCollection(getKey(), getDefaultValue()); 19 19 } 20 20 21 21 public boolean put(Collection<String> value) { 22 return Main.pref.putCollection(key, value); 22 return Main.pref.putCollection(getKey(), value); 23 } 24 25 public String getKey() { 26 return key; 27 } 28 29 public Collection<String> getDefaultValue() { 30 return defaultValue; 23 31 } 24 32 -
trunk/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java
r3246 r3451 15 15 16 16 public int get() { 17 return Main.pref.getInteger( key, defaultValue);17 return Main.pref.getInteger(getKey(), getDefaultValue()); 18 18 } 19 19 20 20 public boolean put(int value) { 21 return Main.pref.putInteger(key, value); 21 return Main.pref.putInteger(getKey(), value); 22 } 23 24 public String getKey() { 25 return key; 26 } 27 28 public int getDefaultValue() { 29 return defaultValue; 22 30 } 23 31 -
trunk/src/org/openstreetmap/josm/data/preferences/StringProperty.java
r3246 r3451 15 15 16 16 public String get() { 17 return Main.pref.get( key, defaultValue);17 return Main.pref.get(getKey(), getDefaultValue()); 18 18 } 19 19 20 20 public boolean put(String value) { 21 return Main.pref.put(key, value); 21 return Main.pref.put(getKey(), value); 22 } 23 24 public String getKey() { 25 return key; 26 } 27 28 public String getDefaultValue() { 29 return defaultValue; 22 30 } 23 31 -
trunk/src/org/openstreetmap/josm/gui/IconToggleButton.java
r2871 r3451 57 57 ((Destroyable) action).destroy(); 58 58 } 59 action.removePropertyChangeListener(this); 59 60 } 60 61 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r3443 r3451 175 175 * The last event performed by mouse. 176 176 */ 177 public MouseEvent lastMEvent ;177 public MouseEvent lastMEvent = new MouseEvent(this, 0, 0, 0, 0, 0, 0, false); // In case somebody reads it before first mouse move 178 178 179 179 private LinkedList<MapViewPaintable> temporaryLayers = new LinkedList<MapViewPaintable>();
Note:
See TracChangeset
for help on using the changeset viewer.