- Timestamp:
- 2017-09-24T11:11:20+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r12891 r12894 337 337 fileHistory.removeAll(failedAll); 338 338 int maxsize = Math.max(0, Config.getPref().getInt("file-open.history.max-size", 15)); 339 PreferencesUtils.put CollectionBounded(Config.getPref(), "file-open.history", maxsize, fileHistory);339 PreferencesUtils.putListBounded(Config.getPref(), "file-open.history", maxsize, new ArrayList<>(fileHistory)); 340 340 } 341 341 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r12891 r12894 236 236 history.remove(filepath); 237 237 history.add(0, filepath); 238 PreferencesUtils.put CollectionBounded(Config.getPref(), "file-open.history", maxsize, history);238 PreferencesUtils.putListBounded(Config.getPref(), "file-open.history", maxsize, history); 239 239 } 240 240 } -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r12891 r12894 1078 1078 * @param def The default value 1079 1079 * @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)} 1081 1081 */ 1082 1082 @Deprecated … … 1126 1126 * @param value The value that should be removed in the collection 1127 1127 * @see #getList(String) 1128 * @deprecated use {@link PreferencesUtils#removeFrom Collection(IPreferences, String, String)}1128 * @deprecated use {@link PreferencesUtils#removeFromList(IPreferences, String, String)} 1129 1129 */ 1130 1130 @Deprecated … … 1236 1236 * @param val value 1237 1237 * @return {@code true}, if something has changed (i.e. value is different than before) 1238 * @deprecated use {@link PreferencesUtils#put CollectionBounded(IPreferences, String, int, Collection)}1238 * @deprecated use {@link PreferencesUtils#putListBounded(IPreferences, String, int, List)} 1239 1239 */ 1240 1240 @Deprecated -
trunk/src/org/openstreetmap/josm/data/PreferencesUtils.java
r12891 r12894 528 528 529 529 /** 530 * Removes a value from a given String collection530 * Removes a value from a given String list 531 531 * @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) { 538 537 synchronized (prefs) { 539 538 List<String> a = new ArrayList<>(prefs.getList(key, Collections.<String>emptyList())); … … 544 543 545 544 /** 546 * Saves at most {@code maxsize} items of collection{@code val}.545 * Saves at most {@code maxsize} items of list {@code val}. 547 546 * @param prefs the preferences 548 547 * @param key key … … 550 549 * @param val value 551 550 * @return {@code true}, if something has changed (i.e. value is different than before) 552 * @since 1289 1553 */ 554 public static boolean put CollectionBounded(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) { 555 554 List<String> newCollection = new ArrayList<>(Math.min(maxsize, val.size())); 556 555 for (String i : val) { -
trunk/src/org/openstreetmap/josm/io/UploadStrategy.java
r12891 r12894 85 85 v = Config.getPref().get("osm-server.atomic-upload", null); 86 86 if (v != null) { 87 PreferencesUtils.removeFrom Collection(Config.getPref(), "osm-server.atomic-upload", v);87 PreferencesUtils.removeFromList(Config.getPref(), "osm-server.atomic-upload", v); 88 88 } else { 89 89 v = ""; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r12891 r12894 349 349 if (plugins.contains(depr.name)) { 350 350 plugins.remove(depr.name); 351 PreferencesUtils.removeFrom Collection(Config.getPref(), "plugins", depr.name);351 PreferencesUtils.removeFromList(Config.getPref(), "plugins", depr.name); 352 352 removedPlugins.add(depr); 353 353 } … … 403 403 Utils.escapeReservedCharactersHTML(unmaintained)); 404 404 if (confirmDisablePlugin(parent, msg, unmaintained)) { 405 PreferencesUtils.removeFrom Collection(Config.getPref(), "plugins", unmaintained);405 PreferencesUtils.removeFromList(Config.getPref(), "plugins", unmaintained); 406 406 plugins.remove(unmaintained); 407 407 } … … 801 801 } 802 802 if (msg != null && confirmDisablePlugin(parent, msg, plugin.name)) { 803 PreferencesUtils.removeFrom Collection(Config.getPref(), "plugins", plugin.name);803 PreferencesUtils.removeFromList(Config.getPref(), "plugins", plugin.name); 804 804 } 805 805 }
Note:
See TracChangeset
for help on using the changeset viewer.