Ticket #12454: PreferencesSetDefaultValues.patch

File PreferencesSetDefaultValues.patch, 4.0 KB (added by kolesar, 8 years ago)
  • src/org/openstreetmap/josm/data/preferences/AbstractProperty.java

    diff --git a/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java b/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java
    index 1516d42..e0584ca 100644
    a b public abstract class AbstractProperty<T> {  
    2020    public AbstractProperty(String key, T defaultValue) {
    2121        this.key = key;
    2222        this.defaultValue = defaultValue;
     23        if (Main.pref == null) {
     24            Main.initApplicationPreferences();
     25        }
    2326    }
    2427
    2528    /**
  • src/org/openstreetmap/josm/data/preferences/BooleanProperty.java

    diff --git a/src/org/openstreetmap/josm/data/preferences/BooleanProperty.java b/src/org/openstreetmap/josm/data/preferences/BooleanProperty.java
    index 3e466f0..b9c6ed1 100644
    a b public class BooleanProperty extends AbstractProperty<Boolean> {  
    1515     */
    1616    public BooleanProperty(String key, boolean defaultValue) {
    1717        super(key, defaultValue);
     18        get();
    1819    }
    1920
    2021    @Override
  • src/org/openstreetmap/josm/data/preferences/CollectionProperty.java

    diff --git a/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java b/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java
    index dabd3c7..7b418d4 100644
    a b public class CollectionProperty extends AbstractProperty<Collection<String>> {  
    1717     */
    1818    public CollectionProperty(String key, Collection<String> defaultValue) {
    1919        super(key, defaultValue);
     20        get();
    2021    }
    2122
    2223    @Override
  • src/org/openstreetmap/josm/data/preferences/ColorProperty.java

    diff --git a/src/org/openstreetmap/josm/data/preferences/ColorProperty.java b/src/org/openstreetmap/josm/data/preferences/ColorProperty.java
    index 8c1794b..c7a442b 100644
    a b public class ColorProperty extends AbstractProperty<Color> implements ColorKey {  
    2323    public ColorProperty(String colName, Color defaultValue) {
    2424        super(getColorKey(colName), defaultValue);
    2525        this.name = colName;
     26        get();
    2627    }
    2728
    2829    @Override
  • src/org/openstreetmap/josm/data/preferences/IntegerProperty.java

    diff --git a/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java b/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java
    index 342b3ba..9774e46 100644
    a b public class IntegerProperty extends AbstractProperty<Integer> {  
    1616     */
    1717    public IntegerProperty(String key, int defaultValue) {
    1818        super(key, defaultValue);
     19        get();
    1920    }
    2021
    2122    @Override
  • src/org/openstreetmap/josm/data/preferences/ParametrizedEnumProperty.java

    diff --git a/src/org/openstreetmap/josm/data/preferences/ParametrizedEnumProperty.java b/src/org/openstreetmap/josm/data/preferences/ParametrizedEnumProperty.java
    index 094a745..b6c4aaa 100644
    a b public abstract class ParametrizedEnumProperty<T extends Enum<T>> {  
    1111    public ParametrizedEnumProperty(Class<T> enumClass, T defaultValue) {
    1212        this.defaultValue = defaultValue;
    1313        this.enumClass = enumClass;
     14        get();
    1415    }
    1516
    1617    protected abstract String getKey(String... params);
  • src/org/openstreetmap/josm/data/preferences/StringProperty.java

    diff --git a/src/org/openstreetmap/josm/data/preferences/StringProperty.java b/src/org/openstreetmap/josm/data/preferences/StringProperty.java
    index 1e352ad..84a649d 100644
    a b public class StringProperty extends AbstractProperty<String> {  
    1515     */
    1616    public StringProperty(String key, String defaultValue) {
    1717        super(key, defaultValue);
     18        get();
    1819    }
    1920
    2021    @Override