Changeset 12841 in josm for trunk/src/org
- Timestamp:
- 2017-09-13T16:30:27+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 117 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r12726 r12841 398 398 } 399 399 400 for (String linearTag : Main.pref.get Collection("multipoly.lineartagstokeep", DEFAULT_LINEAR_TAGS)) {400 for (String linearTag : Main.pref.getList("multipoly.lineartagstokeep", DEFAULT_LINEAR_TAGS)) { 401 401 values.remove(linearTag); 402 402 } -
trunk/src/org/openstreetmap/josm/actions/DialogsToggleAction.java
r12643 r12841 43 43 public void actionPerformed(ActionEvent e) { 44 44 toggleSelectedState(e); 45 Main.pref.put ("draw.dialogspanel", isSelected());45 Main.pref.putBoolean("draw.dialogspanel", isSelected()); 46 46 notifySelectedState(); 47 47 setMode(); … … 61 61 // Toolbars listen to preference changes, use it here 62 62 if (!Main.pref.getBoolean("toolbar.always-visible", true) && (!selected || toolbarPreviouslyVisible)) { 63 Main.pref.put ("toolbar.visible", selected);63 Main.pref.putBoolean("toolbar.visible", selected); 64 64 } 65 65 if (!Main.pref.getBoolean("sidetoolbar.always-visible", true) && (!selected || sideToolbarPreviouslyVisible)) { 66 Main.pref.put ("sidetoolbar.visible", selected);66 Main.pref.putBoolean("sidetoolbar.visible", selected); 67 67 } 68 68 map.mapView.rememberLastPositionOnScreen(); -
trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java
r12637 r12841 53 53 public void actionPerformed(ActionEvent e) { 54 54 toggleSelectedState(e); 55 Main.pref.put ("draw.fullscreen", isSelected());55 Main.pref.putBoolean("draw.fullscreen", isSelected()); 56 56 notifySelectedState(); 57 57 setMode(); -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r12689 r12841 114 114 return candidates.get(0); 115 115 116 switch (Main.pref.getInt eger("merge-nodes.mode", 0)) {116 switch (Main.pref.getInt("merge-nodes.mode", 0)) { 117 117 case 0: 118 118 return candidates.get(size - 1); -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r12671 r12841 330 330 331 331 if (recordHistory) { 332 Collection<String> oldFileHistory = Main.pref.get Collection("file-open.history");332 Collection<String> oldFileHistory = Main.pref.getList("file-open.history"); 333 333 fileHistory.addAll(oldFileHistory); 334 334 // remove the files which failed to load from the list 335 335 fileHistory.removeAll(failedAll); 336 int maxsize = Math.max(0, Main.pref.getInt eger("file-open.history.max-size", 15));336 int maxsize = Math.max(0, Main.pref.getInt("file-open.history.max-size", 15)); 337 337 Main.pref.putCollectionBounded("file-open.history", maxsize, fileHistory); 338 338 } -
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r12675 r12841 104 104 */ 105 105 protected void restoreUploadAddressHistory(HistoryComboBox cbHistory) { 106 List<String> cmtHistory = new LinkedList<>(Main.pref.get Collection(getClass().getName() + ".uploadAddressHistory",106 List<String> cmtHistory = new LinkedList<>(Main.pref.getList(getClass().getName() + ".uploadAddressHistory", 107 107 new LinkedList<String>())); 108 108 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() … … 118 118 protected void remindUploadAddressHistory(HistoryComboBox cbHistory) { 119 119 cbHistory.addCurrentItemToHistory(); 120 Main.pref.put Collection(getClass().getName() + ".uploadAddressHistory", cbHistory.getHistory());120 Main.pref.putList(getClass().getName() + ".uploadAddressHistory", cbHistory.getHistory()); 121 121 } 122 122 -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r12718 r12841 99 99 100 100 clearUndoRedo = cbClearUndoRedo.isSelected(); 101 Main.pref.put ("purge.clear_undo_redo", clearUndoRedo);101 Main.pref.putBoolean("purge.clear_undo_redo", clearUndoRedo); 102 102 } 103 103 -
trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
r11343 r12841 81 81 String nameText = name.getText(); 82 82 if (filerename.isEnabled()) { 83 Main.pref.put ("layer.rename-file", filerename.isSelected());83 Main.pref.putBoolean("layer.rename-file", filerename.isSelected()); 84 84 if (filerename.isSelected()) { 85 85 String newname = nameText; -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r12671 r12841 229 229 } 230 230 231 int maxsize = Math.max(0, Main.pref.getInt eger("file-open.history.max-size", 15));232 Collection<String> oldHistory = Main.pref.get Collection("file-open.history");231 int maxsize = Math.max(0, Main.pref.getInt("file-open.history.max-size", 15)); 232 Collection<String> oldHistory = Main.pref.getList("file-open.history"); 233 233 List<String> history = new LinkedList<>(oldHistory); 234 234 history.remove(filepath); -
trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
r12620 r12841 41 41 public void actionPerformed(ActionEvent e) { 42 42 HistoryComboBox searchTermBox = new HistoryComboBox(); 43 List<String> searchHistory = new LinkedList<>(Main.pref.get Collection(HISTORY_KEY, new LinkedList<String>()));43 List<String> searchHistory = new LinkedList<>(Main.pref.getList(HISTORY_KEY, new LinkedList<String>())); 44 44 Collections.reverse(searchHistory); 45 45 searchTermBox.setPossibleItems(searchHistory); … … 70 70 71 71 searchTermBox.addCurrentItemToHistory(); 72 Main.pref.put Collection(HISTORY_KEY, searchTermBox.getHistory());72 Main.pref.putList(HISTORY_KEY, searchTermBox.getHistory()); 73 73 74 74 performSearch(searchTerm); … … 91 91 } 92 92 93 int noteLimit = Main.pref.getInt eger("osm.notes.downloadLimit", 1000);94 int closedLimit = Main.pref.getInt eger("osm.notes.daysClosed", 7);93 int noteLimit = Main.pref.getInt("osm.notes.downloadLimit", 1000); 94 int closedLimit = Main.pref.getInt("osm.notes.daysClosed", 7); 95 95 96 96 StringBuilder sb = new StringBuilder(128); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java
r12630 r12841 237 237 238 238 private void computeSnapAngles() { 239 snapAngles = Main.pref.get Collection(DRAW_ANGLESNAP_ANGLES,239 snapAngles = Main.pref.getList(DRAW_ANGLESNAP_ANGLES, 240 240 Arrays.asList("0", "30", "45", "60", "90", "120", "135", "150", "180")) 241 241 .stream() … … 259 259 */ 260 260 public void saveAngles(String... angles) { 261 Main.pref.put Collection(DRAW_ANGLESNAP_ANGLES, Arrays.asList(angles));261 Main.pref.putList(DRAW_ANGLESNAP_ANGLES, Arrays.asList(angles)); 262 262 } 263 263 -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r12726 r12841 307 307 @Override 308 308 protected void readPreferences() { 309 initialMoveDelay = Main.pref.getInt eger("edit.initial-move-delay", 200);310 initialMoveThreshold = Main.pref.getInt eger("extrude.initial-move-threshold", 1);309 initialMoveDelay = Main.pref.getInt("edit.initial-move-delay", 200); 310 initialMoveThreshold = Main.pref.getInt("extrude.initial-move-threshold", 1); 311 311 mainColor = new ColorProperty(marktr("Extrude: main line"), Color.RED).get(); 312 312 helperColor = new ColorProperty(marktr("Extrude: helper line"), Color.ORANGE).get(); -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r12785 r12841 202 202 mv.addMouseListener(this); 203 203 mv.addMouseMotionListener(this); 204 mv.setVirtualNodesEnabled(Main.pref.getInt eger("mappaint.node.virtual-size", 8) != 0);204 mv.setVirtualNodesEnabled(Main.pref.getInt("mappaint.node.virtual-size", 8) != 0); 205 205 drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true); 206 initialMoveDelay = Main.pref.getInt eger("edit.initial-move-delay", 200);207 initialMoveThreshold = Main.pref.getInt eger("edit.initial-move-threshold", 5);206 initialMoveDelay = Main.pref.getInt("edit.initial-move-delay", 200); 207 initialMoveThreshold = Main.pref.getInt("edit.initial-move-threshold", 5); 208 208 repeatedKeySwitchLassoOption = Main.pref.getBoolean("mappaint.select.toggle-lasso-on-repeated-S", true); 209 209 cycleManager.init(); … … 828 828 } 829 829 } 830 int max = Main.pref.getInt eger("warn.move.maxelements", 20), limit = max;830 int max = Main.pref.getInt("warn.move.maxelements", 20), limit = max; 831 831 for (OsmPrimitive osm : getLayerManager().getEditDataSet().getSelected()) { 832 832 if (osm instanceof Way) { … … 1175 1175 1176 1176 private void init() { 1177 nodeVirtualSize = Main.pref.getInt eger("mappaint.node.virtual-size", 8);1178 int virtualSnapDistSq = Main.pref.getInt eger("mappaint.node.virtual-snap-distance", 8);1177 nodeVirtualSize = Main.pref.getInt("mappaint.node.virtual-size", 8); 1178 int virtualSnapDistSq = Main.pref.getInt("mappaint.node.virtual-snap-distance", 8); 1179 1179 virtualSnapDistSq2 = virtualSnapDistSq*virtualSnapDistSq; 1180 virtualSpace = Main.pref.getInt eger("mappaint.node.virtual-space", 70);1180 virtualSpace = Main.pref.getInt("mappaint.node.virtual-space", 70); 1181 1181 } 1182 1182 -
trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
r12636 r12841 70 70 public void actionPerformed(ActionEvent e) { 71 71 if (!isEnabled() || relations.isEmpty()) return; 72 if (relations.size() > Main.pref.getInt eger("warn.open.maxrelations", 5) &&72 if (relations.size() > Main.pref.getInt("warn.open.maxrelations", 5) && 73 73 /* I18N english text for value 1 makes no real sense, never called for values <= maxrel (usually 5) */ 74 74 JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent, -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r12839 r12841 112 112 }); 113 113 114 for (String s: Main.pref.get Collection("search.history", Collections.<String>emptyList())) {114 for (String s: Main.pref.getList("search.history", Collections.<String>emptyList())) { 115 115 SearchSetting ss = SearchSetting.readFromString(s); 116 116 if (ss != null) { … … 140 140 searchHistory.addFirst(new SearchSetting(s)); 141 141 } 142 int maxsize = Main.pref.getInt eger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE);142 int maxsize = Main.pref.getInt("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE); 143 143 while (searchHistory.size() > maxsize) { 144 144 searchHistory.removeLast(); … … 148 148 savedHistory.add(item.writeToString()); 149 149 } 150 Main.pref.put Collection("search.history", savedHistory);150 Main.pref.putList("search.history", new ArrayList<>(savedHistory)); 151 151 } 152 152 -
trunk/src/org/openstreetmap/josm/command/SplitWayCommand.java
r12828 r12841 273 273 274 274 Collection<Command> commandList = new ArrayList<>(newWays.size()); 275 Collection<String> nowarnroles = Main.pref.get Collection("way.split.roles.nowarn",275 Collection<String> nowarnroles = Main.pref.getList("way.split.roles.nowarn", 276 276 Arrays.asList("outer", "inner", "forward", "backward", "north", "south", "east", "west")); 277 277 -
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); -
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r12718 r12841 74 74 // Currently you have to undo the commands one by one. If 75 75 // this changes, a higher default value may be reasonable. 76 if (commands.size() > Main.pref.getInt eger("undo.max", 1000)) {76 if (commands.size() > Main.pref.getInt("undo.max", 1000)) { 77 77 commands.removeFirst(); 78 78 } -
trunk/src/org/openstreetmap/josm/data/imagery/CachedTileLoaderFactory.java
r12620 r12841 72 72 73 73 return getLoader(listener, cache, 74 (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt eger("socket.timeout.connect", 15)),75 (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt eger("socket.timeout.read", 30)),74 (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt("socket.timeout.connect", 15)), 75 (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt("socket.timeout.read", 30)), 76 76 headers); 77 77 } -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r12620 r12841 817 817 public void clearId() { 818 818 if (this.id != null) { 819 Collection<String> newAddedIds = new TreeSet<>(Main.pref.get Collection("imagery.layers.addedIds"));819 Collection<String> newAddedIds = new TreeSet<>(Main.pref.getList("imagery.layers.addedIds")); 820 820 newAddedIds.add(this.id); 821 Main.pref.put Collection("imagery.layers.addedIds", newAddedIds);821 Main.pref.putList("imagery.layers.addedIds", new ArrayList<>(newAddedIds)); 822 822 } 823 823 setId(null); -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r12635 r12841 57 57 */ 58 58 public static Collection<String> getImageryLayersSites() { 59 return Main.pref.get Collection("imagery.layers.sites", Arrays.asList(DEFAULT_LAYER_SITES));59 return Main.pref.getList("imagery.layers.sites", Arrays.asList(DEFAULT_LAYER_SITES)); 60 60 } 61 61 … … 236 236 // add new default entries to the user selection 237 237 boolean changed = false; 238 Collection<String> knownDefaults = new TreeSet<>(Main.pref.get Collection("imagery.layers.default"));238 Collection<String> knownDefaults = new TreeSet<>(Main.pref.getList("imagery.layers.default")); 239 239 Collection<String> newKnownDefaults = new TreeSet<>(); 240 240 for (ImageryInfo def : defaultLayers) { … … 279 279 newKnownDefaults.addAll(knownDefaults); 280 280 } 281 Main.pref.put Collection("imagery.layers.default", newKnownDefaults);281 Main.pref.putList("imagery.layers.default", new ArrayList<>(newKnownDefaults)); 282 282 283 283 // automatically update user entries with same id as a default entry -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthAccessTokenHolder.java
r12686 r12841 177 177 CheckParameterUtil.ensureParameterNotNull(preferences, "preferences"); 178 178 CheckParameterUtil.ensureParameterNotNull(cm, "cm"); 179 preferences.put ("oauth.access-token.save-to-preferences", saveToPreferences);179 preferences.putBoolean("oauth.access-token.save-to-preferences", saveToPreferences); 180 180 try { 181 181 if (!saveToPreferences) { -
trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
r12735 r12841 105 105 if (namingTagsForRelations == null) { 106 106 namingTagsForRelations = new ArrayList<>( 107 Main.pref.get Collection("relation.nameOrder", Arrays.asList(DEFAULT_NAMING_TAGS_FOR_RELATIONS))107 Main.pref.getList("relation.nameOrder", Arrays.asList(DEFAULT_NAMING_TAGS_FOR_RELATIONS)) 108 108 ); 109 109 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r12816 r12841 650 650 l.addAll(getDiscardableKeys()); 651 651 l.addAll(getWorkInProgressKeys()); 652 uninteresting = new HashSet<>(Main.pref.get Collection("tags.uninteresting", l));652 uninteresting = new HashSet<>(Main.pref.getList("tags.uninteresting", l)); 653 653 } 654 654 return uninteresting; … … 662 662 public static Collection<String> getDiscardableKeys() { 663 663 if (discardable == null) { 664 discardable = new HashSet<>(Main.pref.get Collection("tags.discardable",664 discardable = new HashSet<>(Main.pref.getList("tags.discardable", 665 665 Arrays.asList( 666 666 "created_by", … … 720 720 public static Collection<String> getWorkInProgressKeys() { 721 721 if (workinprogress == null) { 722 workinprogress = new HashSet<>(Main.pref.get Collection("tags.workinprogress",722 workinprogress = new HashSet<>(Main.pref.getList("tags.workinprogress", 723 723 Arrays.asList("note", "fixme", "FIXME"))); 724 724 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
r12620 r12841 182 182 */ 183 183 protected void getSettings(boolean virtual) { 184 this.virtualNodeSize = virtual ? Main.pref.getInt eger("mappaint.node.virtual-size", 8) / 2 : 0;185 this.virtualNodeSpace = Main.pref.getInt eger("mappaint.node.virtual-space", 70);186 this.segmentNumberSpace = Main.pref.getInt eger("mappaint.segmentnumber.space", 40);184 this.virtualNodeSize = virtual ? Main.pref.getInt("mappaint.node.virtual-size", 8) / 2 : 0; 185 this.virtualNodeSpace = Main.pref.getInt("mappaint.node.virtual-space", 70); 186 this.segmentNumberSpace = Main.pref.getInt("mappaint.segmentnumber.space", 40); 187 187 getColors(); 188 188 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/ComputeStyleListWorker.java
r12813 r12841 60 60 this.output = output; 61 61 this.directExecutionTaskSize = directExecutionTaskSize; 62 this.drawArea = circum <= Main.pref.getInt eger("mappaint.fillareas", 10_000_000);62 this.drawArea = circum <= Main.pref.getInt("mappaint.fillareas", 10_000_000); 63 63 this.drawMultipolygon = drawArea && Main.pref.getBoolean("mappaint.multipolygon", true); 64 64 this.drawRestriction = Main.pref.getBoolean("mappaint.restriction", true); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java
r11100 r12841 76 76 showOnewayArrow = Main.pref.getBoolean("draw.oneway", true); 77 77 useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth", false); 78 defaultSegmentWidth = Main.pref.getInt eger("mappaint.segment.default-width", 2);78 defaultSegmentWidth = Main.pref.getInt("mappaint.segment.default-width", 2); 79 79 80 80 selectedColor = PaintColors.SELECTED.get(); … … 95 95 showHeadArrowOnly = Main.pref.getBoolean("draw.segment.head_only", false); 96 96 97 showNamesDistance = Main.pref.getInt eger("mappaint.shownames", 10_000_000);98 useStrokesDistance = Main.pref.getInt eger("mappaint.strokes", 10_000_000);99 showIconsDistance = Main.pref.getInt eger("mappaint.showicons", 10_000_000);100 101 selectedNodeSize = Main.pref.getInt eger("mappaint.node.selected-size", 5);102 unselectedNodeSize = Main.pref.getInt eger("mappaint.node.unselected-size", 3);103 connectionNodeSize = Main.pref.getInt eger("mappaint.node.connection-size", 5);104 taggedNodeSize = Main.pref.getInt eger("mappaint.node.tagged-size", 3);97 showNamesDistance = Main.pref.getInt("mappaint.shownames", 10_000_000); 98 useStrokesDistance = Main.pref.getInt("mappaint.strokes", 10_000_000); 99 showIconsDistance = Main.pref.getInt("mappaint.showicons", 10_000_000); 100 101 selectedNodeSize = Main.pref.getInt("mappaint.node.selected-size", 5); 102 unselectedNodeSize = Main.pref.getInt("mappaint.node.unselected-size", 3); 103 connectionNodeSize = Main.pref.getInt("mappaint.node.connection-size", 5); 104 taggedNodeSize = Main.pref.getInt("mappaint.node.tagged-size", 3); 105 105 fillSelectedNode = Main.pref.getBoolean("mappaint.node.fill-selected", true); 106 106 fillUnselectedNode = Main.pref.getBoolean("mappaint.node.fill-unselected", false); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r12620 r12841 98 98 if (Main.pref == null) return; 99 99 Collection<String> literals; 100 literals = Main.pref.get Collection(PREF_KEY_OUTER_ROLES);100 literals = Main.pref.getList(PREF_KEY_OUTER_ROLES); 101 101 if (literals != null && !literals.isEmpty()) { 102 102 setNormalized(literals, outerExactRoles); 103 103 } 104 literals = Main.pref.get Collection(PREF_KEY_OUTER_ROLE_PREFIXES);104 literals = Main.pref.getList(PREF_KEY_OUTER_ROLE_PREFIXES); 105 105 if (literals != null && !literals.isEmpty()) { 106 106 setNormalized(literals, outerRolePrefixes); 107 107 } 108 literals = Main.pref.get Collection(PREF_KEY_INNER_ROLES);108 literals = Main.pref.getList(PREF_KEY_INNER_ROLES); 109 109 if (literals != null && !literals.isEmpty()) { 110 110 setNormalized(literals, innerExactRoles); 111 111 } 112 literals = Main.pref.get Collection(PREF_KEY_INNER_ROLE_PREFIXES);112 literals = Main.pref.getList(PREF_KEY_INNER_ROLE_PREFIXES); 113 113 if (literals != null && !literals.isEmpty()) { 114 114 setNormalized(literals, innerRolePrefixes); -
trunk/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java
r12825 r12841 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util.ArrayList; 6 7 import java.util.Arrays; 7 8 import java.util.Collection; … … 52 53 boolean changed = false; 53 54 54 Collection<String> knownDefaults = new TreeSet<>(Main.pref.get Collection("mappaint.style.known-defaults"));55 Collection<String> knownDefaults = new TreeSet<>(Main.pref.getList("mappaint.style.known-defaults")); 55 56 56 57 Collection<ExtendedSourceEntry> defaults = getDefault(); … … 70 71 knownDefaults.add(def.url); 71 72 } 72 Main.pref.put Collection("mappaint.style.known-defaults", knownDefaults);73 Main.pref.putList("mappaint.style.known-defaults", new ArrayList<>(knownDefaults)); 73 74 74 75 // XML style is not bundled anymore -
trunk/src/org/openstreetmap/josm/data/preferences/sources/SourcePrefHelper.java
r12825 r12841 58 58 public List<SourceEntry> get() { 59 59 60 Collection<Map<String, String>> src = Main.pref.getListOfStructs(pref, (Collection<Map<String, String>>)null);60 List<Map<String, String>> src = Main.pref.getListOfMaps(pref, null); 61 61 if (src == null) 62 62 return new ArrayList<>(getDefault()); … … 78 78 */ 79 79 public boolean put(Collection<? extends SourceEntry> entries) { 80 Collection<Map<String, String>> setting = serializeList(entries);81 boolean unset = Main.pref.getListOf Structs(pref, (Collection<Map<String, String>>)null) == null;80 List<Map<String, String>> setting = serializeList(entries); 81 boolean unset = Main.pref.getListOfMaps(pref, null) == null; 82 82 if (unset) { 83 83 Collection<Map<String, String>> def = serializeList(getDefault()); … … 85 85 return false; 86 86 } 87 return Main.pref.putListOf Structs(pref, setting);87 return Main.pref.putListOfMaps(pref, setting); 88 88 } 89 89 90 private Collection<Map<String, String>> serializeList(Collection<? extends SourceEntry> entries) {91 Collection<Map<String, String>> setting = new ArrayList<>(entries.size());90 private List<Map<String, String>> serializeList(Collection<? extends SourceEntry> entries) { 91 List<Map<String, String>> setting = new ArrayList<>(entries.size()); 92 92 for (SourceEntry e : entries) { 93 93 setting.add(serialize(e)); -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r12667 r12841 282 282 283 283 private static void applyPrefs(Map<String, Test> tests, boolean beforeUpload) { 284 for (String testName : Main.pref.get Collection(beforeUpload284 for (String testName : Main.pref.getList(beforeUpload 285 285 ? ValidatorPrefHelper.PREF_SKIP_TESTS_BEFORE_UPLOAD : ValidatorPrefHelper.PREF_SKIP_TESTS)) { 286 286 Test test = tests.get(testName); -
trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java
r12050 r12841 112 112 public void startTest(ProgressMonitor monitor) { 113 113 super.startTest(monitor); 114 maxlength = Main.pref.getInt eger("validator.maximum.segment.length", 15_000);114 maxlength = Main.pref.getInt("validator.maximum.segment.length", 15_000); 115 115 reported = new HashSet<>(); 116 116 visitedWays = new HashSet<>(); -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r11913 r12841 23 23 import org.openstreetmap.josm.data.osm.Way; 24 24 import org.openstreetmap.josm.data.osm.WaySegment; 25 import org.openstreetmap.josm.data.preferences. CollectionProperty;25 import org.openstreetmap.josm.data.preferences.ListProperty; 26 26 import org.openstreetmap.josm.data.validation.Severity; 27 27 import org.openstreetmap.josm.data.validation.Test; … … 50 50 protected static final int DUPLICATE_WAY_SEGMENT = 121; 51 51 52 protected static final CollectionProperty IGNORED_KEYS = new CollectionProperty(52 protected static final ListProperty IGNORED_KEYS = new ListProperty( 53 53 "overlapping-ways.ignored-keys", Arrays.asList("barrier", "building", "historic:building", "man_made")); 54 54 -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r12649 r12841 13 13 import java.util.Collection; 14 14 import java.util.HashMap; 15 import java.util.HashSet;16 15 import java.util.List; 17 16 import java.util.Locale; … … 159 158 protected EditableList sourcesList; 160 159 161 private static final Set<String> DEFAULT_SOURCES = new HashSet<>(Arrays.asList(/*DATA_FILE, */IGNORE_FILE, SPELL_FILE));160 private static final List<String> DEFAULT_SOURCES = Arrays.asList(/*DATA_FILE, */IGNORE_FILE, SPELL_FILE); 162 161 163 162 /** … … 191 190 192 191 StringBuilder errorSources = new StringBuilder(); 193 for (String source : Main.pref.get Collection(PREF_SOURCES, DEFAULT_SOURCES)) {192 for (String source : Main.pref.getList(PREF_SOURCES, DEFAULT_SOURCES)) { 194 193 try ( 195 194 CachedFile cf = new CachedFile(source); … … 293 292 } 294 293 // TODO directionKeys are no longer in OsmPrimitive (search pattern is used instead) 295 for (String a : Main.pref.get Collection(ValidatorPrefHelper.PREFIX + ".knownkeys",294 for (String a : Main.pref.getList(ValidatorPrefHelper.PREFIX + ".knownkeys", 296 295 Arrays.asList("is_in", "int_ref", "fixme", "population"))) { 297 296 additionalPresetsValueData.putVoid(a); … … 636 635 testPanel.add(prefCheckComplexBeforeUpload, a); 637 636 638 final Collection<String> sources = Main.pref.get Collection(PREF_SOURCES, DEFAULT_SOURCES);637 final Collection<String> sources = Main.pref.getList(PREF_SOURCES, DEFAULT_SOURCES); 639 638 sourcesList = new EditableList(tr("TagChecker source")); 640 639 sourcesList.setItems(sources); … … 682 681 || prefCheckFixmesBeforeUpload.isSelected() || prefCheckComplexBeforeUpload.isSelected(); 683 682 684 Main.pref.put (PREF_CHECK_VALUES, prefCheckValues.isSelected());685 Main.pref.put (PREF_CHECK_COMPLEX, prefCheckComplex.isSelected());686 Main.pref.put (PREF_CHECK_KEYS, prefCheckKeys.isSelected());687 Main.pref.put (PREF_CHECK_FIXMES, prefCheckFixmes.isSelected());688 Main.pref.put (PREF_CHECK_VALUES_BEFORE_UPLOAD, prefCheckValuesBeforeUpload.isSelected());689 Main.pref.put (PREF_CHECK_COMPLEX_BEFORE_UPLOAD, prefCheckComplexBeforeUpload.isSelected());690 Main.pref.put (PREF_CHECK_KEYS_BEFORE_UPLOAD, prefCheckKeysBeforeUpload.isSelected());691 Main.pref.put (PREF_CHECK_FIXMES_BEFORE_UPLOAD, prefCheckFixmesBeforeUpload.isSelected());692 return Main.pref.put Collection(PREF_SOURCES, sourcesList.getItems());683 Main.pref.putBoolean(PREF_CHECK_VALUES, prefCheckValues.isSelected()); 684 Main.pref.putBoolean(PREF_CHECK_COMPLEX, prefCheckComplex.isSelected()); 685 Main.pref.putBoolean(PREF_CHECK_KEYS, prefCheckKeys.isSelected()); 686 Main.pref.putBoolean(PREF_CHECK_FIXMES, prefCheckFixmes.isSelected()); 687 Main.pref.putBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, prefCheckValuesBeforeUpload.isSelected()); 688 Main.pref.putBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, prefCheckComplexBeforeUpload.isSelected()); 689 Main.pref.putBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, prefCheckKeysBeforeUpload.isSelected()); 690 Main.pref.putBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, prefCheckFixmesBeforeUpload.isSelected()); 691 return Main.pref.putList(PREF_SOURCES, sourcesList.getItems()); 693 692 } 694 693 -
trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
r11921 r12841 60 60 immediateChoices.get(prefKey), 61 61 sessionChoices.get(prefKey), 62 !Main.pref.getBoolean("message." + prefKey, true) ? Main.pref.getInt eger("message." + prefKey + ".value", -1) : -162 !Main.pref.getBoolean("message." + prefKey, true) ? Main.pref.getInt("message." + prefKey + ".value", -1) : -1 63 63 ); 64 64 } … … 239 239 break; 240 240 case PERMANENT: 241 Main.pref.put ("message." + prefKey, false);242 Main.pref.putInt eger("message." + prefKey + ".value", value);241 Main.pref.putBoolean("message." + prefKey, false); 242 Main.pref.putInt("message." + prefKey + ".value", value); 243 243 break; 244 244 } -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r12620 r12841 95 95 String motd = new WikiReader().readLang("StartupPage"); 96 96 // Save this to prefs in case JOSM is updated so MOTD can be refreshed 97 Main.pref.putInt eger("cache.motd.html.version", myVersion);97 Main.pref.putInt("cache.motd.html.version", myVersion); 98 98 Main.pref.put("cache.motd.html.java", myJava); 99 99 Main.pref.put("cache.motd.html.lang", myLang); … … 115 115 // 2. Cannot be written (e.g. while developing). Obviously we don't want to update 116 116 // everytime because of something we can't read. 117 return (Main.pref.getInt eger("cache.motd.html.version", -999) == myVersion)117 return (Main.pref.getInt("cache.motd.html.version", -999) == myVersion) 118 118 && Main.pref.get("cache.motd.html.java").equals(myJava) 119 119 && Main.pref.get("cache.motd.html.lang").equals(myLang); -
trunk/src/org/openstreetmap/josm/gui/IconToggleButton.java
r11553 r12841 120 120 Main.pref.put(getPreferenceKey(), null); 121 121 } else { 122 Main.pref.put (getPreferenceKey(), b);122 Main.pref.putBoolean(getPreferenceKey(), b); 123 123 } 124 124 } -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r12828 r12841 1252 1252 if (wasv6 && !hasv6) { 1253 1253 Logging.info(tr("Detected no useable IPv6 network, prefering IPv4 over IPv6 after next restart.")); 1254 Main.pref.put ("validated.ipv6", hasv6); // be sure it is stored before the restart!1254 Main.pref.putBoolean("validated.ipv6", hasv6); // be sure it is stored before the restart! 1255 1255 try { 1256 1256 RestartAction.restartJOSM(); … … 1259 1259 } 1260 1260 } 1261 Main.pref.put ("validated.ipv6", hasv6);1261 Main.pref.putBoolean("validated.ipv6", hasv6); 1262 1262 }, "IPv6-checker").start(); 1263 1263 } -
trunk/src/org/openstreetmap/josm/gui/MainFrame.java
r12678 r12841 110 110 geometry.remember("gui.geometry"); 111 111 } 112 Main.pref.put ("gui.maximized", (windowState & JFrame.MAXIMIZED_BOTH) != 0);112 Main.pref.putBoolean("gui.maximized", (windowState & JFrame.MAXIMIZED_BOTH) != 0); 113 113 } 114 114 -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r12636 r12841 583 583 public void actionPerformed(ActionEvent e) { 584 584 boolean sel = ((JCheckBoxMenuItem) e.getSource()).getState(); 585 Main.pref.put ("sidetoolbar.always-visible", sel);585 Main.pref.putBoolean("sidetoolbar.always-visible", sel); 586 586 } 587 587 }); … … 625 625 @Override 626 626 public void actionPerformed(ActionEvent e) { 627 Main.pref.put ("sidetoolbar.visible", false);627 Main.pref.putBoolean("sidetoolbar.visible", false); 628 628 } 629 629 }); -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r12735 r12841 775 775 public void actionPerformed(ActionEvent e) { 776 776 boolean sel = ((JCheckBoxMenuItem) e.getSource()).getState(); 777 Main.pref.put ("statusbar.always-visible", sel);777 Main.pref.putBoolean("statusbar.always-visible", sel); 778 778 } 779 779 }); … … 1079 1079 // Compute total length of selected way(s) until an arbitrary limit set to 250 ways 1080 1080 // in order to prevent performance issue if a large number of ways are selected (old behaviour kept in that case, see #8403) 1081 int maxWays = Math.max(1, Main.pref.getInt eger("selection.max-ways-for-statusline", 250));1081 int maxWays = Math.max(1, Main.pref.getInt("selection.max-ways-for-statusline", 250)); 1082 1082 if (!ways.isEmpty() && ways.size() <= maxWays) { 1083 1083 dist = 0.0; -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r12778 r12841 871 871 if ((now.getTime() - zoomTimestamp.getTime()) > (Main.pref.getDouble("zoom.undo.delay", 1.0) * 1000)) { 872 872 zoomUndoBuffer.push(new ZoomData(center, scale)); 873 if (zoomUndoBuffer.size() > Main.pref.getInt eger("zoom.undo.max", 50)) {873 if (zoomUndoBuffer.size() > Main.pref.getInt("zoom.undo.max", 50)) { 874 874 zoomUndoBuffer.remove(0); 875 875 } … … 1144 1144 1145 1145 if (ds != null) { 1146 double snapDistanceSq = Main.pref.getInt eger("mappaint.segment.snap-distance", 10);1146 double snapDistanceSq = Main.pref.getInt("mappaint.segment.snap-distance", 10); 1147 1147 snapDistanceSq *= snapDistanceSq; 1148 1148 1149 for (Way w : ds.searchWays(getBBox(p, Main.pref.getInt eger("mappaint.segment.snap-distance", 10)))) {1149 for (Way w : ds.searchWays(getBBox(p, Main.pref.getInt("mappaint.segment.snap-distance", 10)))) { 1150 1150 if (!predicate.test(w)) { 1151 1151 continue; -
trunk/src/org/openstreetmap/josm/gui/Notification.java
r11100 r12841 43 43 * E.g. "Please select at least one node". 44 44 */ 45 public static final int TIME_SHORT = Main.pref.getInt eger("notification-time-short-ms", 3000);45 public static final int TIME_SHORT = Main.pref.getInt("notification-time-short-ms", 3000); 46 46 47 47 /** 48 48 * Short message of one or two lines (5 s). 49 49 */ 50 public static final int TIME_DEFAULT = Main.pref.getInt eger("notification-time-default-ms", 5000);50 public static final int TIME_DEFAULT = Main.pref.getInt("notification-time-default-ms", 5000); 51 51 52 52 /** 53 53 * Somewhat longer message (10 s). 54 54 */ 55 public static final int TIME_LONG = Main.pref.getInt eger("notification-time-long-ms", 10_000);55 public static final int TIME_LONG = Main.pref.getInt("notification-time-long-ms", 10_000); 56 56 57 57 /** … … 59 59 * (Make sure is still sensible to show as a notification) 60 60 */ 61 public static final int TIME_VERY_LONG = Main.pref.getInt eger("notification-time-very_long-ms", 20_000);61 public static final int TIME_VERY_LONG = Main.pref.getInt("notification-time-very_long-ms", 20_000); 62 62 63 63 private Component content; -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
r12675 r12841 82 82 int w = getWidth(); 83 83 if (w > 200) { 84 Main.pref.putInt eger("progressdialog.size", w);84 Main.pref.putInt("progressdialog.size", w); 85 85 } 86 86 } … … 98 98 setDropTarget(null); // Workaround to JDK bug 7027598/7100524/7169912 (#8613) 99 99 pack(); 100 setSize(Main.pref.getInt eger("progressdialog.size", 600), getSize().height);100 setSize(Main.pref.getInt("progressdialog.size", 600), getSize().height); 101 101 } 102 102 -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r12620 r12841 162 162 setFileCacheEnabled(Main.pref.getBoolean("slippy_map_chooser.file_cache", true)); 163 163 } 164 setMaxTilesInMemory(Main.pref.getInt eger("slippy_map_chooser.max_tiles", 1000));164 setMaxTilesInMemory(Main.pref.getInt("slippy_map_chooser.max_tiles", 1000)); 165 165 166 166 List<TileSource> tileSources = getAllTileSources(); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolver.java
r11772 r12841 78 78 */ 79 79 public void rememberPreferences() { 80 Main.pref.put (getClass().getName() + ".showTagsWithConflictsOnly", cbShowTagsWithConflictsOnly.isSelected());81 Main.pref.put (getClass().getName() + ".showTagsWithMultiValuesOnly", cbShowTagsWithMultiValuesOnly.isSelected());80 Main.pref.putBoolean(getClass().getName() + ".showTagsWithConflictsOnly", cbShowTagsWithConflictsOnly.isSelected()); 81 Main.pref.putBoolean(getClass().getName() + ".showTagsWithMultiValuesOnly", cbShowTagsWithMultiValuesOnly.isSelected()); 82 82 } 83 83 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r12636 r12841 275 275 @Override 276 276 public void itemStateChanged(ItemEvent e) { 277 Main.pref.put ("changeset-dialog.for-selected-objects-only", cbInSelectionOnly.isSelected());277 Main.pref.putBoolean("changeset-dialog.for-selected-objects-only", cbInSelectionOnly.isSelected()); 278 278 pnlList.removeAll(); 279 279 if (cbInSelectionOnly.isSelected()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/OsmIdSelectionDialog.java
r12301 r12841 180 180 protected void restorePrimitivesHistory(HistoryComboBox cbHistory) { 181 181 List<String> cmtHistory = new LinkedList<>( 182 Main.pref.get Collection(getClass().getName() + ".primitivesHistory", new LinkedList<String>()));182 Main.pref.getList(getClass().getName() + ".primitivesHistory", new LinkedList<String>())); 183 183 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 184 184 Collections.reverse(cmtHistory); … … 193 193 protected void remindPrimitivesHistory(HistoryComboBox cbHistory) { 194 194 cbHistory.addCurrentItemToHistory(); 195 Main.pref.put Collection(getClass().getName() + ".primitivesHistory", cbHistory.getHistory());195 Main.pref.putList(getClass().getName() + ".primitivesHistory", cbHistory.getHistory()); 196 196 } 197 197 … … 208 208 public void setupDialog() { 209 209 setContent(panel, false); 210 cbType.setSelectedIndex(Main.pref.getInt eger("downloadprimitive.lasttype", 0));210 cbType.setSelectedIndex(Main.pref.getInt("downloadprimitive.lasttype", 0)); 211 211 tfId.setType(cbType.getType()); 212 212 if (Main.pref.getBoolean("downloadprimitive.autopaste", true)) { … … 221 221 String buf = ClipboardUtils.getClipboardStringContent(); 222 222 if (buf == null || buf.isEmpty()) return; 223 if (buf.length() > Main.pref.getInt eger("downloadprimitive.max-autopaste-length", 2000)) return;223 if (buf.length() > Main.pref.getInt("downloadprimitive.max-autopaste-length", 2000)) return; 224 224 final List<SimplePrimitiveId> ids = SimplePrimitiveId.fuzzyParse(buf); 225 225 if (!ids.isEmpty()) { … … 244 244 @Override public void windowClosed(WindowEvent e) { 245 245 if (e != null && e.getComponent() == this && getValue() == getContinueButtonIndex()) { 246 Main.pref.putInt eger("downloadprimitive.lasttype", cbType.getSelectedIndex());246 Main.pref.putInt("downloadprimitive.lasttype", cbType.getSelectedIndex()); 247 247 248 248 if (!tfId.readIds()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r12663 r12841 524 524 } 525 525 } 526 int maxsize = Main.pref.getInt eger("select.history-size", SELECTION_HISTORY_SIZE);526 int maxsize = Main.pref.getInt("select.history-size", SELECTION_HISTORY_SIZE); 527 527 while (history.size() > maxsize) { 528 528 history.removeLast(); … … 662 662 */ 663 663 public synchronized void sort() { 664 if (selection.size() <= Main.pref.getInt eger("selection.no_sort_above", 100_000)) {665 boolean quick = selection.size() > Main.pref.getInt eger("selection.fast_sort_above", 10_000);664 if (selection.size() <= Main.pref.getInt("selection.no_sort_above", 100_000)) { 665 boolean quick = selection.size() > Main.pref.getInt("selection.fast_sort_above", 10_000); 666 666 Comparator<OsmPrimitive> c = Main.pref.getBoolean("selection.sort_relations_before_ways", true) 667 667 ? OsmPrimitiveComparator.orderingRelationsWaysNodes() -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r12678 r12841 773 773 protected void setIsShowing(boolean val) { 774 774 isShowing = val; 775 Main.pref.put (preferencePrefix+".visible", val);775 Main.pref.putBoolean(preferencePrefix+".visible", val); 776 776 stateChanged(); 777 777 } … … 782 782 } 783 783 isDocked = val; 784 Main.pref.put (preferencePrefix+".docked", val);784 Main.pref.putBoolean(preferencePrefix+".docked", val); 785 785 stateChanged(); 786 786 } … … 788 788 protected void setIsCollapsed(boolean val) { 789 789 isCollapsed = val; 790 Main.pref.put (preferencePrefix+".minimized", val);790 Main.pref.putBoolean(preferencePrefix+".minimized", val); 791 791 stateChanged(); 792 792 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
r11326 r12841 209 209 */ 210 210 public void rememberSettings() { 211 Main.pref.put ("changeset-query.advanced.user-restrictions", cbUserRestriction.isSelected());212 Main.pref.put ("changeset-query.advanced.open-restrictions", cbOpenAndCloseRestrictions.isSelected());213 Main.pref.put ("changeset-query.advanced.time-restrictions", cbTimeRestrictions.isSelected());214 Main.pref.put ("changeset-query.advanced.bbox-restrictions", cbBoundingBoxRestriction.isSelected());211 Main.pref.putBoolean("changeset-query.advanced.user-restrictions", cbUserRestriction.isSelected()); 212 Main.pref.putBoolean("changeset-query.advanced.open-restrictions", cbOpenAndCloseRestrictions.isSelected()); 213 Main.pref.putBoolean("changeset-query.advanced.time-restrictions", cbTimeRestrictions.isSelected()); 214 Main.pref.putBoolean("changeset-query.advanced.bbox-restrictions", cbBoundingBoxRestriction.isSelected()); 215 215 216 216 pnlUserRestriction.rememberSettings(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java
r12743 r12841 191 191 Main.pref.put("changeset-query.basic.query", q.toString()); 192 192 } 193 Main.pref.put ("changeset-query.basic.my-changesets-only", cbMyChangesetsOnly.isSelected());193 Main.pref.putBoolean("changeset-query.basic.my-changesets-only", cbMyChangesetsOnly.isSelected()); 194 194 } 195 195 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollection.java
r12659 r12841 12 12 import org.openstreetmap.josm.data.osm.search.SearchSetting; 13 13 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 14 import org.openstreetmap.josm.data.preferences. CollectionProperty;14 import org.openstreetmap.josm.data.preferences.ListProperty; 15 15 16 16 /** … … 44 44 } 45 45 46 public void loadFromPreference( CollectionProperty property) {46 public void loadFromPreference(ListProperty property) { 47 47 recentTags.clear(); 48 48 Iterator<String> it = property.get().iterator(); … … 54 54 } 55 55 56 public void saveToPreference( CollectionProperty property) {56 public void saveToPreference(ListProperty property) { 57 57 List<String> c = new ArrayList<>(recentTags.size() * 2); 58 58 for (Tag t : recentTags.keySet()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r12758 r12841 73 73 import org.openstreetmap.josm.data.osm.search.SearchSetting; 74 74 import org.openstreetmap.josm.data.preferences.BooleanProperty; 75 import org.openstreetmap.josm.data.preferences. CollectionProperty;75 import org.openstreetmap.josm.data.preferences.ListProperty; 76 76 import org.openstreetmap.josm.data.preferences.EnumProperty; 77 77 import org.openstreetmap.josm.data.preferences.IntegerProperty; … … 128 128 DEFAULT_LRU_TAGS_NUMBER); 129 129 /** The preference storage of recent tags */ 130 public static final CollectionProperty PROPERTY_RECENT_TAGS = new CollectionProperty("properties.recent-tags",130 public static final ListProperty PROPERTY_RECENT_TAGS = new ListProperty("properties.recent-tags", 131 131 Collections.<String>emptyList()); 132 132 public static final StringProperty PROPERTY_TAGS_TO_IGNORE = new StringProperty("properties.recent-tags.ignore", -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r12743 r12841 300 300 */ 301 301 public final void save() { 302 List< Collection<String>> coll = new LinkedList<>();302 List<List<String>> coll = new LinkedList<>(); 303 303 for (Object o : ((DefaultListModel<Bookmark>) getModel()).toArray()) { 304 304 if (o instanceof HomeLocationBookmark || o instanceof ChangesetBookmark) { … … 315 315 coll.add(Arrays.asList(array)); 316 316 } 317 Main.pref.put Array("bookmarks", coll);317 Main.pref.putListOfLists("bookmarks", coll); 318 318 } 319 319 -
trunk/src/org/openstreetmap/josm/gui/download/DownloadObjectDialog.java
r12279 r12841 103 103 super.windowClosed(e); 104 104 if (e != null && e.getComponent() == this && getValue() == 1) { 105 Main.pref.put ("downloadprimitive.referrers", referrers.isSelected());106 Main.pref.put ("downloadprimitive.full", fullRel.isSelected());107 Main.pref.put ("download.newlayer", newLayer.isSelected());105 Main.pref.putBoolean("downloadprimitive.referrers", referrers.isSelected()); 106 Main.pref.putBoolean("downloadprimitive.full", fullRel.isSelected()); 107 Main.pref.putBoolean("download.newlayer", newLayer.isSelected()); 108 108 } 109 109 } -
trunk/src/org/openstreetmap/josm/gui/download/OverpassQueryList.java
r12620 r12841 244 244 */ 245 245 private void savePreferences() { 246 Collection<Map<String, String>> toSave = new ArrayList<>(this.items.size());246 List<Map<String, String>> toSave = new ArrayList<>(this.items.size()); 247 247 for (SelectorItem item : this.items.values()) { 248 248 Map<String, String> it = new HashMap<>(); … … 254 254 } 255 255 256 Main.pref.putListOf Structs(PREFERENCE_ITEMS, toSave);256 Main.pref.putListOfMaps(PREFERENCE_ITEMS, toSave); 257 257 } 258 258 … … 263 263 private static Map<String, SelectorItem> restorePreferences() { 264 264 Collection<Map<String, String>> toRetrieve = 265 Main.pref.getListOf Structs(PREFERENCE_ITEMS, Collections.emptyList());265 Main.pref.getListOfMaps(PREFERENCE_ITEMS, Collections.emptyList()); 266 266 Map<String, SelectorItem> result = new HashMap<>(); 267 267 -
trunk/src/org/openstreetmap/josm/gui/download/OverpassQueryWizardDialog.java
r12655 r12841 20 20 21 21 import org.openstreetmap.josm.Main; 22 import org.openstreetmap.josm.data.preferences. CollectionProperty;22 import org.openstreetmap.josm.data.preferences.ListProperty; 23 23 import org.openstreetmap.josm.gui.ExtendedDialog; 24 24 import org.openstreetmap.josm.gui.util.GuiHelper; … … 47 47 private static final String SPAN_START = "<span>"; 48 48 private static final String SPAN_END = "</span>"; 49 private static final CollectionProperty OVERPASS_WIZARD_HISTORY =50 new CollectionProperty("download.overpass.wizard", new ArrayList<String>());49 private static final ListProperty OVERPASS_WIZARD_HISTORY = 50 new ListProperty("download.overpass.wizard", new ArrayList<String>()); 51 51 private final transient OverpassTurboQueryWizard overpassQueryBuilder; 52 52 -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r12634 r12841 115 115 cbSearchExpression = new HistoryComboBox(); 116 116 cbSearchExpression.setToolTipText(tr("Enter a place name to search for")); 117 List<String> cmtHistory = new LinkedList<>(Main.pref.get Collection(HISTORY_KEY, new LinkedList<String>()));117 List<String> cmtHistory = new LinkedList<>(Main.pref.getList(HISTORY_KEY, new LinkedList<String>())); 118 118 Collections.reverse(cmtHistory); 119 119 cbSearchExpression.setPossibleItems(cmtHistory); … … 189 189 return; 190 190 cbSearchExpression.addCurrentItemToHistory(); 191 Main.pref.put Collection(HISTORY_KEY, cbSearchExpression.getHistory());191 Main.pref.putList(HISTORY_KEY, cbSearchExpression.getHistory()); 192 192 NameQueryTask task = new NameQueryTask(cbSearchExpression.getText()); 193 193 MainApplication.worker.submit(task); -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r11646 r12841 341 341 Object val = tbl.getColumnModel().getColumn(col).getHeaderValue(); 342 342 Component comp = tcr.getTableCellRendererComponent(tbl, val, false, false, -1, col); 343 maxwidth = Math.max(comp.getPreferredSize().width + Main.pref.getInt eger("table.header-inset", 0), maxwidth);343 maxwidth = Math.max(comp.getPreferredSize().width + Main.pref.getInt("table.header-inset", 0), maxwidth); 344 344 345 345 int spacing = tbl.getIntercellSpacing().width; -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r12719 r12841 78 78 hcbUploadComment.setToolTipText(tr("Enter an upload comment")); 79 79 hcbUploadComment.setMaxTextLength(Changeset.MAX_CHANGESET_TAG_LENGTH); 80 List<String> cmtHistory = new LinkedList<>(Main.pref.get Collection(HISTORY_KEY, new LinkedList<String>()));80 List<String> cmtHistory = new LinkedList<>(Main.pref.getList(HISTORY_KEY, new LinkedList<String>())); 81 81 Collections.reverse(cmtHistory); // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 82 82 hcbUploadComment.setPossibleItems(cmtHistory); … … 100 100 hcbUploadSource.setToolTipText(tr("Enter a source")); 101 101 hcbUploadSource.setMaxTextLength(Changeset.MAX_CHANGESET_TAG_LENGTH); 102 List<String> sourceHistory = new LinkedList<>(Main.pref.get Collection(SOURCE_HISTORY_KEY, getDefaultSources()));102 List<String> sourceHistory = new LinkedList<>(Main.pref.getList(SOURCE_HISTORY_KEY, getDefaultSources())); 103 103 Collections.reverse(sourceHistory); // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 104 104 hcbUploadSource.setPossibleItems(sourceHistory); … … 166 166 // store the history of comments 167 167 hcbUploadComment.addCurrentItemToHistory(); 168 Main.pref.put Collection(HISTORY_KEY, hcbUploadComment.getHistory());169 Main.pref.putInt eger(HISTORY_LAST_USED_KEY, (int) (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));168 Main.pref.putList(HISTORY_KEY, hcbUploadComment.getHistory()); 169 Main.pref.putInt(HISTORY_LAST_USED_KEY, (int) (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); 170 170 // store the history of sources 171 171 hcbUploadSource.addCurrentItemToHistory(); 172 Main.pref.put Collection(SOURCE_HISTORY_KEY, hcbUploadSource.getHistory());172 Main.pref.putList(SOURCE_HISTORY_KEY, hcbUploadSource.getHistory()); 173 173 } 174 174 -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
r12634 r12841 256 256 case ItemEvent.SELECTED: 257 257 firePropertyChange(CLOSE_CHANGESET_AFTER_UPLOAD, false, true); 258 Main.pref.put ("upload.changeset.close", true);258 Main.pref.putBoolean("upload.changeset.close", true); 259 259 break; 260 260 case ItemEvent.DESELECTED: 261 261 firePropertyChange(CLOSE_CHANGESET_AFTER_UPLOAD, true, false); 262 Main.pref.put ("upload.changeset.close", false);262 Main.pref.putBoolean("upload.changeset.close", false); 263 263 break; 264 264 default: // Do nothing -
trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
r12826 r12841 400 400 MainApplication.worker.submit(pluginDownloadTask); 401 401 } 402 Collection<String> pls = new ArrayList<>(Main.pref.getCollection("plugins"));402 List<String> pls = new ArrayList<>(Main.pref.getList("plugins")); 403 403 for (PluginInformation pi2: toInstallPlugins) { 404 404 if (!pls.contains(pi2.name)) { … … 413 413 new File(Main.pref.getPluginsDirectory(), pi4.name+".jar").deleteOnExit(); 414 414 } 415 Main.pref.put Collection("plugins", pls);415 Main.pref.putList("plugins", pls); 416 416 }); 417 417 } -
trunk/src/org/openstreetmap/josm/gui/io/RecentlyOpenedFilesMenu.java
r12634 r12841 58 58 private void rebuild() { 59 59 removeAll(); 60 Collection<String> fileHistory = Main.pref.get Collection("file-open.history");60 Collection<String> fileHistory = Main.pref.getList("file-open.history"); 61 61 62 62 for (final String file : fileHistory) { … … 101 101 @Override 102 102 public void actionPerformed(ActionEvent e) { 103 Main.pref.put Collection("file-open.history", null);103 Main.pref.putList("file-open.history", null); 104 104 } 105 105 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r12799 r12841 653 653 654 654 private static String getLastChangesetTagFromHistory(String historyKey, List<String> def) { 655 Collection<String> history = Main.pref.get Collection(historyKey, def);656 int age = (int) (System.currentTimeMillis() / 1000 - Main.pref.getInt eger(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0));655 Collection<String> history = Main.pref.getList(historyKey, def); 656 int age = (int) (System.currentTimeMillis() / 1000 - Main.pref.getInt(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0)); 657 657 if (history != null && age < Main.pref.getLong(BasicUploadSettingsPanel.HISTORY_MAX_AGE_KEY, TimeUnit.HOURS.toMillis(4)) 658 658 && !history.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
r12687 r12841 323 323 UploadStrategy strategy = UploadStrategy.getFromPreferences(); 324 324 rbStrategy.get(strategy).setSelected(true); 325 int chunkSize = Main.pref.getInt eger("osm-server.upload-strategy.chunk-size", 1);325 int chunkSize = Main.pref.getInt("osm-server.upload-strategy.chunk-size", 1); 326 326 tfChunkSize.setText(Integer.toString(chunkSize)); 327 327 updateNumRequestsLabels(); … … 337 337 try { 338 338 chunkSize = Integer.parseInt(tfChunkSize.getText().trim()); 339 Main.pref.putInt eger("osm-server.upload-strategy.chunk-size", chunkSize);339 Main.pref.putInt("osm-server.upload-strategy.chunk-size", chunkSize); 340 340 } catch (NumberFormatException e) { 341 341 // don't save invalid value to preferences -
trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
r12671 r12841 162 162 setCanceled(false); 163 163 164 Main.pref.put ("lastAddAuthor", author.isSelected());164 Main.pref.putBoolean("lastAddAuthor", author.isSelected()); 165 165 if (!authorName.getText().isEmpty()) { 166 166 Main.pref.put("lastAuthorName", authorName.getText()); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r12671 r12841 174 174 Main.pref.put("geoimage.timezone", timezone.formatTimezone()); 175 175 Main.pref.put("geoimage.delta", delta.formatOffset()); 176 Main.pref.put ("geoimage.showThumbs", yLayer.useThumbs);176 Main.pref.putBoolean("geoimage.showThumbs", yLayer.useThumbs); 177 177 178 178 yLayer.useThumbs = cbShowThumbs.isSelected(); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java
r12636 r12841 119 119 for (Marker marker : layer.data) { 120 120 final Node node = new Node(marker.getCoor()); 121 final Collection<String> mapping = Main.pref.get Collection("gpx.to-osm-mapping", Arrays.asList(121 final Collection<String> mapping = Main.pref.getList("gpx.to-osm-mapping", Arrays.asList( 122 122 GpxConstants.GPX_NAME, "name", 123 123 GpxConstants.GPX_DESC, "description", -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java
r12377 r12841 105 105 Main.pref.putLong(prefDateMin, dateFrom.getDate().getTime()); 106 106 Main.pref.putLong(prefDateMax, dateTo.getDate().getTime()); 107 Main.pref.put (prefDate0, noTimestampCb.isSelected());107 Main.pref.putBoolean(prefDate0, noTimestampCb.isSelected()); 108 108 } 109 109 -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongPanel.java
r10611 r12841 85 85 add(new JLabel(tr("Download near:")), GBC.eol()); 86 86 downloadNear = new JList<>(new String[]{tr("track only"), tr("waypoints only"), tr("track and waypoints")}); 87 downloadNear.setSelectedIndex(Main.pref.getInt eger(prefNear, 0));87 downloadNear.setSelectedIndex(Main.pref.getInt(prefNear, 0)); 88 88 add(downloadNear, GBC.eol()); 89 89 } else { … … 138 138 */ 139 139 protected final void rememberSettings() { 140 Main.pref.put (prefOsm, isDownloadOsmData());141 Main.pref.put (prefGps, isDownloadGpxData());140 Main.pref.putBoolean(prefOsm, isDownloadOsmData()); 141 Main.pref.putBoolean(prefGps, isDownloadGpxData()); 142 142 Main.pref.putDouble(prefDist, getDistance()); 143 143 Main.pref.putDouble(prefArea, getArea()); 144 144 if (prefNear != null) { 145 Main.pref.putInt eger(prefNear, getNear());145 Main.pref.putInt(prefNear, getNear()); 146 146 } 147 147 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r12725 r12841 183 183 184 184 private void setupColors() { 185 hdopAlpha = Main.pref.getInt eger("hdop.color.alpha", -1);185 hdopAlpha = Main.pref.getInt("hdop.color.alpha", -1); 186 186 velocityScale = ColorScale.createHSBScale(256); 187 187 /** Colors (without custom alpha channel, if given) for HDOP painting. **/ … … 320 320 colorModeDynamic = Main.pref.getBoolean("draw.rawgps.colors.dynamic", spec, false); 321 321 /* good HDOP's are between 1 and 3, very bad HDOP's go into 3 digit values */ 322 hdoprange = Main.pref.getInt eger("hdop.range", 7);323 minTrackDurationForTimeColoring = Main.pref.getInt eger("draw.rawgps.date-coloring-min-dt", 60);324 largePointAlpha = Main.pref.getInt eger("draw.rawgps.large.alpha", -1) & 0xFF;322 hdoprange = Main.pref.getInt("hdop.range", 7); 323 minTrackDurationForTimeColoring = Main.pref.getInt("draw.rawgps.date-coloring-min-dt", 60); 324 largePointAlpha = Main.pref.getInt("draw.rawgps.large.alpha", -1) & 0xFF; 325 325 326 326 // get heatmap parameters -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/ReprojectionTile.java
r12669 r12841 159 159 160 160 ImageWarp.PointTransform transform; 161 int stride = Main.pref.getInt eger("imagery.warp.projection-interpolation.stride", 7);161 int stride = Main.pref.getInt("imagery.warp.projection-interpolation.stride", 7); 162 162 if (stride > 0) { 163 163 transform = new ImageWarp.GridTransform(pointTransform, stride); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r12725 r12841 64 64 enabled = Main.pref.getBoolean("marker.traceaudio", true); 65 65 if (!enabled) return; 66 dropTolerance = Main.pref.getInt eger("marker.playHeadDropTolerance", 50);66 dropTolerance = Main.pref.getInt("marker.playHeadDropTolerance", 50); 67 67 if (MainApplication.isDisplayingMapView()) { 68 68 MapFrame map = MainApplication.getMap(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r12825 r12841 256 256 } 257 257 258 Collection<String> prefIconDirs = Main.pref.get Collection("mappaint.icon.sources");258 Collection<String> prefIconDirs = Main.pref.getList("mappaint.icon.sources"); 259 259 for (String fileset : prefIconDirs) { 260 260 String[] a; -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSetting.java
r12831 r12841 79 79 Main.pref.put(prefKey, null); 80 80 } else { 81 Main.pref.put (prefKey, b);81 Main.pref.putBoolean(prefKey, b); 82 82 } 83 83 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r12722 r12841 90 90 ); 91 91 92 fillImage.alpha = Utils.clamp(Main.pref.getInt eger("mappaint.fill-image-alpha", 255), 0, 255);92 fillImage.alpha = Utils.clamp(Main.pref.getInt("mappaint.fill-image-alpha", 255), 0, 255); 93 93 Integer pAlpha = Utils.colorFloat2int(c.get(FILL_OPACITY, null, float.class)); 94 94 if (pAlpha != null) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java
r11615 r12841 238 238 } else { 239 239 this.nameTags = new ArrayList<>( 240 Main.pref.get Collection("mappaint.nameOrder", Arrays.asList(DEFAULT_NAME_TAGS))240 Main.pref.getList("mappaint.nameOrder", Arrays.asList(DEFAULT_NAME_TAGS)) 241 241 ); 242 242 this.nameComplementTags = new ArrayList<>( 243 Main.pref.get Collection("mappaint.nameComplementOrder", Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS))243 Main.pref.getList("mappaint.nameComplementOrder", Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS)) 244 244 ); 245 245 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r12756 r12841 196 196 mapImage.offsetY = Math.round(offsetYF); 197 197 198 mapImage.alpha = Utils.clamp(Main.pref.getInt eger("mappaint.icon-image-alpha", 255), 0, 255);198 mapImage.alpha = Utils.clamp(Main.pref.getInt("mappaint.icon-image-alpha", 255), 0, 255); 199 199 Integer pAlpha = Utils.colorFloat2int(c.get(keys[ICON_OPACITY_IDX], null, float.class)); 200 200 if (pAlpha != null) { … … 357 357 // However, it would be better, if the settings could be changed at runtime. 358 358 int size = max( 359 Main.pref.getInt eger("mappaint.node.selected-size", 5),360 Main.pref.getInt eger("mappaint.node.unselected-size", 3),361 Main.pref.getInt eger("mappaint.node.connection-size", 5),362 Main.pref.getInt eger("mappaint.node.tagged-size", 3)359 Main.pref.getInt("mappaint.node.selected-size", 5), 360 Main.pref.getInt("mappaint.node.unselected-size", 3), 361 Main.pref.getInt("mappaint.node.connection-size", 5), 362 Main.pref.getInt("mappaint.node.tagged-size", 3) 363 363 ); 364 364 return new SimpleBoxProvider(new Rectangle(-size/2, -size/2, size, size)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java
r12539 r12841 148 148 s = defaultFontSize; 149 149 if (s == null) { 150 defaultFontSize = s = (float) Main.pref.getInt eger("mappaint.fontsize", 8);150 defaultFontSize = s = (float) Main.pref.getInt("mappaint.fontsize", 8); 151 151 } 152 152 } -
trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java
r10268 r12841 281 281 public void rememberPreferences(Preferences pref) { 282 282 CheckParameterUtil.ensureParameterNotNull(pref, "pref"); 283 pref.put ("oauth.settings.use-default", cbUseDefaults.isSelected());283 pref.putBoolean("oauth.settings.use-default", cbUseDefaults.isSelected()); 284 284 if (cbUseDefaults.isSelected()) { 285 285 new OAuthParameters(null, null, null, null, null, null, null).rememberPreferences(pref); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r12825 r12841 423 423 424 424 if (!iconPaths.isEmpty()) { 425 if (Main.pref.put Collection(iconPref, iconPaths)) {425 if (Main.pref.putList(iconPref, iconPaths)) { 426 426 changed = true; 427 427 } 428 } else if (Main.pref.put Collection(iconPref, null)) {428 } else if (Main.pref.putList(iconPref, null)) { 429 429 changed = true; 430 430 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r12643 r12841 496 496 @Override 497 497 public void actionPerformed(ActionEvent e) { 498 Collection<String> t = new LinkedList<>(getToolString());498 List<String> t = new LinkedList<>(getToolString()); 499 499 ActionParser parser = new ActionParser(null); 500 500 // get text definition of current action … … 502 502 // remove the button from toolbar preferences 503 503 t.remove(res); 504 Main.pref.put Collection("toolbar", t);504 Main.pref.putList("toolbar", t); 505 505 MainApplication.getToolbar().refreshToolbarControl(); 506 506 } … … 532 532 public void actionPerformed(ActionEvent e) { 533 533 boolean sel = ((JCheckBoxMenuItem) e.getSource()).getState(); 534 Main.pref.put ("toolbar.always-visible", sel);535 Main.pref.put ("menu.always-visible", sel);534 Main.pref.putBoolean("toolbar.always-visible", sel); 535 Main.pref.putBoolean("menu.always-visible", sel); 536 536 } 537 537 }); … … 971 971 @Override 972 972 public boolean ok() { 973 Collection<String> t = new LinkedList<>();973 List<String> t = new LinkedList<>(); 974 974 ActionParser parser = new ActionParser(null); 975 975 for (int i = 0; i < selected.size(); ++i) { … … 987 987 t = Collections.singletonList(EMPTY_TOOLBAR_MARKER); 988 988 } 989 Main.pref.put Collection("toolbar", t);989 Main.pref.putList("toolbar", t); 990 990 MainApplication.getToolbar().refreshToolbarControl(); 991 991 return false; … … 1074 1074 public static Collection<String> getToolString() { 1075 1075 1076 Collection<String> toolStr = Main.pref.get Collection("toolbar", Arrays.asList(deftoolbar));1076 Collection<String> toolStr = Main.pref.getList("toolbar", Arrays.asList(deftoolbar)); 1077 1077 if (toolStr == null || toolStr.isEmpty()) { 1078 1078 toolStr = Arrays.asList(deftoolbar); … … 1214 1214 } 1215 1215 } 1216 Main.pref.put Collection("toolbar", t);1216 Main.pref.putList("toolbar", t); 1217 1217 MainApplication.getToolbar().refreshToolbarControl(); 1218 1218 } -
trunk/src/org/openstreetmap/josm/gui/preferences/audio/AudioPreference.java
r9778 r12841 133 133 @Override 134 134 public boolean ok() { 135 Main.pref.put ("audio.menuinvisible", !audioMenuVisible.isSelected());136 Main.pref.put ("marker.traceaudio", markerAudioTraceVisible.isSelected());137 Main.pref.put ("marker.buttonlabels", markerButtonLabels.isSelected());138 Main.pref.put ("marker.audiofromexplicitwaypoints", audioMarkersFromExplicitWaypoints.isSelected());139 Main.pref.put ("marker.audiofromuntimedwaypoints", audioMarkersFromUntimedWaypoints.isSelected());140 Main.pref.put ("marker.audiofromnamedtrackpoints", audioMarkersFromNamedTrackpoints.isSelected());141 Main.pref.put ("marker.audiofromwavtimestamps", audioMarkersFromWavTimestamps.isSelected());142 Main.pref.put ("marker.audiofromstart", audioMarkersFromStart.isSelected());135 Main.pref.putBoolean("audio.menuinvisible", !audioMenuVisible.isSelected()); 136 Main.pref.putBoolean("marker.traceaudio", markerAudioTraceVisible.isSelected()); 137 Main.pref.putBoolean("marker.buttonlabels", markerButtonLabels.isSelected()); 138 Main.pref.putBoolean("marker.audiofromexplicitwaypoints", audioMarkersFromExplicitWaypoints.isSelected()); 139 Main.pref.putBoolean("marker.audiofromuntimedwaypoints", audioMarkersFromUntimedWaypoints.isSelected()); 140 Main.pref.putBoolean("marker.audiofromnamedtrackpoints", audioMarkersFromNamedTrackpoints.isSelected()); 141 Main.pref.putBoolean("marker.audiofromwavtimestamps", audioMarkersFromWavTimestamps.isSelected()); 142 Main.pref.putBoolean("marker.audiofromstart", audioMarkersFromStart.isSelected()); 143 143 Main.pref.put("audio.forwardbackamount", audioForwardBackAmount.getText()); 144 144 Main.pref.put("audio.fastfwdmultiplier", audioFastForwardMultiplier.getText()); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r12400 r12841 109 109 // virtual nodes 110 110 virtualNodes.setToolTipText(tr("Draw virtual nodes in select mode for easy way modification.")); 111 virtualNodes.setSelected(Main.pref.getInt eger("mappaint.node.virtual-size", 8) != 0);111 virtualNodes.setSelected(Main.pref.getInt("mappaint.node.virtual-size", 8) != 0); 112 112 113 113 // background layers in inactive color … … 195 195 public boolean ok() { 196 196 boolean restart = gpxPanel.savePreferences(); 197 Main.pref.put ("draw.data.area_outline_only", outlineOnly.isSelected());198 Main.pref.put ("draw.segment.direction", directionHint.isSelected());199 Main.pref.put ("draw.segment.head_only", headArrow.isSelected());200 Main.pref.put ("draw.oneway", onewayArrow.isSelected());201 Main.pref.put ("draw.segment.order_number", segmentOrderNumber.isSelected());202 Main.pref.put ("draw.segment.order_number.on_selected", segmentOrderNumberOnSelectedWay.isSelected());203 Main.pref.put ("draw.data.downloaded_area", sourceBounds.isSelected());204 Main.pref.put ("draw.data.inactive_color", inactive.isSelected());205 Main.pref.put ("mappaint.use-antialiasing", useAntialiasing.isSelected());206 Main.pref.put ("mappaint.wireframe.use-antialiasing", useWireframeAntialiasing.isSelected());207 Main.pref.put ("draw.target-highlight", useHighlighting.isSelected());208 Main.pref.put ("draw.helper-line", drawHelperLine.isSelected());209 Main.pref.put ("display.discardable-keys", discardableKeys.isSelected());197 Main.pref.putBoolean("draw.data.area_outline_only", outlineOnly.isSelected()); 198 Main.pref.putBoolean("draw.segment.direction", directionHint.isSelected()); 199 Main.pref.putBoolean("draw.segment.head_only", headArrow.isSelected()); 200 Main.pref.putBoolean("draw.oneway", onewayArrow.isSelected()); 201 Main.pref.putBoolean("draw.segment.order_number", segmentOrderNumber.isSelected()); 202 Main.pref.putBoolean("draw.segment.order_number.on_selected", segmentOrderNumberOnSelectedWay.isSelected()); 203 Main.pref.putBoolean("draw.data.downloaded_area", sourceBounds.isSelected()); 204 Main.pref.putBoolean("draw.data.inactive_color", inactive.isSelected()); 205 Main.pref.putBoolean("mappaint.use-antialiasing", useAntialiasing.isSelected()); 206 Main.pref.putBoolean("mappaint.wireframe.use-antialiasing", useWireframeAntialiasing.isSelected()); 207 Main.pref.putBoolean("draw.target-highlight", useHighlighting.isSelected()); 208 Main.pref.putBoolean("draw.helper-line", drawHelperLine.isSelected()); 209 Main.pref.putBoolean("display.discardable-keys", discardableKeys.isSelected()); 210 210 AutoFilterManager.PROP_AUTO_FILTER_ENABLED.put(autoFilters.isSelected()); 211 211 AutoFilterManager.PROP_AUTO_FILTER_RULE.put(((AutoFilterRule) autoFilterRules.getSelectedItem()).getKey()); 212 int vn = Main.pref.getInt eger("mappaint.node.virtual-size", 8);212 int vn = Main.pref.getInt("mappaint.node.virtual-size", 8); 213 213 if (virtualNodes.isSelected()) { 214 214 if (vn < 1) { … … 218 218 vn = 0; 219 219 } 220 Main.pref.putInt eger("mappaint.node.virtual-size", vn);220 Main.pref.putInt("mappaint.node.virtual-size", vn); 221 221 return restart; 222 222 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r12620 r12841 454 454 layerNameDot = ""; 455 455 } 456 Main.pref.put ("marker.makeautomarkers"+layerNameDot, makeAutoMarkers.isSelected());456 Main.pref.putBoolean("marker.makeautomarkers"+layerNameDot, makeAutoMarkers.isSelected()); 457 457 if (drawRawGpsLinesGlobal.isSelected()) { 458 458 Main.pref.put("draw.rawgps.lines" + layerNameDot, null); … … 466 466 } else { 467 467 if (layerName == null || !locLayer) { 468 Main.pref.put ("draw.rawgps.lines" + layerNameDot, drawRawGpsLinesAll.isSelected());468 Main.pref.putBoolean("draw.rawgps.lines" + layerNameDot, drawRawGpsLinesAll.isSelected()); 469 469 Main.pref.put("draw.rawgps.max-line-length" + layerNameDot, drawRawGpsMaxLineLength.getText()); 470 470 } 471 471 if (layerName == null || locLayer) { 472 Main.pref.put ("draw.rawgps.lines.local" + layerNameDot, drawRawGpsLinesAll.isSelected() || drawRawGpsLinesLocal.isSelected());472 Main.pref.putBoolean("draw.rawgps.lines.local" + layerNameDot, drawRawGpsLinesAll.isSelected() || drawRawGpsLinesLocal.isSelected()); 473 473 Main.pref.put("draw.rawgps.max-line-length.local" + layerNameDot, drawRawGpsMaxLineLengthLocal.getText()); 474 474 } 475 Main.pref.put ("draw.rawgps.lines.force"+layerNameDot, forceRawGpsLines.isSelected());476 Main.pref.put ("draw.rawgps.direction"+layerNameDot, drawGpsArrows.isSelected());477 Main.pref.put ("draw.rawgps.alternatedirection"+layerNameDot, drawGpsArrowsFast.isSelected());475 Main.pref.putBoolean("draw.rawgps.lines.force"+layerNameDot, forceRawGpsLines.isSelected()); 476 Main.pref.putBoolean("draw.rawgps.direction"+layerNameDot, drawGpsArrows.isSelected()); 477 Main.pref.putBoolean("draw.rawgps.alternatedirection"+layerNameDot, drawGpsArrowsFast.isSelected()); 478 478 Main.pref.put("draw.rawgps.min-arrow-distance"+layerNameDot, drawGpsArrowsMinDist.getText()); 479 479 } 480 480 481 Main.pref.put ("draw.rawgps.hdopcircle"+layerNameDot, hdopCircleGpsPoints.isSelected());482 Main.pref.put ("draw.rawgps.large"+layerNameDot, largeGpsPoints.isSelected());481 Main.pref.putBoolean("draw.rawgps.hdopcircle"+layerNameDot, hdopCircleGpsPoints.isSelected()); 482 Main.pref.putBoolean("draw.rawgps.large"+layerNameDot, largeGpsPoints.isSelected()); 483 483 Main.pref.put("draw.rawgps.linewidth"+layerNameDot, drawLineWidth.getText()); 484 Main.pref.put ("draw.rawgps.lines.alpha-blend"+layerNameDot, drawLineWithAlpha.isSelected());485 486 Main.pref.put ("mappaint.gpx.use-antialiasing", useGpsAntialiasing.isSelected());484 Main.pref.putBoolean("draw.rawgps.lines.alpha-blend"+layerNameDot, drawLineWithAlpha.isSelected()); 485 486 Main.pref.putBoolean("mappaint.gpx.use-antialiasing", useGpsAntialiasing.isSelected()); 487 487 488 488 TemplateEntryProperty.forMarker(layerName).put(waypointLabelPattern.getText()); … … 495 495 return false; 496 496 } else if (colorTypeVelocity.isSelected()) { 497 Main.pref.putInt eger("draw.rawgps.colors"+layerNameDot, 1);497 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 1); 498 498 } else if (colorTypeDilution.isSelected()) { 499 Main.pref.putInt eger("draw.rawgps.colors"+layerNameDot, 2);499 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 2); 500 500 } else if (colorTypeDirection.isSelected()) { 501 Main.pref.putInt eger("draw.rawgps.colors"+layerNameDot, 3);501 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 3); 502 502 } else if (colorTypeTime.isSelected()) { 503 Main.pref.putInt eger("draw.rawgps.colors"+layerNameDot, 4);503 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 4); 504 504 } else if (colorTypeHeatMap.isSelected()) { 505 Main.pref.putInt eger("draw.rawgps.colors"+layerNameDot, 5);505 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 5); 506 506 } else { 507 Main.pref.putInt eger("draw.rawgps.colors"+layerNameDot, 0);508 } 509 Main.pref.put ("draw.rawgps.colors.dynamic"+layerNameDot, colorDynamic.isSelected());507 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 0); 508 } 509 Main.pref.putBoolean("draw.rawgps.colors.dynamic"+layerNameDot, colorDynamic.isSelected()); 510 510 int ccti = colorTypeVelocityTune.getSelectedIndex(); 511 Main.pref.putInt eger("draw.rawgps.colorTracksTune"+layerNameDot, ccti == 2 ? 10 : (ccti == 1 ? 20 : 45));512 Main.pref.putInt eger("draw.rawgps.heatmap.colormap"+layerNameDot, colorTypeHeatMapTune.getSelectedIndex());513 Main.pref.put ("draw.rawgps.heatmap.use-points"+layerNameDot, colorTypeHeatMapPoints.isSelected());514 Main.pref.putInt eger("draw.rawgps.heatmap.gain"+layerNameDot, colorTypeHeatMapGain.getValue());515 Main.pref.putInt eger("draw.rawgps.heatmap.lower-limit"+layerNameDot, colorTypeHeatMapLowerLimit.getValue());511 Main.pref.putInt("draw.rawgps.colorTracksTune"+layerNameDot, ccti == 2 ? 10 : (ccti == 1 ? 20 : 45)); 512 Main.pref.putInt("draw.rawgps.heatmap.colormap"+layerNameDot, colorTypeHeatMapTune.getSelectedIndex()); 513 Main.pref.putBoolean("draw.rawgps.heatmap.use-points"+layerNameDot, colorTypeHeatMapPoints.isSelected()); 514 Main.pref.putInt("draw.rawgps.heatmap.gain"+layerNameDot, colorTypeHeatMapGain.getValue()); 515 Main.pref.putInt("draw.rawgps.heatmap.lower-limit"+layerNameDot, colorTypeHeatMapLowerLimit.getValue()); 516 516 517 517 return false; -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r12620 r12841 202 202 public boolean ok() { 203 203 boolean mod = false; 204 Main.pref.put ("draw.splashscreen", showSplashScreen.isSelected());205 Main.pref.put ("osm-primitives.showid", showID.isSelected());206 Main.pref.put ("osm-primitives.localize-name", showLocalizedName.isSelected());204 Main.pref.putBoolean("draw.splashscreen", showSplashScreen.isSelected()); 205 Main.pref.putBoolean("osm-primitives.showid", showID.isSelected()); 206 Main.pref.putBoolean("osm-primitives.localize-name", showLocalizedName.isSelected()); 207 207 MapFrame.MODELESS.put(modeless.isSelected()); 208 Main.pref.put (ToggleDialog.PROP_DYNAMIC_BUTTONS.getKey(), dynamicButtons.isSelected());209 Main.pref.put (DateUtils.PROP_ISO_DATES.getKey(), isoDates.isSelected());210 Main.pref.put (FileChooserManager.PROP_USE_NATIVE_FILE_DIALOG.getKey(), nativeFileChoosers.isSelected());208 Main.pref.putBoolean(ToggleDialog.PROP_DYNAMIC_BUTTONS.getKey(), dynamicButtons.isSelected()); 209 Main.pref.putBoolean(DateUtils.PROP_ISO_DATES.getKey(), isoDates.isSelected()); 210 Main.pref.putBoolean(FileChooserManager.PROP_USE_NATIVE_FILE_DIALOG.getKey(), nativeFileChoosers.isSelected()); 211 211 MapMover.PROP_ZOOM_REVERSE_WHEEL.put(zoomReverseWheel.isSelected()); 212 212 NavigatableComponent.PROP_ZOOM_INTERMEDIATE_STEPS.put(zoomIntermediateSteps.isSelected()); -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r12649 r12841 105 105 @Override 106 106 public Collection<String> getInitialIconPathsList() { 107 return Main.pref.get Collection(ICONPREF, null);107 return Main.pref.getList(ICONPREF, null); 108 108 } 109 109 … … 170 170 @Override 171 171 public boolean ok() { 172 boolean reload = Main.pref.put ("mappaint.icon.enable-defaults", enableIconDefault.isSelected());172 boolean reload = Main.pref.putBoolean("mappaint.icon.enable-defaults", enableIconDefault.isSelected()); 173 173 reload |= sources.finish(); 174 174 if (reload) { -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r12649 r12841 206 206 @Override 207 207 public Collection<String> getInitialIconPathsList() { 208 return Main.pref.get Collection(ICONPREF, null);208 return Main.pref.getList(ICONPREF, null); 209 209 } 210 210 … … 246 246 @Override 247 247 public boolean ok() { 248 boolean restart = Main.pref.put ("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null);248 boolean restart = Main.pref.putBoolean("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null); 249 249 restart |= sources.finish(); 250 250 -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r12634 r12841 302 302 List<String> l = new LinkedList<>(model.getSelectedPluginNames()); 303 303 Collections.sort(l); 304 Main.pref.put Collection("plugins", l);304 Main.pref.putList("plugins", l); 305 305 if (!model.getNewlyDeactivatedPlugins().isEmpty()) 306 306 return true; … … 359 359 model.updateAvailablePlugins(task.getAvailablePlugins()); 360 360 pnlPluginPreferences.refreshView(); 361 Main.pref.putInt eger("pluginmanager.version", Version.getInstance().getVersion()); // fix #7030361 Main.pref.putInt("pluginmanager.version", Version.getInstance().getVersion()); // fix #7030 362 362 }); 363 363 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r12620 r12841 40 40 public PluginPreferencesModel() { 41 41 currentActivePlugins = new HashSet<>(); 42 currentActivePlugins.addAll(Main.pref.get Collection("plugins", currentActivePlugins));42 currentActivePlugins.addAll(Main.pref.getList("plugins")); 43 43 } 44 44 … … 80 80 filterDisplayedPlugins(filterExpression); 81 81 Set<String> activePlugins = new HashSet<>(); 82 activePlugins.addAll(Main.pref.get Collection("plugins", activePlugins));82 activePlugins.addAll(Main.pref.getList("plugins")); 83 83 for (PluginInformation pi: availablePlugins) { 84 84 if (selectedPluginsMap.get(pi) == null && activePlugins.contains(pi.name)) { … … 230 230 */ 231 231 public void initFromPreferences() { 232 Collection<String> enabledPlugins = Main.pref.get Collection("plugins", null);232 Collection<String> enabledPlugins = Main.pref.getList("plugins", null); 233 233 if (enabledPlugins == null) { 234 234 this.selectedPluginsMap.clear(); -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java
r12620 r12841 196 196 } 197 197 if (days == 0) { 198 days = Main.pref.getInt eger("pluginmanager.time-based-update.interval", PluginHandler.DEFAULT_TIME_BASED_UPDATE_INTERVAL);198 days = Main.pref.getInt("pluginmanager.time-based-update.interval", PluginHandler.DEFAULT_TIME_BASED_UPDATE_INTERVAL); 199 199 } 200 200 tfUpdateInterval.setText(Integer.toString(days)); … … 235 235 days = PluginHandler.DEFAULT_TIME_BASED_UPDATE_INTERVAL; 236 236 } 237 Main.pref.putInt eger("pluginmanager.time-based-update.interval", days);237 Main.pref.putInt("pluginmanager.time-based-update.interval", days); 238 238 } 239 239 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
r12620 r12841 72 72 } 73 73 }); 74 Collection<String> samples = Arrays.asList(74 List<String> samples = Arrays.asList( 75 75 "+proj=lonlat +ellps=WGS84 +datum=WGS84 +bounds=-180,-90,180,90", 76 76 "+proj=tmerc +lat_0=0 +lon_0=9 +k_0=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb"); 77 List<String> inputHistory = new LinkedList<>(Main.pref.get Collection("projection.custom.value.history", samples));77 List<String> inputHistory = new LinkedList<>(Main.pref.getList("projection.custom.value.history", samples)); 78 78 Collections.reverse(inputHistory); 79 79 cbInput.setPossibleItems(inputHistory); … … 149 149 public void rememberHistory() { 150 150 cbInput.addCurrentItemToHistory(); 151 Main.pref.put Collection("projection.custom.value.history", cbInput.getHistory());151 Main.pref.putList("projection.custom.value.history", cbInput.getHistory()); 152 152 } 153 153 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r12786 r12841 28 28 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 29 29 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 30 import org.openstreetmap.josm.data.preferences. CollectionProperty;30 import org.openstreetmap.josm.data.preferences.ListProperty; 31 31 import org.openstreetmap.josm.data.preferences.StringProperty; 32 32 import org.openstreetmap.josm.data.projection.CustomProjection; … … 291 291 private static final StringProperty PROP_PROJECTION_DEFAULT = new StringProperty("projection.default", mercator.getId()); 292 292 private static final StringProperty PROP_COORDINATES = new StringProperty("coordinates", null); 293 private static final CollectionProperty PROP_SUB_PROJECTION_DEFAULT = new CollectionProperty("projection.default.sub", null);293 private static final ListProperty PROP_SUB_PROJECTION_DEFAULT = new ListProperty("projection.default.sub", null); 294 294 private static final String[] unitsValues = ALL_SYSTEMS.keySet().toArray(new String[ALL_SYSTEMS.size()]); 295 295 private static final String[] unitsValuesTr = new String[unitsValues.length]; … … 482 482 } 483 483 id = pc.getId(); 484 Main.pref.put Collection("projection.sub."+id, pref);484 Main.pref.putList("projection.sub."+id, pref == null ? null : new ArrayList<>(pref)); 485 485 if (makeDefault) { 486 486 PROP_PROJECTION_DEFAULT.put(id); 487 PROP_SUB_PROJECTION_DEFAULT.put(pref );487 PROP_SUB_PROJECTION_DEFAULT.put(pref == null ? null : new ArrayList<>(pref)); 488 488 } else { 489 489 projectionChoice = id; … … 560 560 */ 561 561 public static Collection<String> getSubprojectionPreference(String pcId) { 562 return Main.pref.get Collection("projection.sub."+pcId, null);562 return Main.pref.getList("projection.sub."+pcId, null); 563 563 } 564 564 -
trunk/src/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreference.java
r12707 r12841 196 196 if (enabled) { 197 197 for (Entry<PermissionPrefWithDefault, JCheckBox> p : prefs.entrySet()) { 198 Main.pref.put (p.getKey().pref, p.getValue().isSelected());199 } 200 Main.pref.put (RequestHandler.loadInNewLayerKey, loadInNewLayer.isSelected());201 Main.pref.put (RequestHandler.globalConfirmationKey, alwaysAskUserConfirm.isSelected());198 Main.pref.putBoolean(p.getKey().pref, p.getValue().isSelected()); 199 } 200 Main.pref.putBoolean(RequestHandler.loadInNewLayerKey, loadInNewLayer.isSelected()); 201 Main.pref.putBoolean(RequestHandler.globalConfirmationKey, alwaysAskUserConfirm.isSelected()); 202 202 } 203 203 if (changed) { -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r12634 r12841 28 28 29 29 import org.openstreetmap.josm.Main; 30 import org.openstreetmap.josm.data.preferences. CollectionProperty;30 import org.openstreetmap.josm.data.preferences.ListProperty; 31 31 import org.openstreetmap.josm.gui.MainApplication; 32 32 import org.openstreetmap.josm.gui.help.HelpUtil; … … 58 58 /** indicates whether to use the default OSM URL or not */ 59 59 private JCheckBox cbUseDefaultServerUrl; 60 private final transient CollectionProperty SERVER_URL_HISTORY = new CollectionProperty("osm-server.url-history", Arrays.asList(60 private final transient ListProperty SERVER_URL_HISTORY = new ListProperty("osm-server.url-history", Arrays.asList( 61 61 "http://api06.dev.openstreetmap.org/api", "http://master.apis.dev.openstreetmap.org/api")); 62 62 -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreference.java
r12649 r12841 97 97 @Override 98 98 public boolean ok() { 99 Collection<String> tests = new LinkedList<>();100 Collection<String> testsBeforeUpload = new LinkedList<>();99 List<String> tests = new LinkedList<>(); 100 List<String> testsBeforeUpload = new LinkedList<>(); 101 101 102 102 for (Test test : allTests) { … … 116 116 OsmValidator.initializeTests(testsToInitialize); 117 117 118 Main.pref.put Collection(ValidatorPrefHelper.PREF_SKIP_TESTS, tests);119 Main.pref.put Collection(ValidatorPrefHelper.PREF_SKIP_TESTS_BEFORE_UPLOAD, testsBeforeUpload);118 Main.pref.putList(ValidatorPrefHelper.PREF_SKIP_TESTS, tests); 119 Main.pref.putList(ValidatorPrefHelper.PREF_SKIP_TESTS_BEFORE_UPLOAD, testsBeforeUpload); 120 120 ValidatorPrefHelper.PREF_USE_IGNORE.put(prefUseIgnore.isSelected()); 121 121 ValidatorPrefHelper.PREF_OTHER.put(prefOther.isSelected()); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r12691 r12841 210 210 } 211 211 File arch = TaggingPresetReader.getZipIcons(); 212 final Collection<String> s = Main.pref.get Collection("taggingpreset.icon.sources", null);212 final Collection<String> s = Main.pref.getList("taggingpreset.icon.sources", null); 213 213 ImageProvider imgProv = new ImageProvider(iconName); 214 214 imgProv.setDirs(s); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
r12835 r12841 127 127 128 128 protected static ImageIcon loadImageIcon(String iconName, File zipIcons, Integer maxSize) { 129 final Collection<String> s = Main.pref.get Collection("taggingpreset.icon.sources", null);129 final Collection<String> s = Main.pref.getList("taggingpreset.icon.sources", null); 130 130 ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true); 131 131 if (maxSize != null) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r12643 r12841 91 91 } 92 92 for (JMenu submenu : submenus.values()) { 93 if (submenu.getItemCount() >= Main.pref.getInt eger("taggingpreset.min-elements-for-scroller", 15)) {93 if (submenu.getItemCount() >= Main.pref.getInt("taggingpreset.min-elements-for-scroller", 15)) { 94 94 MenuScroller.setScrollerFor(submenu); 95 95 } -
trunk/src/org/openstreetmap/josm/gui/widgets/HistoryComboBox.java
r12304 r12841 24 24 */ 25 25 public HistoryComboBox() { 26 int maxsize = Main.pref.getInt eger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE);26 int maxsize = Main.pref.getInt("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE); 27 27 model = new ComboBoxHistory(maxsize); 28 28 setModel(model); -
trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
r12620 r12841 91 91 return false; 92 92 } 93 return Main.pref.getInt eger("cache." + ident, 0) + updateInterval < TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())93 return Main.pref.getInt("cache." + ident, 0) + updateInterval < TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()) 94 94 || !isCacheValid(); 95 95 } … … 141 141 this.data = updateData(); 142 142 saveToDisk(); 143 Main.pref.putInt eger("cache." + ident, (int) (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));143 Main.pref.putInt("cache." + ident, (int) (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); 144 144 return data; 145 145 } -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r12620 r12841 381 381 if (!"file".equals(url.getProtocol())) { 382 382 String prefKey = getPrefKey(url, destDir); 383 List<String> localPath = new ArrayList<>(Main.pref.get Collection(prefKey));383 List<String> localPath = new ArrayList<>(Main.pref.getList(prefKey)); 384 384 if (localPath.size() == 2) { 385 385 File lfile = new File(localPath.get(1)); … … 388 388 } 389 389 } 390 Main.pref.put Collection(prefKey, null);390 Main.pref.putList(prefKey, null); 391 391 } 392 392 } catch (MalformedURLException e) { … … 419 419 Long ifModifiedSince = null; 420 420 File localFile = null; 421 List<String> localPathEntry = new ArrayList<>(Main.pref.get Collection(prefKey));421 List<String> localPathEntry = new ArrayList<>(Main.pref.getList(prefKey)); 422 422 boolean offline = false; 423 423 try { … … 476 476 if (localFile == null) 477 477 throw new AssertionError(); 478 Main.pref.put Collection(prefKey,478 Main.pref.putList(prefKey, 479 479 Arrays.asList(Long.toString(System.currentTimeMillis()), localPathEntry.get(1))); 480 480 return localFile; … … 488 488 localFile = new File(destDir, localPath); 489 489 if (Main.platform.rename(destDirFile, localFile)) { 490 Main.pref.put Collection(prefKey,490 Main.pref.putList(prefKey, 491 491 Arrays.asList(Long.toString(System.currentTimeMillis()), localFile.toString())); 492 492 } else { -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r12805 r12841 161 161 } 162 162 proxyExceptions = new HashSet<>( 163 Main.pref.get Collection(PROXY_EXCEPTIONS,163 Main.pref.getList(PROXY_EXCEPTIONS, 164 164 Arrays.asList("localhost", IPV4_LOOPBACK, IPV6_LOOPBACK)) 165 165 ); -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r12816 r12841 321 321 // Build a list of fetchers that will download smaller sets containing only MAX_IDS_PER_REQUEST (200) primitives each. 322 322 // we will run up to MAX_DOWNLOAD_THREADS concurrent fetchers. 323 int threadsNumber = Main.pref.getInt eger("osm.download.threads", OsmApi.MAX_DOWNLOAD_THREADS);323 int threadsNumber = Main.pref.getInt("osm.download.threads", OsmApi.MAX_DOWNLOAD_THREADS); 324 324 threadsNumber = Utils.clamp(threadsNumber, 1, OsmApi.MAX_DOWNLOAD_THREADS); 325 325 final ExecutorService exec = Executors.newFixedThreadPool( -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r12805 r12841 593 593 */ 594 594 protected int getMaxRetries() { 595 int ret = Main.pref.getInt eger("osm-server.max-num-retries", DEFAULT_MAX_NUM_RETRIES);595 int ret = Main.pref.getInt("osm-server.max-num-retries", DEFAULT_MAX_NUM_RETRIES); 596 596 return Math.max(ret, 0); 597 597 } -
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r12816 r12841 33 33 import org.openstreetmap.josm.data.osm.PrimitiveId; 34 34 import org.openstreetmap.josm.data.preferences.BooleanProperty; 35 import org.openstreetmap.josm.data.preferences. CollectionProperty;35 import org.openstreetmap.josm.data.preferences.ListProperty; 36 36 import org.openstreetmap.josm.data.preferences.StringProperty; 37 37 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 59 59 * @since 12816 60 60 */ 61 public static final CollectionProperty OVERPASS_SERVER_HISTORY = new CollectionProperty("download.overpass.servers",61 public static final ListProperty OVERPASS_SERVER_HISTORY = new ListProperty("download.overpass.servers", 62 62 Arrays.asList("https://overpass-api.de/api/", "http://overpass.osm.rambler.ru/cgi/")); 63 63 /** -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpServer.java
r12620 r12841 33 33 public static void restartRemoteControlHttpServer() { 34 34 stopRemoteControlHttpServer(); 35 int port = Main.pref.getInt eger("remote.control.port", 8111);35 int port = Main.pref.getInt("remote.control.port", 8111); 36 36 try { 37 37 instance4 = new RemoteControlHttpServer(port, false); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java
r12620 r12841 312 312 stopRemoteControlHttpsServer(); 313 313 if (RemoteControl.PROP_REMOTECONTROL_HTTPS_ENABLED.get()) { 314 int port = Main.pref.getInt eger("remote.control.https.port", HTTPS_PORT);314 int port = Main.pref.getInt("remote.control.https.port", HTTPS_PORT); 315 315 try { 316 316 instance4 = new RemoteControlHttpsServer(port, false); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r12639 r12841 422 422 String togglePreferenceKey = null; 423 423 int v = Version.getInstance().getVersion(); 424 if (Main.pref.getInt eger("pluginmanager.version", 0) < v) {424 if (Main.pref.getInt("pluginmanager.version", 0) < v) { 425 425 message = 426 426 "<html>" … … 434 434 long tim = System.currentTimeMillis(); 435 435 long last = Main.pref.getLong("pluginmanager.lastupdate", 0); 436 Integer maxTime = Main.pref.getInt eger("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL);436 Integer maxTime = Main.pref.getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL); 437 437 long d = TimeUnit.MILLISECONDS.toDays(tim - last); 438 438 if ((last <= 0) || (maxTime <= 0)) { … … 607 607 if (!task.getDownloadedPlugins().isEmpty()) { 608 608 // update plugin list in preferences 609 Set<String> plugins = new HashSet<>(Main.pref.get Collection("plugins"));609 Set<String> plugins = new HashSet<>(Main.pref.getList("plugins")); 610 610 for (PluginInformation plugin : task.getDownloadedPlugins()) { 611 611 plugins.add(plugin.name); 612 612 } 613 Main.pref.put Collection("plugins", plugins);613 Main.pref.putList("plugins", new ArrayList<>(plugins)); 614 614 // restart 615 615 try { … … 969 969 try { 970 970 monitor.beginTask(tr("Determining plugins to load...")); 971 Set<String> plugins = new HashSet<>(Main.pref.get Collection("plugins", new LinkedList<String>()));971 Set<String> plugins = new HashSet<>(Main.pref.getList("plugins", new LinkedList<String>())); 972 972 Logging.debug("Plugins list initialized to {0}", plugins); 973 973 String systemProp = System.getProperty("josm.plugins"); … … 1157 1157 if (pluginsWanted == null) { 1158 1158 // if all plugins updated, remember the update because it was successful 1159 Main.pref.putInt eger("pluginmanager.version", Version.getInstance().getVersion());1159 Main.pref.putInt("pluginmanager.version", Version.getInstance().getVersion()); 1160 1160 Main.pref.put("pluginmanager.lastupdate", Long.toString(System.currentTimeMillis())); 1161 1161 } … … 1450 1450 return null; 1451 1451 1452 Set<String> plugins = new HashSet<>( 1453 Main.pref.getCollection("plugins", Collections.<String>emptySet()) 1454 ); 1452 Set<String> plugins = new HashSet<>(Main.pref.getList("plugins")); 1455 1453 final PluginInformation pluginInfo = plugin.getPluginInformation(); 1456 1454 if (!plugins.contains(pluginInfo.name)) … … 1467 1465 // deactivate the plugin 1468 1466 plugins.remove(plugin.getPluginInformation().name); 1469 Main.pref.put Collection("plugins", plugins);1467 Main.pref.putList("plugins", new ArrayList<>(plugins)); 1470 1468 GuiHelper.runInEDTAndWait(() -> JOptionPane.showMessageDialog( 1471 1469 Main.parent, … … 1486 1484 */ 1487 1485 public static Collection<String> getBugReportInformation() { 1488 final Collection<String> pl = new TreeSet<>(Main.pref.get Collection("plugins", new LinkedList<>()));1486 final Collection<String> pl = new TreeSet<>(Main.pref.getList("plugins", new LinkedList<>())); 1489 1487 for (final PluginProxy pp : pluginList) { 1490 1488 PluginInformation pi = pp.getPluginInformation(); -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r12794 r12841 143 143 protected String downloadPluginList(String site, final ProgressMonitor monitor) { 144 144 /* replace %<x> with empty string or x=plugins (separated with comma) */ 145 String pl = Utils.join(",", Main.pref.get Collection("plugins"));145 String pl = Utils.join(",", Main.pref.getList("plugins")); 146 146 String printsite = site.replaceAll("%<(.*)>", ""); 147 147 if (pl != null && !pl.isEmpty()) { -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r12711 r12841 45 45 private URL url; 46 46 private final String requestMethod; 47 private int connectTimeout = (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt eger("socket.timeout.connect", 15));48 private int readTimeout = (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt eger("socket.timeout.read", 30));47 private int connectTimeout = (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt("socket.timeout.connect", 15)); 48 private int readTimeout = (int) TimeUnit.SECONDS.toMillis(Main.pref.getInt("socket.timeout.read", 30)); 49 49 private byte[] requestBody; 50 50 private long ifModifiedSince; 51 51 private final Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); 52 private int maxRedirects = Main.pref.getInt eger("socket.maxredirects", 5);52 private int maxRedirects = Main.pref.getInt("socket.maxredirects", 5); 53 53 private boolean useCache; 54 54 private String reasonForRequest; -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r12808 r12841 122 122 public enum ImageSizes { 123 123 /** SMALL_ICON value of an Action */ 124 SMALLICON(Main.pref.getInt eger("iconsize.smallicon", 16)),124 SMALLICON(Main.pref.getInt("iconsize.smallicon", 16)), 125 125 /** LARGE_ICON_KEY value of an Action */ 126 LARGEICON(Main.pref.getInt eger("iconsize.largeicon", 24)),126 LARGEICON(Main.pref.getInt("iconsize.largeicon", 24)), 127 127 /** map icon */ 128 MAP(Main.pref.getInt eger("iconsize.map", 16)),128 MAP(Main.pref.getInt("iconsize.map", 16)), 129 129 /** map icon maximum size */ 130 MAPMAX(Main.pref.getInt eger("iconsize.mapmax", 48)),130 MAPMAX(Main.pref.getInt("iconsize.mapmax", 48)), 131 131 /** cursor icon size */ 132 CURSOR(Main.pref.getInt eger("iconsize.cursor", 32)),132 CURSOR(Main.pref.getInt("iconsize.cursor", 32)), 133 133 /** cursor overlay icon size */ 134 134 CURSOROVERLAY(CURSOR), … … 142 142 * @since 8323 143 143 */ 144 LAYER(Main.pref.getInt eger("iconsize.layer", 16)),144 LAYER(Main.pref.getInt("iconsize.layer", 16)), 145 145 /** Toolbar button icon size 146 146 * @since 9253 … … 150 150 * @since 9253 151 151 */ 152 SIDEBUTTON(Main.pref.getInt eger("iconsize.sidebutton", 20)),152 SIDEBUTTON(Main.pref.getInt("iconsize.sidebutton", 20)), 153 153 /** Settings tab icon size 154 154 * @since 9253 155 155 */ 156 SETTINGS_TAB(Main.pref.getInt eger("iconsize.settingstab", 48)),156 SETTINGS_TAB(Main.pref.getInt("iconsize.settingstab", 48)), 157 157 /** 158 158 * The default image size 159 159 * @since 9705 160 160 */ 161 DEFAULT(Main.pref.getInt eger("iconsize.default", 24)),161 DEFAULT(Main.pref.getInt("iconsize.default", 24)), 162 162 /** 163 163 * Splash dialog logo size … … 1013 1013 */ 1014 1014 private static ImageResource getIfAvailableWiki(String name, ImageType type) { 1015 final Collection<String> defaultBaseUrls = Arrays.asList(1015 final List<String> defaultBaseUrls = Arrays.asList( 1016 1016 "https://wiki.openstreetmap.org/w/images/", 1017 1017 "https://upload.wikimedia.org/wikipedia/commons/", 1018 1018 "https://wiki.openstreetmap.org/wiki/File:" 1019 1019 ); 1020 final Collection<String> baseUrls = Main.pref.get Collection("image-provider.wiki.urls", defaultBaseUrls);1020 final Collection<String> baseUrls = Main.pref.getList("image-provider.wiki.urls", defaultBaseUrls); 1021 1021 1022 1022 final String fn = name.substring(name.lastIndexOf('/') + 1); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r12830 r12841 51 51 @Override 52 52 public void openUrl(String url) throws IOException { 53 for (String program : Main.pref.get Collection("browser.unix",53 for (String program : Main.pref.getList("browser.unix", 54 54 Arrays.asList("xdg-open", "#DESKTOP#", "$BROWSER", "gnome-open", "kfmclient openURL", "firefox"))) { 55 55 try { -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r12748 r12841 170 170 // create a shortcut object from an string as saved in the preferences 171 171 private Shortcut(String prefString) { 172 List<String> s = new ArrayList<>(Main.pref.get Collection(prefString));172 List<String> s = new ArrayList<>(Main.pref.getList(prefString)); 173 173 this.shortText = prefString.substring(15); 174 174 this.longText = s.get(0); … … 182 182 183 183 private void saveDefault() { 184 Main.pref.get Collection("shortcut.entry."+shortText, Arrays.asList(longText,184 Main.pref.getList("shortcut.entry."+shortText, Arrays.asList(longText, 185 185 String.valueOf(requestedKey), String.valueOf(requestedGroup), String.valueOf(requestedKey), 186 186 String.valueOf(getGroupModifier(requestedGroup)), String.valueOf(true), String.valueOf(false))); … … 190 190 private boolean save() { 191 191 if (isAutomatic() || isReset() || !isAssignedUser()) { 192 return Main.pref.put Collection("shortcut.entry."+shortText, null);192 return Main.pref.putList("shortcut.entry."+shortText, null); 193 193 } else { 194 return Main.pref.put Collection("shortcut.entry."+shortText, Arrays.asList(longText,194 return Main.pref.putList("shortcut.entry."+shortText, Arrays.asList(longText, 195 195 String.valueOf(requestedKey), String.valueOf(requestedGroup), String.valueOf(assignedKey), 196 196 String.valueOf(assignedModifier), String.valueOf(assignedDefault), String.valueOf(assignedUser))); -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r12683 r12841 20 20 21 21 // properties need JOSM restart to apply, modified rarely enough 22 private static final int MAX_KEY_LENGTH = Main.pref.getInt eger("tags.paste.max-key-length", 50);23 private static final int MAX_KEY_COUNT = Main.pref.getInt eger("tags.paste.max-key-count", 30);22 private static final int MAX_KEY_LENGTH = Main.pref.getInt("tags.paste.max-key-length", 50); 23 private static final int MAX_KEY_COUNT = Main.pref.getInt("tags.paste.max-key-count", 30); 24 24 private static final String KEY_PATTERN = Main.pref.get("tags.paste.tag-pattern", "[0-9a-zA-Z:_]*"); 25 25 private static final int MAX_VALUE_LENGTH = 255; -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r12830 r12841 1246 1246 */ 1247 1247 public static ForkJoinPool newForkJoinPool(String pref, final String nameFormat, final int threadPriority) { 1248 int noThreads = Main.pref.getInt eger(pref, Runtime.getRuntime().availableProcessors());1248 int noThreads = Main.pref.getInt(pref, Runtime.getRuntime().availableProcessors()); 1249 1249 return new ForkJoinPool(noThreads, new ForkJoinPool.ForkJoinWorkerThreadFactory() { 1250 1250 final AtomicLong count = new AtomicLong(0);
Note:
See TracChangeset
for help on using the changeset viewer.