Changeset 12841 in josm for trunk/src/org/openstreetmap/josm/data/PreferencesUtils.java
- Timestamp:
- 2017-09-13T16:30:27+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/PreferencesUtils.java
r12826 r12841 99 99 } else if (entry.getValue() instanceof ListSetting) { 100 100 ListSetting lSetting = (ListSetting) entry.getValue(); 101 Collection<String> newItems = getCollection(mainpref, key, true);101 List<String> newItems = getList(mainpref, key, true); 102 102 if (newItems == null) continue; 103 103 for (String item : lSetting.getValue()) { … … 107 107 } 108 108 } 109 mainpref.put Collection(key, newItems);109 mainpref.putList(key, newItems); 110 110 } else if (entry.getValue() instanceof ListListSetting) { 111 111 ListListSetting llSetting = (ListListSetting) entry.getValue(); 112 Collection<Collection<String>> newLists = getArray(mainpref, key, true);112 List<List<String>> newLists = getListOfLists(mainpref, key, true); 113 113 if (newLists == null) continue; 114 114 115 for ( Collection<String> list : llSetting.getValue()) {115 for (List<String> list : llSetting.getValue()) { 116 116 // add nonexisting list (equals comparison for lists is used implicitly) 117 117 if (!newLists.contains(list)) { … … 119 119 } 120 120 } 121 mainpref.put Array(key, newLists);121 mainpref.putListOfLists(key, newLists); 122 122 } else if (entry.getValue() instanceof MapListSetting) { 123 123 MapListSetting mlSetting = (MapListSetting) entry.getValue(); … … 133 133 } 134 134 } 135 mainpref.putListOf Structs(entry.getKey(), newMaps);135 mainpref.putListOfMaps(entry.getKey(), newMaps); 136 136 } 137 137 } … … 155 155 } else if (entry.getValue() instanceof ListSetting) { 156 156 ListSetting lSetting = (ListSetting) entry.getValue(); 157 Collection<String> newItems = getCollection(mainpref, key, true);157 List<String> newItems = getList(mainpref, key, true); 158 158 if (newItems == null) continue; 159 159 … … 163 163 newItems.remove(item); 164 164 } 165 mainpref.put Collection(entry.getKey(), newItems);165 mainpref.putList(entry.getKey(), newItems); 166 166 } else if (entry.getValue() instanceof ListListSetting) { 167 167 ListListSetting llSetting = (ListListSetting) entry.getValue(); 168 Collection<Collection<String>> newLists = getArray(mainpref, key, true);168 List<List<String>> newLists = getListOfLists(mainpref, key, true); 169 169 if (newLists == null) continue; 170 170 171 171 // if items are found in one of lists, remove that list! 172 Iterator< Collection<String>> listIterator = newLists.iterator();172 Iterator<List<String>> listIterator = newLists.iterator(); 173 173 while (listIterator.hasNext()) { 174 174 Collection<String> list = listIterator.next(); … … 182 182 } 183 183 184 mainpref.put Array(key, newLists);184 mainpref.putListOfLists(key, newLists); 185 185 } else if (entry.getValue() instanceof MapListSetting) { 186 186 MapListSetting mlSetting = (MapListSetting) entry.getValue(); … … 199 199 } 200 200 } 201 mainpref.putListOf Structs(entry.getKey(), newMaps);201 mainpref.putListOfMaps(entry.getKey(), newMaps); 202 202 } 203 203 } … … 223 223 } 224 224 225 private static Collection<String> getCollection(Preferences mainpref, String key, boolean warnUnknownDefault) {225 private static List<String> getList(Preferences mainpref, String key, boolean warnUnknownDefault) { 226 226 ListSetting existing = Utils.cast(mainpref.settingsMap.get(key), ListSetting.class); 227 227 ListSetting defaults = Utils.cast(mainpref.defaultsMap.get(key), ListSetting.class); … … 236 236 } 237 237 238 private static Collection<Collection<String>> getArray(Preferences mainpref, String key, boolean warnUnknownDefault) {238 private static List<List<String>> getListOfLists(Preferences mainpref, String key, boolean warnUnknownDefault) { 239 239 ListListSetting existing = Utils.cast(mainpref.settingsMap.get(key), ListListSetting.class); 240 240 ListListSetting defaults = Utils.cast(mainpref.defaultsMap.get(key), ListListSetting.class);
Note:
See TracChangeset
for help on using the changeset viewer.