Ignore:
Timestamp:
2017-09-13T16:30:27+02:00 (7 years ago)
Author:
bastiK
Message:

see #15229 - fix deprecations caused by [12840]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/PreferencesUtils.java

    r12826 r12841  
    9999            } else if (entry.getValue() instanceof ListSetting) {
    100100                ListSetting lSetting = (ListSetting) entry.getValue();
    101                 Collection<String> newItems = getCollection(mainpref, key, true);
     101                List<String> newItems = getList(mainpref, key, true);
    102102                if (newItems == null) continue;
    103103                for (String item : lSetting.getValue()) {
     
    107107                    }
    108108                }
    109                 mainpref.putCollection(key, newItems);
     109                mainpref.putList(key, newItems);
    110110            } else if (entry.getValue() instanceof ListListSetting) {
    111111                ListListSetting llSetting = (ListListSetting) entry.getValue();
    112                 Collection<Collection<String>> newLists = getArray(mainpref, key, true);
     112                List<List<String>> newLists = getListOfLists(mainpref, key, true);
    113113                if (newLists == null) continue;
    114114
    115                 for (Collection<String> list : llSetting.getValue()) {
     115                for (List<String> list : llSetting.getValue()) {
    116116                    // add nonexisting list (equals comparison for lists is used implicitly)
    117117                    if (!newLists.contains(list)) {
     
    119119                    }
    120120                }
    121                 mainpref.putArray(key, newLists);
     121                mainpref.putListOfLists(key, newLists);
    122122            } else if (entry.getValue() instanceof MapListSetting) {
    123123                MapListSetting mlSetting = (MapListSetting) entry.getValue();
     
    133133                    }
    134134                }
    135                 mainpref.putListOfStructs(entry.getKey(), newMaps);
     135                mainpref.putListOfMaps(entry.getKey(), newMaps);
    136136            }
    137137        }
     
    155155            } else if (entry.getValue() instanceof ListSetting) {
    156156                ListSetting lSetting = (ListSetting) entry.getValue();
    157                 Collection<String> newItems = getCollection(mainpref, key, true);
     157                List<String> newItems = getList(mainpref, key, true);
    158158                if (newItems == null) continue;
    159159
     
    163163                    newItems.remove(item);
    164164                }
    165                 mainpref.putCollection(entry.getKey(), newItems);
     165                mainpref.putList(entry.getKey(), newItems);
    166166            } else if (entry.getValue() instanceof ListListSetting) {
    167167                ListListSetting llSetting = (ListListSetting) entry.getValue();
    168                 Collection<Collection<String>> newLists = getArray(mainpref, key, true);
     168                List<List<String>> newLists = getListOfLists(mainpref, key, true);
    169169                if (newLists == null) continue;
    170170
    171171                // 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();
    173173                while (listIterator.hasNext()) {
    174174                    Collection<String> list = listIterator.next();
     
    182182                }
    183183
    184                 mainpref.putArray(key, newLists);
     184                mainpref.putListOfLists(key, newLists);
    185185            } else if (entry.getValue() instanceof MapListSetting) {
    186186                MapListSetting mlSetting = (MapListSetting) entry.getValue();
     
    199199                    }
    200200                }
    201                 mainpref.putListOfStructs(entry.getKey(), newMaps);
     201                mainpref.putListOfMaps(entry.getKey(), newMaps);
    202202            }
    203203        }
     
    223223    }
    224224
    225     private static Collection<String> getCollection(Preferences mainpref, String key, boolean warnUnknownDefault) {
     225    private static List<String> getList(Preferences mainpref, String key, boolean warnUnknownDefault) {
    226226        ListSetting existing = Utils.cast(mainpref.settingsMap.get(key), ListSetting.class);
    227227        ListSetting defaults = Utils.cast(mainpref.defaultsMap.get(key), ListSetting.class);
     
    236236    }
    237237
    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) {
    239239        ListListSetting existing = Utils.cast(mainpref.settingsMap.get(key), ListListSetting.class);
    240240        ListListSetting defaults = Utils.cast(mainpref.defaultsMap.get(key), ListListSetting.class);
Note: See TracChangeset for help on using the changeset viewer.