Changeset 12999 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-10-15T12:26:33+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/preferences
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java
r12987 r12999 2 2 package org.openstreetmap.josm.data.preferences; 3 3 4 import org.openstreetmap.josm. Main;5 import org.openstreetmap.josm. data.Preferences;4 import org.openstreetmap.josm.spi.preferences.Config; 5 import org.openstreetmap.josm.spi.preferences.IPreferences; 6 6 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent; 7 7 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; … … 152 152 * The preferences object this property is for. 153 153 */ 154 protected final Preferences preferences;154 protected final IPreferences preferences; 155 155 protected final String key; 156 156 protected final T defaultValue; … … 164 164 public AbstractProperty(String key, T defaultValue) { 165 165 // Main.pref should not change in production but may change during tests. 166 preferences = Main.pref;166 preferences = Config.getPref(); 167 167 this.key = key; 168 168 this.defaultValue = defaultValue; … … 227 227 * Gets the preferences used for this property. 228 228 * @return The preferences for this property. 229 * @since 1 0824230 */ 231 protected Preferences getPreferences() {229 * @since 12999 230 */ 231 protected IPreferences getPreferences() { 232 232 return preferences; 233 233 } -
trunk/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java
r12840 r12999 2 2 package org.openstreetmap.josm.data.preferences; 3 3 4 import java.util.ArrayList; 4 5 import java.util.Collection; 5 6 … … 27 28 @Override 28 29 public Collection<String> get() { 29 return getPreferences().get Collection(getKey(), getDefaultValue());30 return getPreferences().getList(getKey(), new ArrayList<>(getDefaultValue())); 30 31 } 31 32 32 33 @Override 33 34 public boolean put(Collection<String> value) { 34 return getPreferences().put Collection(getKey(), value);35 return getPreferences().putList(getKey(), new ArrayList<>(value)); 35 36 } 36 37 } -
trunk/src/org/openstreetmap/josm/data/preferences/ColorProperty.java
r12987 r12999 5 5 import java.util.Locale; 6 6 7 import org.openstreetmap.josm.Main; 7 8 import org.openstreetmap.josm.tools.CheckParameterUtil; 8 9 import org.openstreetmap.josm.tools.ColorHelper; … … 36 37 CheckParameterUtil.ensureParameterNotNull(defaultValue, "defaultValue"); 37 38 this.name = colName; 38 getPreferences().registerColor(getColorKey(colName), colName);39 Main.pref.registerColor(getColorKey(colName), colName); 39 40 } 40 41
Note:
See TracChangeset
for help on using the changeset viewer.