Changeset 12894 in josm for trunk


Ignore:
Timestamp:
2017-09-24T11:11:20+02:00 (7 years ago)
Author:
bastiK
Message:

see #15229 - update method name and signature for consistency

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r12891 r12894  
    337337                fileHistory.removeAll(failedAll);
    338338                int maxsize = Math.max(0, Config.getPref().getInt("file-open.history.max-size", 15));
    339                 PreferencesUtils.putCollectionBounded(Config.getPref(), "file-open.history", maxsize, fileHistory);
     339                PreferencesUtils.putListBounded(Config.getPref(), "file-open.history", maxsize, new ArrayList<>(fileHistory));
    340340            }
    341341        }
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r12891 r12894  
    236236        history.remove(filepath);
    237237        history.add(0, filepath);
    238         PreferencesUtils.putCollectionBounded(Config.getPref(), "file-open.history", maxsize, history);
     238        PreferencesUtils.putListBounded(Config.getPref(), "file-open.history", maxsize, history);
    239239    }
    240240}
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r12891 r12894  
    10781078     * @param def The default value
    10791079     * @return The integer value or the default value if it could not be parsed
    1080      * @deprecated use {@link PreferencesUtils#getInteger(IPreferences, String, String, int)
     1080     * @deprecated use {@link PreferencesUtils#getInteger(IPreferences, String, String, int)}
    10811081     */
    10821082    @Deprecated
     
    11261126     * @param value The value that should be removed in the collection
    11271127     * @see #getList(String)
    1128      * @deprecated use {@link PreferencesUtils#removeFromCollection(IPreferences, String, String)}
     1128     * @deprecated use {@link PreferencesUtils#removeFromList(IPreferences, String, String)}
    11291129     */
    11301130    @Deprecated
     
    12361236     * @param val value
    12371237     * @return {@code true}, if something has changed (i.e. value is different than before)
    1238      * @deprecated use {@link PreferencesUtils#putCollectionBounded(IPreferences, String, int, Collection)}
     1238     * @deprecated use {@link PreferencesUtils#putListBounded(IPreferences, String, int, List)}
    12391239     */
    12401240    @Deprecated
  • trunk/src/org/openstreetmap/josm/data/PreferencesUtils.java

    r12891 r12894  
    528528
    529529    /**
    530      * Removes a value from a given String collection
     530     * Removes a value from a given String list
    531531     * @param prefs the preferences
    532      * @param key The preference key the collection is stored with
    533      * @param value The value that should be removed in the collection
    534      * @see #getList(String)
    535      * @since 12891
    536      */
    537     public static void removeFromCollection(IPreferences prefs, String key, String value) {
     532     * @param key The preference key the list is stored with
     533     * @param value The value that should be removed in the list
     534     * @since 12894
     535     */
     536    public static void removeFromList(IPreferences prefs, String key, String value) {
    538537        synchronized (prefs) {
    539538            List<String> a = new ArrayList<>(prefs.getList(key, Collections.<String>emptyList()));
     
    544543
    545544    /**
    546      * Saves at most {@code maxsize} items of collection {@code val}.
     545     * Saves at most {@code maxsize} items of list {@code val}.
    547546     * @param prefs the preferences
    548547     * @param key key
     
    550549     * @param val value
    551550     * @return {@code true}, if something has changed (i.e. value is different than before)
    552      * @since 12891
    553      */
    554     public static boolean putCollectionBounded(IPreferences prefs, String key, int maxsize, Collection<String> val) {
     551     * @since 12894
     552     */
     553    public static boolean putListBounded(IPreferences prefs, String key, int maxsize, List<String> val) {
    555554        List<String> newCollection = new ArrayList<>(Math.min(maxsize, val.size()));
    556555        for (String i : val) {
  • trunk/src/org/openstreetmap/josm/io/UploadStrategy.java

    r12891 r12894  
    8585            v = Config.getPref().get("osm-server.atomic-upload", null);
    8686            if (v != null) {
    87                 PreferencesUtils.removeFromCollection(Config.getPref(), "osm-server.atomic-upload", v);
     87                PreferencesUtils.removeFromList(Config.getPref(), "osm-server.atomic-upload", v);
    8888            } else {
    8989                v = "";
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r12891 r12894  
    349349            if (plugins.contains(depr.name)) {
    350350                plugins.remove(depr.name);
    351                 PreferencesUtils.removeFromCollection(Config.getPref(), "plugins", depr.name);
     351                PreferencesUtils.removeFromList(Config.getPref(), "plugins", depr.name);
    352352                removedPlugins.add(depr);
    353353            }
     
    403403                    Utils.escapeReservedCharactersHTML(unmaintained));
    404404            if (confirmDisablePlugin(parent, msg, unmaintained)) {
    405                 PreferencesUtils.removeFromCollection(Config.getPref(), "plugins", unmaintained);
     405                PreferencesUtils.removeFromList(Config.getPref(), "plugins", unmaintained);
    406406                plugins.remove(unmaintained);
    407407            }
     
    801801        }
    802802        if (msg != null && confirmDisablePlugin(parent, msg, plugin.name)) {
    803             PreferencesUtils.removeFromCollection(Config.getPref(), "plugins", plugin.name);
     803            PreferencesUtils.removeFromList(Config.getPref(), "plugins", plugin.name);
    804804        }
    805805    }
Note: See TracChangeset for help on using the changeset viewer.