Changeset 12296 in josm


Ignore:
Timestamp:
2017-06-01T16:58:05+02:00 (8 months ago)
Author:
bastiK
Message:

respect default preferences when writing preset/style/rule entries

This fixes request for restart with fresh preferences despite no changes in the preferences window.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r12279 r12296  
    18241824         */
    18251825        public boolean put(Collection<? extends SourceEntry> entries) {
     1826            Collection<Map<String, String>> setting = serializeList(entries);
     1827            boolean unset = Main.pref.getListOfStructs(pref, (Collection<Map<String, String>>) null) == null;
     1828            if (unset) {
     1829                Collection<Map<String, String>> def = serializeList(getDefault());
     1830                if (setting.equals(def))
     1831                    return false;
     1832            }
     1833            return Main.pref.putListOfStructs(pref, setting);
     1834        }
     1835
     1836        private Collection<Map<String, String>> serializeList(Collection<? extends SourceEntry> entries) {
    18261837            Collection<Map<String, String>> setting = new ArrayList<>(entries.size());
    18271838            for (SourceEntry e : entries) {
    18281839                setting.add(serialize(e));
    18291840            }
    1830             return Main.pref.putListOfStructs(pref, setting);
     1841            return setting;
    18311842        }
    18321843
Note: See TracChangeset for help on using the changeset viewer.