- Timestamp:
- 2017-09-13T23:24:50+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 222 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r12777 r12846 49 49 import org.openstreetmap.josm.io.OnlineResource; 50 50 import org.openstreetmap.josm.io.OsmApi; 51 import org.openstreetmap.josm.spi.preferences.Config; 51 52 import org.openstreetmap.josm.tools.CheckParameterUtil; 52 53 import org.openstreetmap.josm.tools.ImageProvider; … … 724 725 public static void preConstructorInit() { 725 726 // init default coordinate format 726 ICoordinateFormat fmt = CoordinateFormatManager.getCoordinateFormat( Main.pref.get("coordinates"));727 ICoordinateFormat fmt = CoordinateFormatManager.getCoordinateFormat(Config.getPref().get("coordinates")); 727 728 if (fmt == null) { 728 729 fmt = DecimalDegreesCoordinateFormat.INSTANCE; … … 1007 1008 */ 1008 1009 public static String getJOSMWebsite() { 1009 if ( Main.pref!= null)1010 return Main.pref.get("josm.url", JOSM_WEBSITE);1010 if (Config.getPref() != null) 1011 return Config.getPref().get("josm.url", JOSM_WEBSITE); 1011 1012 return JOSM_WEBSITE; 1012 1013 } … … 1028 1029 */ 1029 1030 public static String getOSMWebsite() { 1030 if ( Main.pref!= null)1031 return Main.pref.get("osm.url", OSM_WEBSITE);1031 if (Config.getPref() != null) 1032 return Config.getPref().get("osm.url", OSM_WEBSITE); 1032 1033 return OSM_WEBSITE; 1033 1034 } … … 1052 1053 */ 1053 1054 public static String getBaseBrowseUrl() { 1054 if ( Main.pref!= null)1055 return Main.pref.get("osm-browse.url", getOSMWebsiteDependingOnSelectedApi());1055 if (Config.getPref() != null) 1056 return Config.getPref().get("osm-browse.url", getOSMWebsiteDependingOnSelectedApi()); 1056 1057 return getOSMWebsiteDependingOnSelectedApi(); 1057 1058 } … … 1063 1064 */ 1064 1065 public static String getBaseUserUrl() { 1065 if ( Main.pref!= null)1066 return Main.pref.get("osm-user.url", getOSMWebsiteDependingOnSelectedApi() + "/user");1066 if (Config.getPref() != null) 1067 return Config.getPref().get("osm-user.url", getOSMWebsiteDependingOnSelectedApi() + "/user"); 1067 1068 return getOSMWebsiteDependingOnSelectedApi() + "/user"; 1068 1069 } -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r12639 r12846 37 37 import org.openstreetmap.josm.gui.dialogs.ValidatorDialog.ValidatorBoundingXYVisitor; 38 38 import org.openstreetmap.josm.gui.layer.Layer; 39 import org.openstreetmap.josm.spi.preferences.Config; 39 40 import org.openstreetmap.josm.tools.Logging; 40 41 import org.openstreetmap.josm.tools.Shortcut; … … 262 263 if (v.getBounds() == null) 263 264 return null; 264 v.enlargeBoundingBox( Main.pref.getDouble("validator.zoom-enlarge-bbox", 0.0002));265 v.enlargeBoundingBox(Config.getPref().getDouble("validator.zoom-enlarge-bbox", 0.0002)); 265 266 return v; 266 267 } … … 314 315 // Make the bounding box at least 100 meter wide to 315 316 // ensure reasonable zoom level when zooming onto single nodes. 316 v.enlargeToMinSize( Main.pref.getDouble("zoom_to_selection_min_size_in_meter", 100));317 v.enlargeToMinSize(Config.getPref().getDouble("zoom_to_selection_min_size_in_meter", 100)); 317 318 return v; 318 319 } -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r12841 r12846 21 21 import javax.swing.SwingUtilities; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction; 25 24 import org.openstreetmap.josm.command.AddCommand; … … 43 42 import org.openstreetmap.josm.gui.dialogs.relation.sort.RelationSorter; 44 43 import org.openstreetmap.josm.gui.util.GuiHelper; 44 import org.openstreetmap.josm.spi.preferences.Config; 45 45 import org.openstreetmap.josm.tools.Pair; 46 46 import org.openstreetmap.josm.tools.Shortcut; … … 115 115 SwingUtilities.invokeLater(() -> { 116 116 MainApplication.getMap().relationListDialog.selectRelation(relation); 117 if ( Main.pref.getBoolean("multipoly.show-relation-editor", false)) {117 if (Config.getPref().getBoolean("multipoly.show-relation-editor", false)) { 118 118 //Open relation edit window, if set up in preferences 119 119 RelationEditor editor = RelationEditor.getEditor( … … 382 382 383 383 // filter out empty key conflicts - we need second iteration 384 if (! Main.pref.getBoolean("multipoly.alltags", false)) {384 if (!Config.getPref().getBoolean("multipoly.alltags", false)) { 385 385 for (RelationMember m : relation.getMembers()) { 386 386 if (m.hasRole() && "outer".equals(m.getRole()) && m.isWay()) { … … 398 398 } 399 399 400 for (String linearTag : Main.pref.getList("multipoly.lineartagstokeep", DEFAULT_LINEAR_TAGS)) {400 for (String linearTag : Config.getPref().getList("multipoly.lineartagstokeep", DEFAULT_LINEAR_TAGS)) { 401 401 values.remove(linearTag); 402 402 } … … 408 408 409 409 List<Command> commands = new ArrayList<>(); 410 boolean moveTags = Main.pref.getBoolean("multipoly.movetags", true);410 boolean moveTags = Config.getPref().getBoolean("multipoly.movetags", true); 411 411 412 412 for (Entry<String, String> entry : values.entrySet()) { -
trunk/src/org/openstreetmap/josm/actions/DialogsToggleAction.java
r12841 r12846 8 8 import java.awt.event.KeyEvent; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.gui.MainApplication; 12 11 import org.openstreetmap.josm.gui.MapFrame; 12 import org.openstreetmap.josm.spi.preferences.Config; 13 13 import org.openstreetmap.josm.tools.ImageProvider; 14 14 import org.openstreetmap.josm.tools.Shortcut; … … 36 36 ); 37 37 putValue("help", ht("/ToggleDialogs")); 38 setSelected( Main.pref.getBoolean("draw.dialogspanel", true));38 setSelected(Config.getPref().getBoolean("draw.dialogspanel", true)); 39 39 notifySelectedState(); 40 40 } … … 43 43 public void actionPerformed(ActionEvent e) { 44 44 toggleSelectedState(e); 45 Main.pref.putBoolean("draw.dialogspanel", isSelected());45 Config.getPref().putBoolean("draw.dialogspanel", isSelected()); 46 46 notifySelectedState(); 47 47 setMode(); … … 52 52 boolean selected = isSelected(); 53 53 if (!selected) { 54 toolbarPreviouslyVisible = Main.pref.getBoolean("toolbar.visible", true);55 sideToolbarPreviouslyVisible = Main.pref.getBoolean("sidetoolbar.visible", true);54 toolbarPreviouslyVisible = Config.getPref().getBoolean("toolbar.visible", true); 55 sideToolbarPreviouslyVisible = Config.getPref().getBoolean("sidetoolbar.visible", true); 56 56 } 57 57 MapFrame map = MainApplication.getMap(); 58 58 map.setDialogsPanelVisible(selected); 59 map.statusLine.setVisible(selected || Main.pref.getBoolean("statusbar.always-visible", true));60 MainApplication.getMenu().setVisible(selected || Main.pref.getBoolean("menu.always-visible", true));59 map.statusLine.setVisible(selected || Config.getPref().getBoolean("statusbar.always-visible", true)); 60 MainApplication.getMenu().setVisible(selected || Config.getPref().getBoolean("menu.always-visible", true)); 61 61 // Toolbars listen to preference changes, use it here 62 if (! Main.pref.getBoolean("toolbar.always-visible", true) && (!selected || toolbarPreviouslyVisible)) {63 Main.pref.putBoolean("toolbar.visible", selected);62 if (!Config.getPref().getBoolean("toolbar.always-visible", true) && (!selected || toolbarPreviouslyVisible)) { 63 Config.getPref().putBoolean("toolbar.visible", selected); 64 64 } 65 if (! Main.pref.getBoolean("sidetoolbar.always-visible", true) && (!selected || sideToolbarPreviouslyVisible)) {66 Main.pref.putBoolean("sidetoolbar.visible", selected);65 if (!Config.getPref().getBoolean("sidetoolbar.always-visible", true) && (!selected || sideToolbarPreviouslyVisible)) { 66 Config.getPref().putBoolean("sidetoolbar.visible", selected); 67 67 } 68 68 map.mapView.rememberLastPositionOnScreen(); -
trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java
r12841 r12846 22 22 import org.openstreetmap.josm.gui.MainApplication; 23 23 import org.openstreetmap.josm.gui.util.GuiHelper; 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 import org.openstreetmap.josm.tools.Shortcut; 25 26 … … 46 47 MainApplication.getToolbar().register(this); 47 48 gd = GraphicsEnvironment.isHeadless() ? null : GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); 48 setSelected( Main.pref.getBoolean("draw.fullscreen", false));49 setSelected(Config.getPref().getBoolean("draw.fullscreen", false)); 49 50 notifySelectedState(); 50 51 } … … 53 54 public void actionPerformed(ActionEvent e) { 54 55 toggleSelectedState(e); 55 Main.pref.putBoolean("draw.fullscreen", isSelected());56 Config.getPref().putBoolean("draw.fullscreen", isSelected()); 56 57 notifySelectedState(); 57 58 setMode(); … … 96 97 // since windows (or java?) draws the undecorated window full- 97 98 // screen by default (it's a simulated mode, but should be ok) 98 String exclusive = Main.pref.get("draw.fullscreen.exclusive-mode", "auto");99 String exclusive = Config.getPref().get("draw.fullscreen.exclusive-mode", "auto"); 99 100 if (("true".equals(exclusive) || ("auto".equals(exclusive) && !Main.isPlatformWindows())) && gd != null) { 100 101 gd.setFullScreenWindow(selected ? frame : null); -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r12841 r12846 40 40 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; 41 41 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 42 import org.openstreetmap.josm.spi.preferences.Config; 42 43 import org.openstreetmap.josm.tools.CheckParameterUtil; 43 44 import org.openstreetmap.josm.tools.ImageProvider; … … 114 115 return candidates.get(0); 115 116 116 switch ( Main.pref.getInt("merge-nodes.mode", 0)) {117 switch (Config.getPref().getInt("merge-nodes.mode", 0)) { 117 118 case 0: 118 119 return candidates.get(size - 1); -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r12841 r12846 40 40 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 41 41 import org.openstreetmap.josm.io.OsmTransferException; 42 import org.openstreetmap.josm.spi.preferences.Config; 42 43 import org.openstreetmap.josm.tools.Logging; 43 44 import org.openstreetmap.josm.tools.MultiMap; … … 330 331 331 332 if (recordHistory) { 332 Collection<String> oldFileHistory = Main.pref.getList("file-open.history");333 Collection<String> oldFileHistory = Config.getPref().getList("file-open.history"); 333 334 fileHistory.addAll(oldFileHistory); 334 335 // remove the files which failed to load from the list 335 336 fileHistory.removeAll(failedAll); 336 int maxsize = Math.max(0, Main.pref.getInt("file-open.history.max-size", 15));337 int maxsize = Math.max(0, Config.getPref().getInt("file-open.history.max-size", 15)); 337 338 Main.pref.putCollectionBounded("file-open.history", maxsize, fileHistory); 338 339 } -
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r12841 r12846 44 44 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; 45 45 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 46 import org.openstreetmap.josm.spi.preferences.Config; 46 47 import org.openstreetmap.josm.tools.GBC; 47 48 import org.openstreetmap.josm.tools.Logging; … … 104 105 */ 105 106 protected void restoreUploadAddressHistory(HistoryComboBox cbHistory) { 106 List<String> cmtHistory = new LinkedList<>( Main.pref.getList(getClass().getName() + ".uploadAddressHistory",107 List<String> cmtHistory = new LinkedList<>(Config.getPref().getList(getClass().getName() + ".uploadAddressHistory", 107 108 new LinkedList<String>())); 108 109 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() … … 118 119 protected void remindUploadAddressHistory(HistoryComboBox cbHistory) { 119 120 cbHistory.addCurrentItemToHistory(); 120 Main.pref.putList(getClass().getName() + ".uploadAddressHistory", cbHistory.getHistory());121 Config.getPref().putList(getClass().getName() + ".uploadAddressHistory", cbHistory.getHistory()); 121 122 } 122 123 -
trunk/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java
r12581 r12846 3 3 4 4 import java.awt.event.ActionEvent; 5 5 6 import javax.swing.JCheckBoxMenuItem; 7 6 8 import org.openstreetmap.josm.Main; 7 9 import org.openstreetmap.josm.data.Preferences; -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r12841 r12846 36 36 import org.openstreetmap.josm.gui.help.HelpUtil; 37 37 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 38 import org.openstreetmap.josm.spi.preferences.Config; 38 39 import org.openstreetmap.josm.tools.GBC; 39 40 import org.openstreetmap.josm.tools.ImageProvider; … … 99 100 100 101 clearUndoRedo = cbClearUndoRedo.isSelected(); 101 Main.pref.putBoolean("purge.clear_undo_redo", clearUndoRedo);102 Config.getPref().putBoolean("purge.clear_undo_redo", clearUndoRedo); 102 103 } 103 104 … … 180 181 181 182 cbClearUndoRedo = new JCheckBox(tr("Clear Undo/Redo buffer")); 182 cbClearUndoRedo.setSelected( Main.pref.getBoolean("purge.clear_undo_redo", false));183 cbClearUndoRedo.setSelected(Config.getPref().getBoolean("purge.clear_undo_redo", false)); 183 184 184 185 pnl.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(0, 5, 0, 5)); -
trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
r12841 r12846 18 18 import org.openstreetmap.josm.gui.layer.Layer; 19 19 import org.openstreetmap.josm.gui.widgets.JosmTextField; 20 import org.openstreetmap.josm.spi.preferences.Config; 20 21 import org.openstreetmap.josm.tools.ImageProvider; 21 22 … … 66 67 filerename.setEnabled(file != null); 67 68 if (filerename.isEnabled()) { 68 filerename.setSelected( Main.pref.getBoolean("layer.rename-file", true));69 filerename.setSelected(Config.getPref().getBoolean("layer.rename-file", true)); 69 70 } 70 71 … … 81 82 String nameText = name.getText(); 82 83 if (filerename.isEnabled()) { 83 Main.pref.putBoolean("layer.rename-file", filerename.isSelected());84 Config.getPref().putBoolean("layer.rename-file", filerename.isSelected()); 84 85 if (filerename.isSelected()) { 85 86 String newname = nameText; -
trunk/src/org/openstreetmap/josm/actions/RestartAction.java
r12637 r12846 19 19 import org.openstreetmap.josm.gui.MainApplication; 20 20 import org.openstreetmap.josm.gui.io.SaveLayersDialog; 21 import org.openstreetmap.josm.spi.preferences.Config; 21 22 import org.openstreetmap.josm.tools.ImageProvider; 22 23 import org.openstreetmap.josm.tools.Logging; … … 95 96 } 96 97 Logging.info("Restart "+cmd); 97 if (Logging.isDebugEnabled() && Main.pref.getBoolean("restart.debug.simulation")) {98 if (Logging.isDebugEnabled() && Config.getPref().getBoolean("restart.debug.simulation")) { 98 99 Logging.debug("Restart cancelled to get debug info"); 99 100 return; -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r12726 r12846 16 16 import javax.swing.JOptionPane; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.command.ChangeCommand; 20 19 import org.openstreetmap.josm.command.Command; … … 28 27 import org.openstreetmap.josm.gui.MainApplication; 29 28 import org.openstreetmap.josm.gui.Notification; 29 import org.openstreetmap.josm.spi.preferences.Config; 30 30 import org.openstreetmap.josm.tools.Logging; 31 31 import org.openstreetmap.josm.tools.Shortcut; … … 154 154 155 155 Collection<Command> corrCmds = Collections.<Command>emptyList(); 156 if ( Main.pref.getBoolean("tag-correction.reverse-way", true)) {156 if (Config.getPref().getBoolean("tag-correction.reverse-way", true)) { 157 157 corrCmds = (new ReverseWayTagCorrector()).execute(w, wnew); 158 158 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r12841 r12846 21 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 22 22 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 23 import org.openstreetmap.josm.spi.preferences.Config; 23 24 import org.openstreetmap.josm.tools.Logging; 24 25 import org.openstreetmap.josm.tools.Shortcut; … … 229 230 } 230 231 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");232 int maxsize = Math.max(0, Config.getPref().getInt("file-open.history.max-size", 15)); 233 Collection<String> oldHistory = Config.getPref().getList("file-open.history"); 233 234 List<String> history = new LinkedList<>(oldHistory); 234 235 history.remove(filepath); -
trunk/src/org/openstreetmap/josm/actions/SaveAsAction.java
r6380 r12846 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;6 6 7 7 import java.awt.event.KeyEvent; -
trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
r12841 r12846 22 22 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 23 23 import org.openstreetmap.josm.io.OsmApi; 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 import org.openstreetmap.josm.tools.Logging; 25 26 import org.openstreetmap.josm.tools.Utils; … … 41 42 public void actionPerformed(ActionEvent e) { 42 43 HistoryComboBox searchTermBox = new HistoryComboBox(); 43 List<String> searchHistory = new LinkedList<>( Main.pref.getList(HISTORY_KEY, new LinkedList<String>()));44 List<String> searchHistory = new LinkedList<>(Config.getPref().getList(HISTORY_KEY, new LinkedList<String>())); 44 45 Collections.reverse(searchHistory); 45 46 searchTermBox.setPossibleItems(searchHistory); … … 70 71 71 72 searchTermBox.addCurrentItemToHistory(); 72 Main.pref.putList(HISTORY_KEY, searchTermBox.getHistory());73 Config.getPref().putList(HISTORY_KEY, searchTermBox.getHistory()); 73 74 74 75 performSearch(searchTerm); … … 91 92 } 92 93 93 int noteLimit = Main.pref.getInt("osm.notes.downloadLimit", 1000);94 int closedLimit = Main.pref.getInt("osm.notes.daysClosed", 7);94 int noteLimit = Config.getPref().getInt("osm.notes.downloadLimit", 1000); 95 int closedLimit = Config.getPref().getInt("osm.notes.daysClosed", 7); 95 96 96 97 StringBuilder sb = new StringBuilder(128); -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r12649 r12846 30 30 import org.openstreetmap.josm.data.preferences.sources.MapPaintPrefHelper; 31 31 import org.openstreetmap.josm.data.preferences.sources.PresetPrefHelper; 32 import org.openstreetmap.josm.data.preferences.sources.SourcePrefHelper; 32 33 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 33 import org.openstreetmap.josm.data.preferences.sources.SourcePrefHelper;34 34 import org.openstreetmap.josm.gui.ExtendedDialog; 35 35 import org.openstreetmap.josm.gui.MainApplication; -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r12749 r12846 34 34 import org.openstreetmap.josm.gui.MainApplication; 35 35 import org.openstreetmap.josm.gui.Notification; 36 import org.openstreetmap.josm.spi.preferences.Config; 36 37 import org.openstreetmap.josm.tools.ImageProvider; 37 38 import org.openstreetmap.josm.tools.Shortcut; … … 165 166 */ 166 167 public final SequenceCommand simplifyWay(Way w) { 167 return simplifyWay(w, Main.pref.getDouble("simplify-way.max-error", 3.0));168 return simplifyWay(w, Config.getPref().getDouble("simplify-way.max-error", 3.0)); 168 169 } 169 170 -
trunk/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java
r12565 r12846 10 10 import java.io.IOException; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 14 13 import org.openstreetmap.josm.io.audio.AudioPlayer; 15 14 import org.openstreetmap.josm.io.audio.AudioUtil; 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 import org.openstreetmap.josm.tools.Shortcut; 17 17 … … 36 36 if (AudioPlayer.playing() || AudioPlayer.paused()) 37 37 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position() 38 - Main.pref.getDouble("audio.forwardbackamount", 10.0));38 - Config.getPref().getDouble("audio.forwardbackamount", 10.0)); 39 39 else 40 40 MarkerLayer.playAudio(); -
trunk/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java
r12565 r12846 5 5 import java.io.IOException; 6 6 7 import org.openstreetmap.josm.Main;8 7 import org.openstreetmap.josm.io.audio.AudioPlayer; 9 8 import org.openstreetmap.josm.io.audio.AudioUtil; 9 import org.openstreetmap.josm.spi.preferences.Config; 10 10 import org.openstreetmap.josm.tools.Shortcut; 11 11 … … 29 29 public AudioFastSlowAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean fast) { 30 30 super(name, iconName, tooltip, shortcut, true); 31 multiplier = Main.pref.getDouble("audio.fastfwdmultiplier", 1.3);31 multiplier = Config.getPref().getDouble("audio.fastfwdmultiplier", 1.3); 32 32 if (!fast) 33 33 multiplier = 1.0 / multiplier; -
trunk/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java
r12565 r12846 9 9 import java.io.IOException; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 13 12 import org.openstreetmap.josm.io.audio.AudioPlayer; 14 13 import org.openstreetmap.josm.io.audio.AudioUtil; 14 import org.openstreetmap.josm.spi.preferences.Config; 15 15 import org.openstreetmap.josm.tools.Shortcut; 16 16 … … 34 34 if (AudioPlayer.playing() || AudioPlayer.paused()) 35 35 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position() 36 + Main.pref.getDouble("audio.forwardbackamount", 10.0));36 + Config.getPref().getDouble("audio.forwardbackamount", 10.0)); 37 37 else 38 38 MarkerLayer.playAudio(); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
r12679 r12846 13 13 import java.util.stream.Stream; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.Bounds; 17 16 import org.openstreetmap.josm.data.Bounds.ParseMethod; … … 35 34 import org.openstreetmap.josm.io.OsmServerReader; 36 35 import org.openstreetmap.josm.io.OsmTransferException; 36 import org.openstreetmap.josm.spi.preferences.Config; 37 37 import org.openstreetmap.josm.tools.CheckParameterUtil; 38 38 import org.xml.sax.SAXException; … … 169 169 170 170 private GpxLayer findGpxMergeLayer() { 171 boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false);171 boolean merge = Config.getPref().getBoolean("download.gps.mergeWithLocal", false); 172 172 Layer active = MainApplication.getLayerManager().getActiveLayer(); 173 173 if (active instanceof GpxLayer && (merge || ((GpxLayer) active).data.fromServer)) -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadSessionTask.java
r12634 r12846 9 9 import java.util.concurrent.Future; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.actions.SessionLoadAction.Loader; 13 12 import org.openstreetmap.josm.data.Bounds; 14 13 import org.openstreetmap.josm.gui.MainApplication; 15 14 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 import org.openstreetmap.josm.tools.HttpClient; 17 17 import org.openstreetmap.josm.tools.Logging; … … 78 78 @Override 79 79 public boolean isSafeForRemotecontrolRequests() { 80 return Main.pref.getBoolean("remotecontrol.import.allow_session", false);80 return Config.getPref().getBoolean("remotecontrol.import.allow_session", false); 81 81 } 82 82 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r12718 r12846 13 13 import java.util.Set; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.command.Command; 17 16 import org.openstreetmap.josm.command.DeleteCommand; … … 30 29 import org.openstreetmap.josm.gui.util.HighlightHelper; 31 30 import org.openstreetmap.josm.gui.util.ModifierExListener; 31 import org.openstreetmap.josm.spi.preferences.Config; 32 32 import org.openstreetmap.josm.tools.CheckParameterUtil; 33 33 import org.openstreetmap.josm.tools.ImageProvider; … … 111 111 return; 112 112 113 drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true);113 drawTargetHighlight = Config.getPref().getBoolean("draw.target-highlight", true); 114 114 115 115 MapFrame map = MainApplication.getMap(); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java
r12841 r12846 32 32 import org.openstreetmap.josm.gui.draw.SymbolShape; 33 33 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 34 import org.openstreetmap.josm.spi.preferences.Config; 34 35 import org.openstreetmap.josm.tools.Logging; 35 36 import org.openstreetmap.josm.tools.Utils; … … 237 238 238 239 private void computeSnapAngles() { 239 snapAngles = Main.pref.getList(DRAW_ANGLESNAP_ANGLES,240 snapAngles = Config.getPref().getList(DRAW_ANGLESNAP_ANGLES, 240 241 Arrays.asList("0", "30", "45", "60", "90", "120", "135", "150", "180")) 241 242 .stream() … … 259 260 */ 260 261 public void saveAngles(String... angles) { 261 Main.pref.putList(DRAW_ANGLESNAP_ANGLES, Arrays.asList(angles));262 Config.getPref().putList(DRAW_ANGLESNAP_ANGLES, Arrays.asList(angles)); 262 263 } 263 264 -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r12841 r12846 58 58 import org.openstreetmap.josm.gui.util.KeyPressReleaseListener; 59 59 import org.openstreetmap.josm.gui.util.ModifierExListener; 60 import org.openstreetmap.josm.spi.preferences.Config; 60 61 import org.openstreetmap.josm.tools.Geometry; 61 62 import org.openstreetmap.josm.tools.ImageProvider; … … 307 308 @Override 308 309 protected void readPreferences() { 309 initialMoveDelay = Main.pref.getInt("edit.initial-move-delay", 200);310 initialMoveThreshold = Main.pref.getInt("extrude.initial-move-threshold", 1);310 initialMoveDelay = Config.getPref().getInt("edit.initial-move-delay", 200); 311 initialMoveThreshold = Config.getPref().getInt("extrude.initial-move-threshold", 1); 311 312 mainColor = new ColorProperty(marktr("Extrude: main line"), Color.RED).get(); 312 313 helperColor = new ColorProperty(marktr("Extrude: helper line"), Color.ORANGE).get(); 313 helperStrokeDash = GuiHelper.getCustomizedStroke( Main.pref.get("extrude.stroke.helper-line", "1 4"));314 helperStrokeDash = GuiHelper.getCustomizedStroke(Config.getPref().get("extrude.stroke.helper-line", "1 4")); 314 315 helperStrokeRA = new BasicStroke(1); 315 symbolSize = Main.pref.getDouble("extrude.angle-symbol-radius", 8);316 nodeDragWithoutCtrl = Main.pref.getBoolean("extrude.drag-nodes-without-ctrl", false);317 oldLineStroke = GuiHelper.getCustomizedStroke( Main.pref.get("extrude.ctrl.stroke.old-line", "1"));318 mainStroke = GuiHelper.getCustomizedStroke( Main.pref.get("extrude.stroke.main", "3"));319 320 ignoreSharedNodes = Main.pref.getBoolean("extrude.ignore-shared-nodes", true);316 symbolSize = Config.getPref().getDouble("extrude.angle-symbol-radius", 8); 317 nodeDragWithoutCtrl = Config.getPref().getBoolean("extrude.drag-nodes-without-ctrl", false); 318 oldLineStroke = GuiHelper.getCustomizedStroke(Config.getPref().get("extrude.ctrl.stroke.old-line", "1")); 319 mainStroke = GuiHelper.getCustomizedStroke(Config.getPref().get("extrude.stroke.main", "3")); 320 321 ignoreSharedNodes = Config.getPref().getBoolean("extrude.ignore-shared-nodes", true); 321 322 dualAlignCheckboxMenuItem.getAction().setEnabled(true); 322 useRepeatedShortcut = Main.pref.getBoolean("extrude.dualalign.toggleOnRepeatedX", true);323 keepSegmentDirection = Main.pref.getBoolean("extrude.dualalign.keep-segment-direction", true);323 useRepeatedShortcut = Config.getPref().getBoolean("extrude.dualalign.toggleOnRepeatedX", true); 324 keepSegmentDirection = Config.getPref().getBoolean("extrude.dualalign.keep-segment-direction", true); 324 325 } 325 326 -
trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java
r12630 r12846 11 11 import java.util.Collections; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.JosmAction; 15 14 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; … … 19 18 import org.openstreetmap.josm.gui.MapFrame; 20 19 import org.openstreetmap.josm.gui.layer.Layer; 20 import org.openstreetmap.josm.spi.preferences.Config; 21 21 import org.openstreetmap.josm.tools.ImageProvider; 22 22 import org.openstreetmap.josm.tools.Shortcut; … … 98 98 public void enterMode() { 99 99 putValue("active", Boolean.TRUE); 100 Main.pref.addPreferenceChangeListener(this);100 Config.getPref().addPreferenceChangeListener(this); 101 101 readPreferences(); 102 102 MainApplication.getMap().mapView.setNewCursor(cursor, this); … … 109 109 public void exitMode() { 110 110 putValue("active", Boolean.FALSE); 111 Main.pref.removePreferenceChangeListener(this);111 Config.getPref().removePreferenceChangeListener(this); 112 112 MainApplication.getMap().mapView.resetCursor(this); 113 113 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r12841 r12846 51 51 import org.openstreetmap.josm.gui.util.KeyPressReleaseListener; 52 52 import org.openstreetmap.josm.gui.util.ModifierExListener; 53 import org.openstreetmap.josm.spi.preferences.Config; 53 54 import org.openstreetmap.josm.tools.ImageProvider; 54 55 import org.openstreetmap.josm.tools.Logging; … … 202 203 mv.addMouseListener(this); 203 204 mv.addMouseMotionListener(this); 204 mv.setVirtualNodesEnabled( Main.pref.getInt("mappaint.node.virtual-size", 8) != 0);205 drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true);206 initialMoveDelay = Main.pref.getInt("edit.initial-move-delay", 200);207 initialMoveThreshold = Main.pref.getInt("edit.initial-move-threshold", 5);208 repeatedKeySwitchLassoOption = Main.pref.getBoolean("mappaint.select.toggle-lasso-on-repeated-S", true);205 mv.setVirtualNodesEnabled(Config.getPref().getInt("mappaint.node.virtual-size", 8) != 0); 206 drawTargetHighlight = Config.getPref().getBoolean("draw.target-highlight", true); 207 initialMoveDelay = Config.getPref().getInt("edit.initial-move-delay", 200); 208 initialMoveThreshold = Config.getPref().getInt("edit.initial-move-threshold", 5); 209 repeatedKeySwitchLassoOption = Config.getPref().getBoolean("mappaint.select.toggle-lasso-on-repeated-S", true); 209 210 cycleManager.init(); 210 211 virtualManager.init(); … … 828 829 } 829 830 } 830 int max = Main.pref.getInt("warn.move.maxelements", 20), limit = max;831 int max = Config.getPref().getInt("warn.move.maxelements", 20), limit = max; 831 832 for (OsmPrimitive osm : getLayerManager().getEditDataSet().getSelected()) { 832 833 if (osm instanceof Way) { … … 1039 1040 */ 1040 1041 private void init() { 1041 waitForMouseUpParameter = Main.pref.getBoolean("mappaint.select.waits-for-mouse-up", false);1042 multipleMatchesParameter = Main.pref.getBoolean("selectaction.cycles.multiple.matches", false);1042 waitForMouseUpParameter = Config.getPref().getBoolean("mappaint.select.waits-for-mouse-up", false); 1043 multipleMatchesParameter = Config.getPref().getBoolean("selectaction.cycles.multiple.matches", false); 1043 1044 } 1044 1045 … … 1175 1176 1176 1177 private void init() { 1177 nodeVirtualSize = Main.pref.getInt("mappaint.node.virtual-size", 8);1178 int virtualSnapDistSq = Main.pref.getInt("mappaint.node.virtual-snap-distance", 8);1178 nodeVirtualSize = Config.getPref().getInt("mappaint.node.virtual-size", 8); 1179 int virtualSnapDistSq = Config.getPref().getInt("mappaint.node.virtual-snap-distance", 8); 1179 1180 virtualSnapDistSq2 = virtualSnapDistSq*virtualSnapDistSq; 1180 virtualSpace = Main.pref.getInt("mappaint.node.virtual-space", 70);1181 virtualSpace = Config.getPref().getInt("mappaint.node.virtual-space", 70); 1181 1182 } 1182 1183 -
trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
r12841 r12846 19 19 import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; 20 20 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 21 import org.openstreetmap.josm.spi.preferences.Config; 21 22 import org.openstreetmap.josm.tools.ImageProvider; 22 23 … … 70 71 public void actionPerformed(ActionEvent e) { 71 72 if (!isEnabled() || relations.isEmpty()) return; 72 if (relations.size() > Main.pref.getInt("warn.open.maxrelations", 5) &&73 if (relations.size() > Config.getPref().getInt("warn.open.maxrelations", 5) && 73 74 /* I18N english text for value 1 makes no real sense, never called for values <= maxrel (usually 5) */ 74 75 JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent, -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r12841 r12846 67 67 import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator; 68 68 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 69 import org.openstreetmap.josm.spi.preferences.Config; 69 70 import org.openstreetmap.josm.tools.GBC; 70 71 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 112 113 }); 113 114 114 for (String s: Main.pref.getList("search.history", Collections.<String>emptyList())) {115 for (String s: Config.getPref().getList("search.history", Collections.<String>emptyList())) { 115 116 SearchSetting ss = SearchSetting.readFromString(s); 116 117 if (ss != null) { … … 140 141 searchHistory.addFirst(new SearchSetting(s)); 141 142 } 142 int maxsize = Main.pref.getInt("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE);143 int maxsize = Config.getPref().getInt("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE); 143 144 while (searchHistory.size() > maxsize) { 144 145 searchHistory.removeLast(); … … 148 149 savedHistory.add(item.writeToString()); 149 150 } 150 Main.pref.putList("search.history", new ArrayList<>(savedHistory));151 Config.getPref().putList("search.history", new ArrayList<>(savedHistory)); 151 152 } 152 153 -
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r12641 r12846 12 12 import java.util.Map.Entry; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.command.ChangePropertyCommand; 16 15 import org.openstreetmap.josm.command.Command; … … 21 20 import org.openstreetmap.josm.data.osm.Tag; 22 21 import org.openstreetmap.josm.gui.MainApplication; 22 import org.openstreetmap.josm.spi.preferences.Config; 23 23 24 24 /** … … 187 187 @Override 188 188 public boolean checkUpload(APIDataSet apiDataSet) { 189 if ( Main.pref.getBoolean("fix.data.on.upload", true)) {189 if (Config.getPref().getBoolean("fix.data.on.upload", true)) { 190 190 Collection<Command> cmds = new LinkedList<>(); 191 191 -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r12718 r12846 16 16 import javax.swing.Icon; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.conflict.Conflict; 20 19 import org.openstreetmap.josm.data.conflict.ConflictCollection; … … 32 31 import org.openstreetmap.josm.data.osm.WayData; 33 32 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 33 import org.openstreetmap.josm.spi.preferences.Config; 34 34 import org.openstreetmap.josm.tools.ImageProvider; 35 35 … … 384 384 385 385 // Add untagged way nodes. Do not add nodes that have other referrers not yet to-be-purged. 386 if ( Main.pref.getBoolean("purge.add_untagged_waynodes", true)) {386 if (Config.getPref().getBoolean("purge.add_untagged_waynodes", true)) { 387 387 Set<OsmPrimitive> wayNodes = new HashSet<>(); 388 388 for (OsmPrimitive osm : toPurgeChecked) { … … 409 409 } 410 410 411 if ( Main.pref.getBoolean("purge.add_relations_with_only_incomplete_members", true)) {411 if (Config.getPref().getBoolean("purge.add_relations_with_only_incomplete_members", true)) { 412 412 Set<Relation> relSet = new HashSet<>(); 413 413 for (OsmPrimitive osm : toPurgeChecked) { -
trunk/src/org/openstreetmap/josm/command/SplitWayCommand.java
r12841 r12846 17 17 import java.util.function.Consumer; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 21 20 import org.openstreetmap.josm.data.osm.Node; … … 25 24 import org.openstreetmap.josm.data.osm.RelationMember; 26 25 import org.openstreetmap.josm.data.osm.Way; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.CheckParameterUtil; 28 28 import org.openstreetmap.josm.tools.Logging; … … 273 273 274 274 Collection<Command> commandList = new ArrayList<>(newWays.size()); 275 Collection<String> nowarnroles = Main.pref.getList("way.split.roles.nowarn",275 Collection<String> nowarnroles = Config.getPref().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/SystemOfMeasurement.java
r12674 r12846 12 12 import java.util.concurrent.CopyOnWriteArrayList; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.preferences.StringProperty; 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 17 17 /** … … 230 230 public String getDistText(final double dist, final NumberFormat format, final double threshold) { 231 231 double a = dist / aValue; 232 if (a > bValue / aValue && ! Main.pref.getBoolean("system_of_measurement.use_only_lower_unit", false))232 if (a > bValue / aValue && !Config.getPref().getBoolean("system_of_measurement.use_only_lower_unit", false)) 233 233 return formatText(dist / bValue, bName, format); 234 234 else if (a < threshold) … … 258 258 public String getAreaText(final double area, final NumberFormat format, final double threshold) { 259 259 double a = area / (aValue*aValue); 260 boolean lowerOnly = Main.pref.getBoolean("system_of_measurement.use_only_lower_unit", false);261 boolean customAreaOnly = Main.pref.getBoolean("system_of_measurement.use_only_custom_area_unit", false);260 boolean lowerOnly = Config.getPref().getBoolean("system_of_measurement.use_only_lower_unit", false); 261 boolean customAreaOnly = Config.getPref().getBoolean("system_of_measurement.use_only_custom_area_unit", false); 262 262 if ((!lowerOnly && areaCustomValue > 0 && a > areaCustomValue / (aValue*aValue) 263 263 && a < (bValue*bValue) / (aValue*aValue)) || customAreaOnly) -
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r12841 r12846 11 11 import org.openstreetmap.josm.data.osm.DataSet; 12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 import org.openstreetmap.josm.spi.preferences.Config; 13 14 import org.openstreetmap.josm.tools.CheckParameterUtil; 14 15 … … 74 75 // Currently you have to undo the commands one by one. If 75 76 // this changes, a higher default value may be reasonable. 76 if (commands.size() > Main.pref.getInt("undo.max", 1000)) {77 if (commands.size() > Config.getPref().getInt("undo.max", 1000)) { 77 78 commands.removeFirst(); 78 79 } -
trunk/src/org/openstreetmap/josm/data/UserIdentityManager.java
r12744 r12846 19 19 import org.openstreetmap.josm.io.OsmTransferException; 20 20 import org.openstreetmap.josm.io.auth.CredentialsManager; 21 import org.openstreetmap.josm.spi.preferences.Config; 21 22 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 23 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 77 78 instance.initFromPreferences(); 78 79 } 79 Main.pref.addPreferenceChangeListener(instance);80 Config.getPref().addPreferenceChangeListener(instance); 80 81 } 81 82 return instance; -
trunk/src/org/openstreetmap/josm/data/coor/conversion/DMSCoordinateFormat.java
r12741 r12846 6 6 import java.text.DecimalFormat; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.coor.ILatLon; 9 import org.openstreetmap.josm.spi.preferences.Config; 10 10 11 11 /** … … 17 17 private static final DecimalFormat DMS_MINUTE_FORMATTER = new DecimalFormat("00"); 18 18 private static final DecimalFormat DMS_SECOND_FORMATTER = new DecimalFormat( 19 Main.pref == null ? "00.0" : Main.pref.get("latlon.dms.decimal-format", "00.0"));19 Config.getPref() == null ? "00.0" : Config.getPref().get("latlon.dms.decimal-format", "00.0")); 20 20 private static final String DMS60 = DMS_SECOND_FORMATTER.format(60.0); 21 21 private static final String DMS00 = DMS_SECOND_FORMATTER.format(0.0); -
trunk/src/org/openstreetmap/josm/data/coor/conversion/NauticalCoordinateFormat.java
r12741 r12846 6 6 import java.text.DecimalFormat; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.coor.ILatLon; 9 import org.openstreetmap.josm.spi.preferences.Config; 10 10 11 11 /** … … 15 15 public class NauticalCoordinateFormat extends AbstractCoordinateFormat { 16 16 private static final DecimalFormat DM_MINUTE_FORMATTER = new DecimalFormat( 17 Main.pref == null ? "00.000" : Main.pref.get("latlon.dm.decimal-format", "00.000"));17 Config.getPref() == null ? "00.000" : Config.getPref().get("latlon.dm.decimal-format", "00.000")); 18 18 private static final String DM60 = DM_MINUTE_FORMATTER.format(60.0); 19 19 private static final String DM00 = DM_MINUTE_FORMATTER.format(0.0); -
trunk/src/org/openstreetmap/josm/data/imagery/CachedTileLoaderFactory.java
r12841 r12846 15 15 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry; 16 16 import org.openstreetmap.josm.data.preferences.StringProperty; 17 import org.openstreetmap.josm.spi.preferences.Config; 17 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 19 import org.openstreetmap.josm.tools.Logging; … … 72 73 73 74 return getLoader(listener, cache, 74 (int) TimeUnit.SECONDS.toMillis( Main.pref.getInt("socket.timeout.connect", 15)),75 (int) TimeUnit.SECONDS.toMillis( Main.pref.getInt("socket.timeout.read", 30)),75 (int) TimeUnit.SECONDS.toMillis(Config.getPref().getInt("socket.timeout.connect", 15)), 76 (int) TimeUnit.SECONDS.toMillis(Config.getPref().getInt("socket.timeout.read", 30)), 76 77 headers); 77 78 } -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r12841 r12846 26 26 import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource.Mapnik; 27 27 import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo; 28 import org.openstreetmap.josm.Main;29 28 import org.openstreetmap.josm.data.Bounds; 30 29 import org.openstreetmap.josm.data.Preferences.pref; 31 30 import org.openstreetmap.josm.io.Capabilities; 32 31 import org.openstreetmap.josm.io.OsmApi; 32 import org.openstreetmap.josm.spi.preferences.Config; 33 33 import org.openstreetmap.josm.tools.CheckParameterUtil; 34 34 import org.openstreetmap.josm.tools.ImageProvider; … … 817 817 public void clearId() { 818 818 if (this.id != null) { 819 Collection<String> newAddedIds = new TreeSet<>( Main.pref.getList("imagery.layers.addedIds"));819 Collection<String> newAddedIds = new TreeSet<>(Config.getPref().getList("imagery.layers.addedIds")); 820 820 newAddedIds.add(this.id); 821 Main.pref.putList("imagery.layers.addedIds", new ArrayList<>(newAddedIds));821 Config.getPref().putList("imagery.layers.addedIds", new ArrayList<>(newAddedIds)); 822 822 } 823 823 setId(null); -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r12841 r12846 25 25 import org.openstreetmap.josm.io.OnlineResource; 26 26 import org.openstreetmap.josm.io.imagery.ImageryReader; 27 import org.openstreetmap.josm.spi.preferences.Config; 27 28 import org.openstreetmap.josm.tools.Logging; 28 29 import org.openstreetmap.josm.tools.Utils; … … 57 58 */ 58 59 public static Collection<String> getImageryLayersSites() { 59 return Main.pref.getList("imagery.layers.sites", Arrays.asList(DEFAULT_LAYER_SITES));60 return Config.getPref().getList("imagery.layers.sites", Arrays.asList(DEFAULT_LAYER_SITES)); 60 61 } 61 62 … … 236 237 // add new default entries to the user selection 237 238 boolean changed = false; 238 Collection<String> knownDefaults = new TreeSet<>( Main.pref.getList("imagery.layers.default"));239 Collection<String> knownDefaults = new TreeSet<>(Config.getPref().getList("imagery.layers.default")); 239 240 Collection<String> newKnownDefaults = new TreeSet<>(); 240 241 for (ImageryInfo def : defaultLayers) { … … 279 280 newKnownDefaults.addAll(knownDefaults); 280 281 } 281 Main.pref.putList("imagery.layers.default", new ArrayList<>(newKnownDefaults));282 Config.getPref().putList("imagery.layers.default", new ArrayList<>(newKnownDefaults)); 282 283 283 284 // automatically update user entries with same id as a default entry -
trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java
r12630 r12846 22 22 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 23 23 import org.openstreetmap.josm.gui.layer.ImageryLayer; 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 import org.openstreetmap.josm.tools.Logging; 25 26 … … 177 178 // migration code - remove Nov. 2017 178 179 private static void loadBookmarksOld() { 179 for (Collection<String> c : Main.pref.getArray("imagery.offsets", 180 Collections.<Collection<String>>emptySet())) { 180 for (Collection<String> c : Config.getPref().getListOfLists("imagery.offsets")) { 181 181 allBookmarks.add(new OffsetBookmark(c)); 182 182 } -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r12767 r12846 12 12 import java.util.stream.Collectors; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 16 15 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 17 16 import org.openstreetmap.josm.data.UserIdentityManager; 17 import org.openstreetmap.josm.spi.preferences.Config; 18 18 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 19 19 … … 45 45 */ 46 46 private ChangesetCache() { 47 Main.pref.addPreferenceChangeListener(this);47 Config.getPref().addPreferenceChangeListener(this); 48 48 } 49 49 -
trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
r12841 r12846 21 21 import java.util.stream.Collectors; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.data.coor.LatLon; 25 24 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; … … 31 30 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 32 31 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetNameTemplateList; 32 import org.openstreetmap.josm.spi.preferences.Config; 33 33 import org.openstreetmap.josm.tools.AlphanumComparator; 34 34 import org.openstreetmap.josm.tools.I18n; … … 105 105 if (namingTagsForRelations == null) { 106 106 namingTagsForRelations = new ArrayList<>( 107 Main.pref.getList("relation.nameOrder", Arrays.asList(DEFAULT_NAMING_TAGS_FOR_RELATIONS))107 Config.getPref().getList("relation.nameOrder", Arrays.asList(DEFAULT_NAMING_TAGS_FOR_RELATIONS)) 108 108 ); 109 109 } … … 119 119 */ 120 120 protected void decorateNameWithId(StringBuilder name, IPrimitive primitive) { 121 if ( Main.pref.getBoolean("osm-primitives.showid")) {122 if ( Main.pref.getBoolean("osm-primitives.showid.new-primitives")) {121 if (Config.getPref().getBoolean("osm-primitives.showid")) { 122 if (Config.getPref().getBoolean("osm-primitives.showid.new-primitives")) { 123 123 name.append(tr(" [id: {0}]", primitive.getUniqueId())); 124 124 } else { … … 155 155 if (preset == null) { 156 156 String n; 157 if ( Main.pref.getBoolean("osm-primitives.localize-name", true)) {157 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 158 158 n = node.getLocalName(); 159 159 } else { … … 233 233 if (preset == null) { 234 234 String n; 235 if ( Main.pref.getBoolean("osm-primitives.localize-name", true)) {235 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 236 236 n = way.getLocalName(); 237 237 } else { … … 433 433 private static String getNameTagValue(IRelation relation, String nameTag) { 434 434 if ("name".equals(nameTag)) { 435 if ( Main.pref.getBoolean("osm-primitives.localize-name", true))435 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) 436 436 return relation.getLocalName(); 437 437 else … … 519 519 */ 520 520 protected void decorateNameWithId(StringBuilder name, HistoryOsmPrimitive primitive) { 521 if ( Main.pref.getBoolean("osm-primitives.showid")) {521 if (Config.getPref().getBoolean("osm-primitives.showid")) { 522 522 name.append(tr(" [id: {0}]", primitive.getId())); 523 523 } … … 528 528 StringBuilder sb = new StringBuilder(); 529 529 String name; 530 if ( Main.pref.getBoolean("osm-primitives.localize-name", true)) {530 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 531 531 name = node.getLocalName(); 532 532 } else { … … 554 554 StringBuilder sb = new StringBuilder(); 555 555 String name; 556 if ( Main.pref.getBoolean("osm-primitives.localize-name", true)) {556 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 557 557 name = way.getLocalName(); 558 558 } else { … … 601 601 // #3328: "note " and " note" are name tags too 602 602 if (namingTags.contains(n.trim())) { 603 if ( Main.pref.getBoolean("osm-primitives.localize-name", true)) {603 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 604 604 nameTag = relation.getLocalName(); 605 605 } else { -
trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java
r12659 r12846 6 6 import java.util.List; 7 7 8 import org.openstreetmap.josm.data.osm.search.SearchParseError;9 8 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 10 import org.openstreetmap.josm.data.osm.search.SearchMode;11 9 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match; 12 10 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Not; 11 import org.openstreetmap.josm.data.osm.search.SearchMode; 12 import org.openstreetmap.josm.data.osm.search.SearchParseError; 13 13 import org.openstreetmap.josm.gui.MainApplication; 14 14 import org.openstreetmap.josm.gui.MapFrame; -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r12841 r12846 20 20 import java.util.Set; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 24 23 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match; … … 26 25 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor; 27 26 import org.openstreetmap.josm.gui.mappaint.StyleCache; 27 import org.openstreetmap.josm.spi.preferences.Config; 28 28 import org.openstreetmap.josm.tools.CheckParameterUtil; 29 29 import org.openstreetmap.josm.tools.Logging; … … 650 650 l.addAll(getDiscardableKeys()); 651 651 l.addAll(getWorkInProgressKeys()); 652 uninteresting = new HashSet<>( Main.pref.getList("tags.uninteresting", l));652 uninteresting = new HashSet<>(Config.getPref().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.getList("tags.discardable",664 discardable = new HashSet<>(Config.getPref().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.getList("tags.workinprogress",722 workinprogress = new HashSet<>(Config.getPref().getList("tags.workinprogress", 723 723 Arrays.asList("note", "fixme", "FIXME"))); 724 724 } … … 760 760 private static Match compileDirectionKeys(String prefName, String defaultValue) throws AssertionError { 761 761 try { 762 return SearchCompiler.compile( Main.pref.get(prefName, defaultValue));762 return SearchCompiler.compile(Config.getPref().get(prefName, defaultValue)); 763 763 } catch (SearchParseError e) { 764 764 Logging.log(Logging.LEVEL_ERROR, "Unable to compile pattern for " + prefName + ", trying default pattern:", e); -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r12813 r12846 13 13 import java.util.stream.Collectors; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor; 17 16 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 17 import org.openstreetmap.josm.spi.preferences.Config; 18 18 import org.openstreetmap.josm.tools.CopyList; 19 19 import org.openstreetmap.josm.tools.SubclassFilteredCollection; … … 507 507 getPrimitiveId(), rm.getMember().getPrimitiveId())); 508 508 } 509 if ( Main.pref.getBoolean("debug.checkDeleteReferenced", true)) {509 if (Config.getPref().getBoolean("debug.checkDeleteReferenced", true)) { 510 510 for (RelationMember rm: members) { 511 511 if (rm.getMember().isDeleted()) -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r12813 r12846 11 11 import java.util.Set; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.coor.LatLon; 15 14 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor; 16 15 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 16 import org.openstreetmap.josm.spi.preferences.Config; 17 17 import org.openstreetmap.josm.tools.CopyList; 18 18 import org.openstreetmap.josm.tools.Pair; … … 609 609 DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>"); 610 610 } 611 if ( Main.pref.getBoolean("debug.checkNullCoor", true)) {611 if (Config.getPref().getBoolean("debug.checkNullCoor", true)) { 612 612 for (Node n: nodes) { 613 613 if (n.isVisible() && !n.isIncomplete() && !n.isLatLonKnown()) -
trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
r12818 r12846 17 17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.gui.MapFrame; 19 import org.openstreetmap.josm.spi.preferences.Config; 19 20 20 21 /** … … 126 127 */ 127 128 public void enlargeBoundingBox() { 128 enlargeBoundingBox( Main.pref.getDouble("edit.zoom-enlarge-bbox", 0.002));129 enlargeBoundingBox(Config.getPref().getDouble("edit.zoom-enlarge-bbox", 0.002)); 129 130 } 130 131 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
r12841 r12846 9 9 import java.util.Iterator; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.osm.BBox; 13 12 import org.openstreetmap.josm.data.osm.DataSet; … … 19 18 import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle; 20 19 import org.openstreetmap.josm.gui.NavigatableComponent; 20 import org.openstreetmap.josm.spi.preferences.Config; 21 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 22 import org.openstreetmap.josm.tools.Logging; … … 182 182 */ 183 183 protected void getSettings(boolean virtual) { 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);184 this.virtualNodeSize = virtual ? Config.getPref().getInt("mappaint.node.virtual-size", 8) / 2 : 0; 185 this.virtualNodeSpace = Config.getPref().getInt("mappaint.node.virtual-space", 70); 186 this.segmentNumberSpace = Config.getPref().getInt("mappaint.segmentnumber.space", 40); 187 187 getColors(); 188 188 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/ComputeStyleListWorker.java
r12841 r12846 8 8 import java.util.concurrent.RecursiveTask; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.osm.Node; 12 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 25 24 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 26 25 import org.openstreetmap.josm.gui.mappaint.styleelement.TextElement; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.JosmRuntimeException; 28 28 import org.openstreetmap.josm.tools.bugreport.BugReport; … … 60 60 this.output = output; 61 61 this.directExecutionTaskSize = directExecutionTaskSize; 62 this.drawArea = circum <= Main.pref.getInt("mappaint.fillareas", 10_000_000);63 this.drawMultipolygon = drawArea && Main.pref.getBoolean("mappaint.multipolygon", true);64 this.drawRestriction = Main.pref.getBoolean("mappaint.restriction", true);62 this.drawArea = circum <= Config.getPref().getInt("mappaint.fillareas", 10_000_000); 63 this.drawMultipolygon = drawArea && Config.getPref().getBoolean("mappaint.multipolygon", true); 64 this.drawRestriction = Config.getPref().getBoolean("mappaint.restriction", true); 65 65 this.styles.setDrawMultipolygon(drawMultipolygon); 66 66 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java
r12841 r12846 4 4 import java.awt.Color; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 8 7 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 8 import org.openstreetmap.josm.spi.preferences.Config; 9 9 10 10 /** … … 69 69 private MapPaintSettings() { 70 70 load(); 71 Main.pref.addPreferenceChangeListener(this);71 Config.getPref().addPreferenceChangeListener(this); 72 72 } 73 73 74 74 private void load() { 75 showDirectionArrow = Main.pref.getBoolean("draw.segment.direction", false);76 showOnewayArrow = Main.pref.getBoolean("draw.oneway", true);77 useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth", false);78 defaultSegmentWidth = Main.pref.getInt("mappaint.segment.default-width", 2);75 showDirectionArrow = Config.getPref().getBoolean("draw.segment.direction", false); 76 showOnewayArrow = Config.getPref().getBoolean("draw.oneway", true); 77 useRealWidth = Config.getPref().getBoolean("mappaint.useRealWidth", false); 78 defaultSegmentWidth = Config.getPref().getInt("mappaint.segment.default-width", 2); 79 79 80 80 selectedColor = PaintColors.SELECTED.get(); … … 91 91 } 92 92 93 showOrderNumber = Main.pref.getBoolean("draw.segment.order_number", false);94 showOrderNumberOnSelectedWay = Main.pref.getBoolean("draw.segment.order_number.on_selected", false);95 showHeadArrowOnly = Main.pref.getBoolean("draw.segment.head_only", false);96 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 fillSelectedNode = Main.pref.getBoolean("mappaint.node.fill-selected", true);106 fillUnselectedNode = Main.pref.getBoolean("mappaint.node.fill-unselected", false);107 fillTaggedNode = Main.pref.getBoolean("mappaint.node.fill-tagged", true);108 fillConnectionNode = Main.pref.getBoolean("mappaint.node.fill-connection", false);109 110 outlineOnly = Main.pref.getBoolean("draw.data.area_outline_only", false);93 showOrderNumber = Config.getPref().getBoolean("draw.segment.order_number", false); 94 showOrderNumberOnSelectedWay = Config.getPref().getBoolean("draw.segment.order_number.on_selected", false); 95 showHeadArrowOnly = Config.getPref().getBoolean("draw.segment.head_only", false); 96 97 showNamesDistance = Config.getPref().getInt("mappaint.shownames", 10_000_000); 98 useStrokesDistance = Config.getPref().getInt("mappaint.strokes", 10_000_000); 99 showIconsDistance = Config.getPref().getInt("mappaint.showicons", 10_000_000); 100 101 selectedNodeSize = Config.getPref().getInt("mappaint.node.selected-size", 5); 102 unselectedNodeSize = Config.getPref().getInt("mappaint.node.unselected-size", 3); 103 connectionNodeSize = Config.getPref().getInt("mappaint.node.connection-size", 5); 104 taggedNodeSize = Config.getPref().getInt("mappaint.node.tagged-size", 3); 105 fillSelectedNode = Config.getPref().getBoolean("mappaint.node.fill-selected", true); 106 fillUnselectedNode = Config.getPref().getBoolean("mappaint.node.fill-unselected", false); 107 fillTaggedNode = Config.getPref().getBoolean("mappaint.node.fill-tagged", true); 108 fillConnectionNode = Config.getPref().getBoolean("mappaint.node.fill-connection", false); 109 110 outlineOnly = Config.getPref().getBoolean("draw.data.area_outline_only", false); 111 111 } 112 112 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java
r12620 r12846 13 13 import java.util.List; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.gui.NavigatableComponent; 17 16 import org.openstreetmap.josm.plugins.PluginHandler; 17 import org.openstreetmap.josm.spi.preferences.Config; 18 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 19 import org.openstreetmap.josm.tools.Logging; … … 151 151 private MapRendererFactory() { 152 152 registerDefaultRenderers(); 153 String rendererClassName = Main.pref.get(PREF_KEY_RENDERER_CLASS_NAME, null);153 String rendererClassName = Config.getPref().get(PREF_KEY_RENDERER_CLASS_NAME, null); 154 154 if (rendererClassName != null) { 155 155 activateMapRenderer(rendererClassName); … … 274 274 ); 275 275 this.activeRenderer = renderer; 276 Main.pref.put(PREF_KEY_RENDERER_CLASS_NAME, activeRenderer.getName());276 Config.getPref().put(PREF_KEY_RENDERER_CLASS_NAME, activeRenderer.getName()); 277 277 278 278 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/RenderBenchmarkCollector.java
r12620 r12846 6 6 import java.util.function.Supplier; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.StyleRecord; 10 9 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; 10 import org.openstreetmap.josm.spi.preferences.Config; 11 11 import org.openstreetmap.josm.tools.Logging; 12 12 import org.openstreetmap.josm.tools.Utils; … … 148 148 */ 149 149 public static Supplier<RenderBenchmarkCollector> defaultBenchmarkSupplier() { 150 return () -> Logging.isTraceEnabled() || Main.pref.getBoolean("mappaint.render.benchmark", false)150 return () -> Logging.isTraceEnabled() || Config.getPref().getBoolean("mappaint.render.benchmark", false) 151 151 ? new LoggingBenchmark() : new RenderBenchmarkCollector(); 152 152 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r12722 r12846 43 43 import javax.swing.FocusManager; 44 44 45 import org.openstreetmap.josm.Main;46 45 import org.openstreetmap.josm.data.Bounds; 47 46 import org.openstreetmap.josm.data.coor.EastNorth; … … 76 75 import org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel; 77 76 import org.openstreetmap.josm.gui.mappaint.styleelement.placement.PositionForAreaStrategy; 77 import org.openstreetmap.josm.spi.preferences.Config; 78 78 import org.openstreetmap.josm.tools.CompositeList; 79 79 import org.openstreetmap.josm.tools.Geometry; 80 80 import org.openstreetmap.josm.tools.Geometry.AreaAndPerimeter; 81 import org.openstreetmap.josm.tools.HiDPISupport; 81 82 import org.openstreetmap.josm.tools.ImageProvider; 82 83 import org.openstreetmap.josm.tools.JosmRuntimeException; 83 84 import org.openstreetmap.josm.tools.Logging; 84 import org.openstreetmap.josm.tools.HiDPISupport;85 85 import org.openstreetmap.josm.tools.Utils; 86 86 import org.openstreetmap.josm.tools.bugreport.BugReport; … … 236 236 if (cached != null) 237 237 return cached; 238 String overridePref = Main.pref.get("glyph-bug", "auto");238 String overridePref = Config.getPref().get("glyph-bug", "auto"); 239 239 if ("auto".equals(overridePref)) { 240 240 FontRenderContext frc = new FontRenderContext(null, false, false); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
r12809 r12846 16 16 import java.util.List; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.Bounds; 20 19 import org.openstreetmap.josm.data.osm.BBox; … … 31 30 import org.openstreetmap.josm.gui.NavigatableComponent; 32 31 import org.openstreetmap.josm.gui.draw.MapPath2D; 32 import org.openstreetmap.josm.spi.preferences.Config; 33 33 import org.openstreetmap.josm.tools.Utils; 34 34 … … 147 147 148 148 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, 149 Main.pref.getBoolean("mappaint.wireframe.use-antialiasing", false) ?149 Config.getPref().getBoolean("mappaint.wireframe.use-antialiasing", false) ? 150 150 RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); 151 151 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r12841 r12846 28 28 import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon.PolyData.Intersection; 29 29 import org.openstreetmap.josm.data.projection.Projection; 30 import org.openstreetmap.josm.spi.preferences.Config; 30 31 import org.openstreetmap.josm.tools.Geometry; 31 32 import org.openstreetmap.josm.tools.Geometry.AreaAndPerimeter; … … 96 97 private void initFromPreferences() { 97 98 initDefaults(); 98 if ( Main.pref== null) return;99 if (Config.getPref() == null) return; 99 100 Collection<String> literals; 100 literals = Main.pref.getList(PREF_KEY_OUTER_ROLES);101 literals = Config.getPref().getList(PREF_KEY_OUTER_ROLES); 101 102 if (literals != null && !literals.isEmpty()) { 102 103 setNormalized(literals, outerExactRoles); 103 104 } 104 literals = Main.pref.getList(PREF_KEY_OUTER_ROLE_PREFIXES);105 literals = Config.getPref().getList(PREF_KEY_OUTER_ROLE_PREFIXES); 105 106 if (literals != null && !literals.isEmpty()) { 106 107 setNormalized(literals, outerRolePrefixes); 107 108 } 108 literals = Main.pref.getList(PREF_KEY_INNER_ROLES);109 literals = Config.getPref().getList(PREF_KEY_INNER_ROLES); 109 110 if (literals != null && !literals.isEmpty()) { 110 111 setNormalized(literals, innerExactRoles); 111 112 } 112 literals = Main.pref.getList(PREF_KEY_INNER_ROLE_PREFIXES);113 literals = Config.getPref().getList(PREF_KEY_INNER_ROLE_PREFIXES); 113 114 if (literals != null && !literals.isEmpty()) { 114 115 setNormalized(literals, innerRolePrefixes); … … 157 158 if (roleMatcher == null) { 158 159 roleMatcher = new MultipolygonRoleMatcher(); 159 if ( Main.pref!= null) {160 if (Config.getPref() != null) { 160 161 roleMatcher.initFromPreferences(); 161 Main.pref.addPreferenceChangeListener(roleMatcher);162 Config.getPref().addPreferenceChangeListener(roleMatcher); 162 163 } 163 164 } -
trunk/src/org/openstreetmap/josm/data/preferences/CachedProperty.java
r12385 r12846 2 2 package org.openstreetmap.josm.data.preferences; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 6 5 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 6 import org.openstreetmap.josm.spi.preferences.Config; 7 7 8 8 /** … … 21 21 protected CachedProperty(String key, String defaultValueAsString) { 22 22 super(key, null); 23 Main.pref.addKeyPreferenceChangeListener(key, this);23 Config.getPref().addKeyPreferenceChangeListener(key, this); 24 24 this.defaultValueAsString = defaultValueAsString; 25 25 updateValue(); … … 27 27 28 28 protected final void updateValue() { 29 if (! Main.pref.get(key).isEmpty()) {30 this.value = fromString( Main.pref.get(key));29 if (!Config.getPref().get(key).isEmpty()) { 30 this.value = fromString(Config.getPref().get(key)); 31 31 } else { 32 32 this.value = getDefaultValue(); … … 43 43 44 44 public void put(String value) { 45 Main.pref.put(key, value);45 Config.getPref().put(key, value); 46 46 this.value = fromString(value); 47 47 updateCount++; -
trunk/src/org/openstreetmap/josm/data/preferences/ParametrizedEnumProperty.java
r12620 r12846 2 2 package org.openstreetmap.josm.data.preferences; 3 3 4 import org.openstreetmap.josm. Main;4 import org.openstreetmap.josm.spi.preferences.Config; 5 5 import org.openstreetmap.josm.tools.Logging; 6 6 … … 23 23 24 24 public T get(String... params) { 25 return parse( Main.pref.get(getKey(params), defaultValue.name()));25 return parse(Config.getPref().get(getKey(params), defaultValue.name())); 26 26 } 27 27 28 28 public boolean put(T value, String... params) { 29 return Main.pref.put(getKey(params), value.name());29 return Config.getPref().put(getKey(params), value.name()); 30 30 } 31 31 -
trunk/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java
r12841 r12846 13 13 import java.util.TreeSet; 14 14 15 import org.openstreetmap.josm. Main;15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 import org.openstreetmap.josm.tools.Utils; 17 17 … … 53 53 boolean changed = false; 54 54 55 Collection<String> knownDefaults = new TreeSet<>( Main.pref.getList("mappaint.style.known-defaults"));55 Collection<String> knownDefaults = new TreeSet<>(Config.getPref().getList("mappaint.style.known-defaults")); 56 56 57 57 Collection<ExtendedSourceEntry> defaults = getDefault(); … … 71 71 knownDefaults.add(def.url); 72 72 } 73 Main.pref.putList("mappaint.style.known-defaults", new ArrayList<>(knownDefaults));73 Config.getPref().putList("mappaint.style.known-defaults", new ArrayList<>(knownDefaults)); 74 74 75 75 // XML style is not bundled anymore -
trunk/src/org/openstreetmap/josm/data/preferences/sources/SourcePrefHelper.java
r12841 r12846 10 10 import java.util.Set; 11 11 12 import org.openstreetmap.josm. Main;12 import org.openstreetmap.josm.spi.preferences.Config; 13 13 14 14 /** … … 58 58 public List<SourceEntry> get() { 59 59 60 List<Map<String, String>> src = Main.pref.getListOfMaps(pref, null);60 List<Map<String, String>> src = Config.getPref().getListOfMaps(pref, null); 61 61 if (src == null) 62 62 return new ArrayList<>(getDefault()); … … 79 79 public boolean put(Collection<? extends SourceEntry> entries) { 80 80 List<Map<String, String>> setting = serializeList(entries); 81 boolean unset = Main.pref.getListOfMaps(pref, null) == null;81 boolean unset = Config.getPref().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.putListOfMaps(pref, setting);87 return Config.getPref().putListOfMaps(pref, setting); 88 88 } 89 89 -
trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
r12795 r12846 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import gnu.getopt.Getopt;7 import gnu.getopt.LongOpt;8 5 9 6 import java.io.BufferedReader; … … 18 15 import java.util.function.Function; 19 16 17 import org.openstreetmap.josm.CLIModule; 20 18 import org.openstreetmap.josm.data.coor.EastNorth; 21 19 import org.openstreetmap.josm.data.coor.LatLon; 22 import org.openstreetmap.josm.CLIModule;23 20 import org.openstreetmap.josm.data.coor.conversion.LatLonParser; 24 25 21 import org.openstreetmap.josm.tools.Utils; 22 23 import gnu.getopt.Getopt; 24 import gnu.getopt.LongOpt; 26 25 27 26 /** -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r12841 r12846 66 66 import org.openstreetmap.josm.gui.layer.ValidatorLayer; 67 67 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 68 import org.openstreetmap.josm.spi.preferences.Config; 68 69 import org.openstreetmap.josm.tools.AlphanumComparator; 69 70 import org.openstreetmap.josm.tools.Logging; … … 282 283 283 284 private static void applyPrefs(Map<String, Test> tests, boolean beforeUpload) { 284 for (String testName : Main.pref.getList(beforeUpload285 for (String testName : Config.getPref().getList(beforeUpload 285 286 ? ValidatorPrefHelper.PREF_SKIP_TESTS_BEFORE_UPLOAD : ValidatorPrefHelper.PREF_SKIP_TESTS)) { 286 287 Test test = tests.get(testName); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r12620 r12846 15 15 import java.util.Set; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.coor.EastNorth; 19 18 import org.openstreetmap.josm.data.osm.Node; … … 25 24 import org.openstreetmap.josm.data.validation.Test; 26 25 import org.openstreetmap.josm.data.validation.TestError; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.Geometry; 28 28 import org.openstreetmap.josm.tools.Logging; … … 205 205 } 206 206 if (centroid == null) return; // fix #8305 207 double maxDistance = Main.pref.getDouble("validator.addresses.max_street_distance", 200.0);207 double maxDistance = Config.getPref().getDouble("validator.addresses.max_street_distance", 200.0); 208 208 boolean hasIncompleteWays = false; 209 209 for (Way streetPart : street) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r12689 r12846 20 20 import java.util.Set; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.actions.MergeNodesAction; 24 23 import org.openstreetmap.josm.command.Command; … … 35 34 import org.openstreetmap.josm.data.validation.TestError; 36 35 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 36 import org.openstreetmap.josm.spi.preferences.Config; 37 37 import org.openstreetmap.josm.tools.MultiMap; 38 38 … … 46 46 private static class NodeHash implements Hash<Object, Object> { 47 47 48 private final double precision = Main.pref.getDouble("validator.duplicatenodes.precision", 0.);48 private final double precision = Config.getPref().getDouble("validator.duplicatenodes.precision", 0.); 49 49 50 50 private LatLon roundCoord(LatLon coor) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java
r12841 r12846 9 9 import java.util.Set; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.coor.LatLon; 13 12 import org.openstreetmap.josm.data.osm.Node; … … 19 18 import org.openstreetmap.josm.data.validation.TestError; 20 19 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 20 import org.openstreetmap.josm.spi.preferences.Config; 21 21 22 22 /** … … 112 112 public void startTest(ProgressMonitor monitor) { 113 113 super.startTest(monitor); 114 maxlength = Main.pref.getInt("validator.maximum.segment.length", 15_000);114 maxlength = Config.getPref().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/MapCSSTagChecker.java
r12825 r12846 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.FixCommand.evaluateObject; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 63 64 import org.openstreetmap.josm.io.IllegalDataException; 64 65 import org.openstreetmap.josm.io.UTFInputStreamReader; 66 import org.openstreetmap.josm.spi.preferences.Config; 65 67 import org.openstreetmap.josm.tools.CheckParameterUtil; 66 68 import org.openstreetmap.josm.tools.Logging; … … 735 737 checks.putAll(url, result.parseChecks); 736 738 // Check assertions, useful for development of local files 737 if ( Main.pref.getBoolean("validator.check_assert_local_rules", false) && Utils.isLocalUrl(url)) {739 if (Config.getPref().getBoolean("validator.check_assert_local_rules", false) && Utils.isLocalUrl(url)) { 738 740 for (String msg : checkAsserts(result.parseChecks)) { 739 741 Logging.warn(msg); … … 759 761 } 760 762 addMapCSS(i); 761 if ( Main.pref.getBoolean("validator.auto_reload_local_rules", true) && source.isLocal()) {763 if (Config.getPref().getBoolean("validator.auto_reload_local_rules", true) && source.isLocal()) { 762 764 Main.fileWatcher.registerSource(source); 763 765 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r12841 r12846 26 26 import javax.swing.JPanel; 27 27 28 import org.openstreetmap.josm.Main;29 28 import org.openstreetmap.josm.command.ChangePropertyCommand; 30 29 import org.openstreetmap.josm.command.ChangePropertyKeyCommand; … … 49 48 import org.openstreetmap.josm.gui.widgets.EditableList; 50 49 import org.openstreetmap.josm.io.CachedFile; 50 import org.openstreetmap.josm.spi.preferences.Config; 51 51 import org.openstreetmap.josm.tools.GBC; 52 52 import org.openstreetmap.josm.tools.Logging; … … 190 190 191 191 StringBuilder errorSources = new StringBuilder(); 192 for (String source : Main.pref.getList(PREF_SOURCES, DEFAULT_SOURCES)) {192 for (String source : Config.getPref().getList(PREF_SOURCES, DEFAULT_SOURCES)) { 193 193 try ( 194 194 CachedFile cf = new CachedFile(source); … … 282 282 public static void initializePresets() { 283 283 284 if (! Main.pref.getBoolean(PREF_CHECK_VALUES, true))284 if (!Config.getPref().getBoolean(PREF_CHECK_VALUES, true)) 285 285 return; 286 286 … … 292 292 } 293 293 // TODO directionKeys are no longer in OsmPrimitive (search pattern is used instead) 294 for (String a : Main.pref.getList(ValidatorPrefHelper.PREFIX + ".knownkeys",294 for (String a : Config.getPref().getList(ValidatorPrefHelper.PREFIX + ".knownkeys", 295 295 Arrays.asList("is_in", "int_ref", "fixme", "population"))) { 296 296 additionalPresetsValueData.putVoid(a); … … 584 584 public void startTest(ProgressMonitor monitor) { 585 585 super.startTest(monitor); 586 checkKeys = Main.pref.getBoolean(PREF_CHECK_KEYS, true);586 checkKeys = Config.getPref().getBoolean(PREF_CHECK_KEYS, true); 587 587 if (isBeforeUpload) { 588 checkKeys = checkKeys && Main.pref.getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true);589 } 590 591 checkValues = Main.pref.getBoolean(PREF_CHECK_VALUES, true);588 checkKeys = checkKeys && Config.getPref().getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true); 589 } 590 591 checkValues = Config.getPref().getBoolean(PREF_CHECK_VALUES, true); 592 592 if (isBeforeUpload) { 593 checkValues = checkValues && Main.pref.getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true);594 } 595 596 checkComplex = Main.pref.getBoolean(PREF_CHECK_COMPLEX, true);593 checkValues = checkValues && Config.getPref().getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true); 594 } 595 596 checkComplex = Config.getPref().getBoolean(PREF_CHECK_COMPLEX, true); 597 597 if (isBeforeUpload) { 598 checkComplex = checkComplex && Main.pref.getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true);599 } 600 601 checkFixmes = Main.pref.getBoolean(PREF_CHECK_FIXMES, true);598 checkComplex = checkComplex && Config.getPref().getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true); 599 } 600 601 checkFixmes = Config.getPref().getBoolean(PREF_CHECK_FIXMES, true); 602 602 if (isBeforeUpload) { 603 checkFixmes = checkFixmes && Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true);603 checkFixmes = checkFixmes && Config.getPref().getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true); 604 604 } 605 605 } … … 619 619 testPanel.add(new JLabel(name+" :"), GBC.eol().insets(3, 0, 0, 0)); 620 620 621 prefCheckKeys = new JCheckBox(tr("Check property keys."), Main.pref.getBoolean(PREF_CHECK_KEYS, true));621 prefCheckKeys = new JCheckBox(tr("Check property keys."), Config.getPref().getBoolean(PREF_CHECK_KEYS, true)); 622 622 prefCheckKeys.setToolTipText(tr("Validate that property keys are valid checking against list of words.")); 623 623 testPanel.add(prefCheckKeys, GBC.std().insets(20, 0, 0, 0)); 624 624 625 625 prefCheckKeysBeforeUpload = new JCheckBox(); 626 prefCheckKeysBeforeUpload.setSelected( Main.pref.getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true));626 prefCheckKeysBeforeUpload.setSelected(Config.getPref().getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true)); 627 627 testPanel.add(prefCheckKeysBeforeUpload, a); 628 628 629 prefCheckComplex = new JCheckBox(tr("Use complex property checker."), Main.pref.getBoolean(PREF_CHECK_COMPLEX, true));629 prefCheckComplex = new JCheckBox(tr("Use complex property checker."), Config.getPref().getBoolean(PREF_CHECK_COMPLEX, true)); 630 630 prefCheckComplex.setToolTipText(tr("Validate property values and tags using complex rules.")); 631 631 testPanel.add(prefCheckComplex, GBC.std().insets(20, 0, 0, 0)); 632 632 633 633 prefCheckComplexBeforeUpload = new JCheckBox(); 634 prefCheckComplexBeforeUpload.setSelected( Main.pref.getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true));634 prefCheckComplexBeforeUpload.setSelected(Config.getPref().getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true)); 635 635 testPanel.add(prefCheckComplexBeforeUpload, a); 636 636 637 final Collection<String> sources = Main.pref.getList(PREF_SOURCES, DEFAULT_SOURCES);637 final Collection<String> sources = Config.getPref().getList(PREF_SOURCES, DEFAULT_SOURCES); 638 638 sourcesList = new EditableList(tr("TagChecker source")); 639 639 sourcesList.setItems(sources); … … 649 649 handlePrefEnable(); 650 650 651 prefCheckValues = new JCheckBox(tr("Check property values."), Main.pref.getBoolean(PREF_CHECK_VALUES, true));651 prefCheckValues = new JCheckBox(tr("Check property values."), Config.getPref().getBoolean(PREF_CHECK_VALUES, true)); 652 652 prefCheckValues.setToolTipText(tr("Validate that property values are valid checking against presets.")); 653 653 testPanel.add(prefCheckValues, GBC.std().insets(20, 0, 0, 0)); 654 654 655 655 prefCheckValuesBeforeUpload = new JCheckBox(); 656 prefCheckValuesBeforeUpload.setSelected( Main.pref.getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true));656 prefCheckValuesBeforeUpload.setSelected(Config.getPref().getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true)); 657 657 testPanel.add(prefCheckValuesBeforeUpload, a); 658 658 659 prefCheckFixmes = new JCheckBox(tr("Check for FIXMES."), Main.pref.getBoolean(PREF_CHECK_FIXMES, true));659 prefCheckFixmes = new JCheckBox(tr("Check for FIXMES."), Config.getPref().getBoolean(PREF_CHECK_FIXMES, true)); 660 660 prefCheckFixmes.setToolTipText(tr("Looks for nodes or ways with FIXME in any property value.")); 661 661 testPanel.add(prefCheckFixmes, GBC.std().insets(20, 0, 0, 0)); 662 662 663 663 prefCheckFixmesBeforeUpload = new JCheckBox(); 664 prefCheckFixmesBeforeUpload.setSelected( Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true));664 prefCheckFixmesBeforeUpload.setSelected(Config.getPref().getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true)); 665 665 testPanel.add(prefCheckFixmesBeforeUpload, a); 666 666 } … … 681 681 || prefCheckFixmesBeforeUpload.isSelected() || prefCheckComplexBeforeUpload.isSelected(); 682 682 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());683 Config.getPref().putBoolean(PREF_CHECK_VALUES, prefCheckValues.isSelected()); 684 Config.getPref().putBoolean(PREF_CHECK_COMPLEX, prefCheckComplex.isSelected()); 685 Config.getPref().putBoolean(PREF_CHECK_KEYS, prefCheckKeys.isSelected()); 686 Config.getPref().putBoolean(PREF_CHECK_FIXMES, prefCheckFixmes.isSelected()); 687 Config.getPref().putBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, prefCheckValuesBeforeUpload.isSelected()); 688 Config.getPref().putBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, prefCheckComplexBeforeUpload.isSelected()); 689 Config.getPref().putBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, prefCheckKeysBeforeUpload.isSelected()); 690 Config.getPref().putBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, prefCheckFixmesBeforeUpload.isSelected()); 691 return Config.getPref().putList(PREF_SOURCES, sourcesList.getItems()); 692 692 } 693 693 -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r12726 r12846 33 33 import org.openstreetmap.josm.data.validation.TestError; 34 34 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 35 import org.openstreetmap.josm.spi.preferences.Config; 35 36 import org.openstreetmap.josm.tools.Logging; 36 37 … … 166 167 middlenodes = new QuadBuckets<>(); 167 168 othernodes = new HashSet<>(); 168 mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0);169 minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0);169 mindist = Config.getPref().getDouble(PREFIX + ".node_way_distance", 10.0); 170 minmiddledist = Config.getPref().getDouble(PREFIX + ".way_way_distance", 0.0); 170 171 DataSet dataSet = Main.main != null ? Main.main.getEditDataSet() : null; 171 172 dsArea = dataSet == null ? null : dataSet.getDataSourceArea(); -
trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
r12841 r12846 17 17 import javax.swing.JRadioButton; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 20 import org.openstreetmap.josm.spi.preferences.Config; 21 21 import org.openstreetmap.josm.tools.GBC; 22 22 import org.openstreetmap.josm.tools.Utils; … … 57 57 */ 58 58 public static int getDialogReturnValue(String prefKey) { 59 return Utils.firstNonNull( 60 immediateChoices.get(prefKey), 59 return Utils.firstNonNull(immediateChoices.get(prefKey), 61 60 sessionChoices.get(prefKey), 62 ! Main.pref.getBoolean("message." + prefKey, true) ? Main.pref.getInt("message." + prefKey + ".value", -1) : -161 !Config.getPref().getBoolean("message." + prefKey, true) ? Config.getPref().getInt("message." + prefKey + ".value", -1) : -1 63 62 ); 64 63 } … … 239 238 break; 240 239 case PERMANENT: 241 Main.pref.putBoolean("message." + prefKey, false);242 Main.pref.putInt("message." + prefKey + ".value", value);240 Config.getPref().putBoolean("message." + prefKey, false); 241 Config.getPref().putInt("message." + prefKey + ".value", value); 243 242 break; 244 243 } -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r12841 r12846 29 29 import org.openstreetmap.josm.io.CacheCustomContent; 30 30 import org.openstreetmap.josm.io.OnlineResource; 31 import org.openstreetmap.josm.spi.preferences.Config; 31 32 import org.openstreetmap.josm.tools.LanguageInfo; 32 33 import org.openstreetmap.josm.tools.Logging; … … 95 96 String motd = new WikiReader().readLang("StartupPage"); 96 97 // Save this to prefs in case JOSM is updated so MOTD can be refreshed 97 Main.pref.putInt("cache.motd.html.version", myVersion);98 Main.pref.put("cache.motd.html.java", myJava);99 Main.pref.put("cache.motd.html.lang", myLang);98 Config.getPref().putInt("cache.motd.html.version", myVersion); 99 Config.getPref().put("cache.motd.html.java", myJava); 100 Config.getPref().put("cache.motd.html.lang", myLang); 100 101 return motd.getBytes(StandardCharsets.UTF_8); 101 102 } … … 115 116 // 2. Cannot be written (e.g. while developing). Obviously we don't want to update 116 117 // everytime because of something we can't read. 117 return ( Main.pref.getInt("cache.motd.html.version", -999) == myVersion)118 && Main.pref.get("cache.motd.html.java").equals(myJava)119 && Main.pref.get("cache.motd.html.lang").equals(myLang);118 return (Config.getPref().getInt("cache.motd.html.version", -999) == myVersion) 119 && Config.getPref().get("cache.motd.html.java").equals(myJava) 120 && Config.getPref().get("cache.motd.html.lang").equals(myLang); 120 121 } 121 122 } … … 146 147 // Asynchronously get MOTD to speed-up JOSM startup 147 148 Thread t = new Thread((Runnable) () -> { 148 if (!contentInitialized && Main.pref.getBoolean("help.displaymotd", true)) {149 if (!contentInitialized && Config.getPref().getBoolean("help.displaymotd", true)) { 149 150 try { 150 151 content = new MotdContent().updateIfRequiredString(); -
trunk/src/org/openstreetmap/josm/gui/IconToggleButton.java
r12841 r12846 10 10 import javax.swing.JToggleButton; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.ExpertToggleAction; 14 13 import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener; 14 import org.openstreetmap.josm.spi.preferences.Config; 15 15 import org.openstreetmap.josm.tools.CheckParameterUtil; 16 16 import org.openstreetmap.josm.tools.Destroyable; … … 93 93 @Override 94 94 public void applyButtonHiddenPreferences() { 95 boolean alwaysHideDisabled = Main.pref.getBoolean("sidetoolbar.hideDisabledButtons", false);95 boolean alwaysHideDisabled = Config.getPref().getBoolean("sidetoolbar.hideDisabledButtons", false); 96 96 if (!isEnabled() && (hideIfDisabled || alwaysHideDisabled)) { 97 97 setVisible(false); // hide because of disabled button 98 98 } else { 99 99 boolean hiddenFlag = false; 100 String hiddenFlagStr = Main.pref.get(getPreferenceKey(), null);100 String hiddenFlagStr = Config.getPref().get(getPreferenceKey(), null); 101 101 if (hiddenFlagStr == null) { 102 102 if (isExpert && !ExpertToggleAction.isExpert()) { … … 118 118 if ((b && isExpert && !ExpertToggleAction.isExpert()) || 119 119 (!b && isExpert && ExpertToggleAction.isExpert())) { 120 Main.pref.put(getPreferenceKey(), null);120 Config.getPref().put(getPreferenceKey(), null); 121 121 } else { 122 Main.pref.putBoolean(getPreferenceKey(), b);122 Config.getPref().putBoolean(getPreferenceKey(), b); 123 123 } 124 124 } -
trunk/src/org/openstreetmap/josm/gui/MainFrame.java
r12841 r12846 20 20 import javax.swing.JPanel; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 24 23 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; … … 28 27 import org.openstreetmap.josm.gui.layer.OsmDataLayer.LayerStateChangeListener; 29 28 import org.openstreetmap.josm.gui.util.WindowGeometry; 29 import org.openstreetmap.josm.spi.preferences.Config; 30 30 import org.openstreetmap.josm.tools.ImageProvider; 31 31 import org.openstreetmap.josm.tools.Logging; … … 110 110 geometry.remember("gui.geometry"); 111 111 } 112 Main.pref.putBoolean("gui.maximized", (windowState & JFrame.MAXIMIZED_BOTH) != 0);112 Config.getPref().putBoolean("gui.maximized", (windowState & JFrame.MAXIMIZED_BOTH) != 0); 113 113 } 114 114 -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r12834 r12846 122 122 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 123 123 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSearchPrimitiveDialog; 124 import org.openstreetmap.josm.spi.preferences.Config; 124 125 import org.openstreetmap.josm.tools.Shortcut; 125 126 … … 799 800 changesetManager.addButtonModel(mi.getModel()); 800 801 801 if (! Main.pref.getBoolean("audio.menuinvisible", false)) {802 if (!Config.getPref().getBoolean("audio.menuinvisible", false)) { 802 803 showAudioMenu(true); 803 804 } 804 805 805 Main.pref.addPreferenceChangeListener(e -> {806 Config.getPref().addPreferenceChangeListener(e -> { 806 807 if ("audio.menuinvisible".equals(e.getKey())) { 807 808 showAudioMenu(!Boolean.parseBoolean(e.getNewValue().toString())); -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r12841 r12846 42 42 import javax.swing.plaf.basic.BasicSplitPaneUI; 43 43 44 import org.openstreetmap.josm.Main;45 44 import org.openstreetmap.josm.actions.LassoModeAction; 46 45 import org.openstreetmap.josm.actions.mapmode.DeleteAction; … … 80 79 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 81 80 import org.openstreetmap.josm.gui.util.AdvancedKeyPressDetector; 81 import org.openstreetmap.josm.spi.preferences.Config; 82 82 import org.openstreetmap.josm.tools.Destroyable; 83 83 import org.openstreetmap.josm.tools.GBC; … … 295 295 } 296 296 297 if ( Main.pref.getBoolean("debug.advanced-keypress-detector.enable", true)) {297 if (Config.getPref().getBoolean("debug.advanced-keypress-detector.enable", true)) { 298 298 keyDetector.register(); 299 299 } … … 345 345 MainApplication.getLayerManager().removeActiveLayerChangeListener(this); 346 346 dialogsPanel.destroy(); 347 Main.pref.removePreferenceChangeListener(sidetoolbarPreferencesChangedListener);347 Config.getPref().removePreferenceChangeListener(sidetoolbarPreferencesChangedListener); 348 348 for (int i = 0; i < toolBarActions.getComponentCount(); ++i) { 349 349 if (toolBarActions.getComponent(i) instanceof Destroyable) { … … 496 496 * sideToolBar: add map modes icons 497 497 */ 498 if ( Main.pref.getBoolean("sidetoolbar.mapmodes.visible", true)) {498 if (Config.getPref().getBoolean("sidetoolbar.mapmodes.visible", true)) { 499 499 toolBarActions.setAlignmentX(0.5f); 500 500 toolBarActions.setBorder(null); … … 511 511 * sideToolBar: add toggle dialogs icons 512 512 */ 513 if ( Main.pref.getBoolean("sidetoolbar.toggledialogs.visible", true)) {513 if (Config.getPref().getBoolean("sidetoolbar.toggledialogs.visible", true)) { 514 514 ((JToolBar) sideToolBar).addSeparator(new Dimension(0, 18)); 515 515 toolBarToggle.setAlignmentX(0.5f); … … 534 534 * sideToolBar: decide scroll- and visibility 535 535 */ 536 if ( Main.pref.getBoolean("sidetoolbar.scrollable", true)) {536 if (Config.getPref().getBoolean("sidetoolbar.scrollable", true)) { 537 537 final ScrollViewport svp = new ScrollViewport(sideToolBar, ScrollViewport.VERTICAL_DIRECTION); 538 538 sideToolBar = svp; 539 539 } 540 sideToolBar.setVisible( Main.pref.getBoolean("sidetoolbar.visible", true));540 sideToolBar.setVisible(Config.getPref().getBoolean("sidetoolbar.visible", true)); 541 541 sidetoolbarPreferencesChangedListener = e -> { 542 542 if ("sidetoolbar.visible".equals(e.getKey())) { 543 sideToolBar.setVisible( Main.pref.getBoolean("sidetoolbar.visible"));543 sideToolBar.setVisible(Config.getPref().getBoolean("sidetoolbar.visible")); 544 544 } 545 545 }; 546 Main.pref.addPreferenceChangeListener(sidetoolbarPreferencesChangedListener);546 Config.getPref().addPreferenceChangeListener(sidetoolbarPreferencesChangedListener); 547 547 548 548 /** … … 554 554 * statusLine: add to panel 555 555 */ 556 if (statusLine != null && Main.pref.getBoolean("statusline.visible", true)) {556 if (statusLine != null && Config.getPref().getBoolean("statusline.visible", true)) { 557 557 panel.add(statusLine, BorderLayout.SOUTH); 558 558 } … … 583 583 public void actionPerformed(ActionEvent e) { 584 584 boolean sel = ((JCheckBoxMenuItem) e.getSource()).getState(); 585 Main.pref.putBoolean("sidetoolbar.always-visible", sel);585 Config.getPref().putBoolean("sidetoolbar.always-visible", sel); 586 586 } 587 587 }); … … 606 606 }, 0); 607 607 } 608 doNotHide.setSelected( Main.pref.getBoolean("sidetoolbar.always-visible", true));608 doNotHide.setSelected(Config.getPref().getBoolean("sidetoolbar.always-visible", true)); 609 609 } 610 610 … … 625 625 @Override 626 626 public void actionPerformed(ActionEvent e) { 627 Main.pref.putBoolean("sidetoolbar.visible", false);627 Config.getPref().putBoolean("sidetoolbar.visible", false); 628 628 } 629 629 }); -
trunk/src/org/openstreetmap/josm/gui/MapMover.java
r12639 r12846 24 24 import org.openstreetmap.josm.data.preferences.BooleanProperty; 25 25 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; 26 import org.openstreetmap.josm.spi.preferences.Config; 26 27 import org.openstreetmap.josm.tools.Destroyable; 27 28 import org.openstreetmap.josm.tools.Pair; … … 48 49 49 50 JMapViewerUpdater() { 50 Main.pref.addPreferenceChangeListener(this);51 Config.getPref().addPreferenceChangeListener(this); 51 52 updateJMapViewer(); 52 53 } -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r12841 r12846 79 79 import org.openstreetmap.josm.gui.widgets.ImageLabel; 80 80 import org.openstreetmap.josm.gui.widgets.JosmTextField; 81 import org.openstreetmap.josm.spi.preferences.Config; 81 82 import org.openstreetmap.josm.tools.Destroyable; 82 83 import org.openstreetmap.josm.tools.GBC; … … 100 101 public final class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener { 101 102 102 private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat( Main.pref.get("statusbar.decimal-format", "0.0"));103 private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(Config.getPref().get("statusbar.decimal-format", "0.0")); 103 104 private static final AbstractProperty<Double> DISTANCE_THRESHOLD = new DoubleProperty("statusbar.distance-threshold", 0.01).cached(); 104 105 … … 775 776 public void actionPerformed(ActionEvent e) { 776 777 boolean sel = ((JCheckBoxMenuItem) e.getSource()).getState(); 777 Main.pref.putBoolean("statusbar.always-visible", sel);778 Config.getPref().putBoolean("statusbar.always-visible", sel); 778 779 } 779 780 }); … … 820 821 } 821 822 separator.setVisible(distText.equals(invoker) || latText.equals(invoker) || lonText.equals(invoker)); 822 doNotHide.setSelected( Main.pref.getBoolean("statusbar.always-visible", true));823 doNotHide.setSelected(Config.getPref().getBoolean("statusbar.always-visible", true)); 823 824 } 824 825 … … 914 915 add(distText, GBC.std().insets(3, 0, 0, 0)); 915 916 916 if ( Main.pref.getBoolean("statusbar.change-system-of-measurement-on-click", true)) {917 if (Config.getPref().getBoolean("statusbar.change-system-of-measurement-on-click", true)) { 917 918 distText.addMouseListener(new MouseAdapter() { 918 919 private final List<String> soms = new ArrayList<>(new TreeSet<>(SystemOfMeasurement.ALL_SYSTEMS.keySet())); … … 945 946 progressBar.addMouseListener(new ShowMonitorDialogMouseAdapter()); 946 947 947 Main.pref.addPreferenceChangeListener(this);948 Config.getPref().addPreferenceChangeListener(this); 948 949 949 950 mvComponentAdapter = new ComponentAdapter() { … … 974 975 public void updateSystemOfMeasurement(String newsom) { 975 976 SystemOfMeasurement.setSystemOfMeasurement(newsom); 976 if ( Main.pref.getBoolean("statusbar.notify.change-system-of-measurement", true)) {977 if (Config.getPref().getBoolean("statusbar.notify.change-system-of-measurement", true)) { 977 978 new Notification(tr("System of measurement changed to {0}", newsom)) 978 979 .setDuration(Notification.TIME_SHORT) … … 1079 1080 // Compute total length of selected way(s) until an arbitrary limit set to 250 ways 1080 1081 // 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("selection.max-ways-for-statusline", 250));1082 int maxWays = Math.max(1, Config.getPref().getInt("selection.max-ways-for-statusline", 250)); 1082 1083 if (!ways.isEmpty() && ways.size() <= maxWays) { 1083 1084 dist = 0.0; … … 1106 1107 public void destroy() { 1107 1108 SystemOfMeasurement.removeSoMChangeListener(this); 1108 Main.pref.removePreferenceChangeListener(this);1109 Config.getPref().removePreferenceChangeListener(this); 1109 1110 mv.removeComponentListener(mvComponentAdapter); 1110 1111 -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r12722 r12846 76 76 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener; 77 77 import org.openstreetmap.josm.io.audio.AudioPlayer; 78 import org.openstreetmap.josm.spi.preferences.Config; 78 79 import org.openstreetmap.josm.tools.JosmRuntimeException; 79 80 import org.openstreetmap.josm.tools.Logging; … … 277 278 layerManager.addAndFireLayerChangeListener(this); 278 279 layerManager.addActiveLayerChangeListener(this); 279 Main.pref.addPreferenceChangeListener(this);280 Config.getPref().addPreferenceChangeListener(this); 280 281 281 282 addComponentListener(new ComponentAdapter() { … … 813 814 layerManager.removeAndFireLayerChangeListener(this); 814 815 layerManager.removeActiveLayerChangeListener(this); 815 Main.pref.removePreferenceChangeListener(this);816 Config.getPref().removePreferenceChangeListener(this); 816 817 SelectionEventManager.getInstance().removeSelectionListener(repaintSelectionChangedListener); 817 818 MultipolygonCache.getInstance().clear(); -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r12841 r12846 60 60 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 61 61 import org.openstreetmap.josm.gui.util.CursorManager; 62 import org.openstreetmap.josm.spi.preferences.Config; 62 63 import org.openstreetmap.josm.tools.Logging; 63 64 import org.openstreetmap.josm.tools.Utils; … … 869 870 private void pushZoomUndo(EastNorth center, double scale) { 870 871 Date now = new Date(); 871 if ((now.getTime() - zoomTimestamp.getTime()) > ( Main.pref.getDouble("zoom.undo.delay", 1.0) * 1000)) {872 if ((now.getTime() - zoomTimestamp.getTime()) > (Config.getPref().getDouble("zoom.undo.delay", 1.0) * 1000)) { 872 873 zoomUndoBuffer.push(new ZoomData(center, scale)); 873 if (zoomUndoBuffer.size() > Main.pref.getInt("zoom.undo.max", 50)) {874 if (zoomUndoBuffer.size() > Config.getPref().getInt("zoom.undo.max", 50)) { 874 875 zoomUndoBuffer.remove(0); 875 876 } … … 1144 1145 1145 1146 if (ds != null) { 1146 double snapDistanceSq = Main.pref.getInt("mappaint.segment.snap-distance", 10);1147 double snapDistanceSq = Config.getPref().getInt("mappaint.segment.snap-distance", 10); 1147 1148 snapDistanceSq *= snapDistanceSq; 1148 1149 1149 for (Way w : ds.searchWays(getBBox(p, Main.pref.getInt("mappaint.segment.snap-distance", 10)))) {1150 for (Way w : ds.searchWays(getBBox(p, Config.getPref().getInt("mappaint.segment.snap-distance", 10)))) { 1150 1151 if (!predicate.test(w)) { 1151 1152 continue; -
trunk/src/org/openstreetmap/josm/gui/Notification.java
r12841 r12846 10 10 import javax.swing.UIManager; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 13 import org.openstreetmap.josm.spi.preferences.Config; 14 14 15 15 /** … … 43 43 * E.g. "Please select at least one node". 44 44 */ 45 public static final int TIME_SHORT = Main.pref.getInt("notification-time-short-ms", 3000);45 public static final int TIME_SHORT = Config.getPref().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("notification-time-default-ms", 5000);50 public static final int TIME_DEFAULT = Config.getPref().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("notification-time-long-ms", 10_000);55 public static final int TIME_LONG = Config.getPref().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("notification-time-very_long-ms", 20_000);61 public static final int TIME_VERY_LONG = Config.getPref().getInt("notification-time-very_long-ms", 20_000); 62 62 63 63 private Component content; -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
r12841 r12846 20 20 import javax.swing.UIManager; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor.ProgressMonitorDialog; 24 23 import org.openstreetmap.josm.gui.util.GuiHelper; 25 24 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 25 import org.openstreetmap.josm.spi.preferences.Config; 26 26 import org.openstreetmap.josm.tools.GBC; 27 27 import org.openstreetmap.josm.tools.ImageProvider; … … 82 82 int w = getWidth(); 83 83 if (w > 200) { 84 Main.pref.putInt("progressdialog.size", w);84 Config.getPref().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("progressdialog.size", 600), getSize().height);100 setSize(Config.getPref().getInt("progressdialog.size", 600), getSize().height); 101 101 } 102 102 -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
r12675 r12846 11 11 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 12 12 import org.openstreetmap.josm.gui.progress.ProgressMonitor.CancelListener; 13 import org.openstreetmap.josm.gui.progress.ProgressTaskId; 13 14 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; 14 import org.openstreetmap.josm.gui.progress.ProgressTaskId;15 15 import org.openstreetmap.josm.io.OsmTransferException; 16 16 import org.openstreetmap.josm.tools.CheckParameterUtil; -
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterManager.java
r12636 r12846 21 21 import java.util.regex.Pattern; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.actions.mapmode.MapMode; 25 24 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; … … 56 55 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; 57 56 import org.openstreetmap.josm.gui.widgets.OSDLabel; 57 import org.openstreetmap.josm.spi.preferences.Config; 58 58 import org.openstreetmap.josm.tools.Logging; 59 59 … … 124 124 private AutoFilterManager() { 125 125 MapFrame.addMapModeChangeListener(this); 126 Main.pref.addPreferenceChangeListener(this);126 Config.getPref().addPreferenceChangeListener(this); 127 127 NavigatableComponent.addZoomChangeListener(this); 128 128 MainApplication.getLayerManager().addLayerChangeListener(this); -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r12841 r12846 44 44 import org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer; 45 45 import org.openstreetmap.josm.gui.layer.TMSLayer; 46 import org.openstreetmap.josm.spi.preferences.Config; 46 47 import org.openstreetmap.josm.tools.Logging; 47 48 … … 151 152 uncachedLoader = new OsmTileLoader(this); 152 153 uncachedLoader.headers.putAll(headers); 153 setZoomContolsVisible( Main.pref.getBoolean("slippy_map_chooser.zoomcontrols", false));154 setZoomContolsVisible(Config.getPref().getBoolean("slippy_map_chooser.zoomcontrols", false)); 154 155 setMapMarkerVisible(false); 155 156 setMinimumSize(new Dimension(350, 350 / 2)); … … 160 161 setFileCacheEnabled(false); 161 162 } else { 162 setFileCacheEnabled( Main.pref.getBoolean("slippy_map_chooser.file_cache", true));163 } 164 setMaxTilesInMemory( Main.pref.getInt("slippy_map_chooser.max_tiles", 1000));163 setFileCacheEnabled(Config.getPref().getBoolean("slippy_map_chooser.file_cache", true)); 164 } 165 setMaxTilesInMemory(Config.getPref().getInt("slippy_map_chooser.max_tiles", 1000)); 165 166 166 167 List<TileSource> tileSources = getAllTileSources(); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolver.java
r12841 r12846 14 14 import javax.swing.JScrollPane; 15 15 16 import org.openstreetmap.josm. Main;16 import org.openstreetmap.josm.spi.preferences.Config; 17 17 18 18 /** … … 60 60 cbShowTagsWithMultiValuesOnly.setEnabled(cbShowTagsWithConflictsOnly.isSelected()); 61 61 }); 62 cbShowTagsWithConflictsOnly.setSelected( 63 Main.pref.getBoolean(getClass().getName() + ".showTagsWithConflictsOnly", false) 62 cbShowTagsWithConflictsOnly.setSelected(Config.getPref().getBoolean(getClass().getName() + ".showTagsWithConflictsOnly", false) 64 63 ); 65 64 cbShowTagsWithMultiValuesOnly.addChangeListener( 66 65 e -> model.setShowTagsWithMultiValuesOnly(cbShowTagsWithMultiValuesOnly.isSelected()) 67 66 ); 68 cbShowTagsWithMultiValuesOnly.setSelected( 69 Main.pref.getBoolean(getClass().getName() + ".showTagsWithMultiValuesOnly", false) 67 cbShowTagsWithMultiValuesOnly.setSelected(Config.getPref().getBoolean(getClass().getName() + ".showTagsWithMultiValuesOnly", false) 70 68 ); 71 69 cbShowTagsWithMultiValuesOnly.setEnabled(cbShowTagsWithConflictsOnly.isSelected()); … … 78 76 */ 79 77 public void rememberPreferences() { 80 Main.pref.putBoolean(getClass().getName() + ".showTagsWithConflictsOnly", cbShowTagsWithConflictsOnly.isSelected());81 Main.pref.putBoolean(getClass().getName() + ".showTagsWithMultiValuesOnly", cbShowTagsWithMultiValuesOnly.isSelected());78 Config.getPref().putBoolean(getClass().getName() + ".showTagsWithConflictsOnly", cbShowTagsWithConflictsOnly.isSelected()); 79 Config.getPref().putBoolean(getClass().getName() + ".showTagsWithMultiValuesOnly", cbShowTagsWithMultiValuesOnly.isSelected()); 82 80 } 83 81 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r12841 r12846 58 58 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 59 59 import org.openstreetmap.josm.io.OnlineResource; 60 import org.openstreetmap.josm.spi.preferences.Config; 60 61 import org.openstreetmap.josm.tools.ImageProvider; 61 62 import org.openstreetmap.josm.tools.Logging; … … 165 166 cbInSelectionOnly.setToolTipText(tr("<html>Select to show changesets for the currently selected objects only.<br>" 166 167 + "Unselect to show all changesets for objects in the current data layer.</html>")); 167 cbInSelectionOnly.setSelected( Main.pref.getBoolean("changeset-dialog.for-selected-objects-only", false));168 cbInSelectionOnly.setSelected(Config.getPref().getBoolean("changeset-dialog.for-selected-objects-only", false)); 168 169 return pnl; 169 170 } … … 275 276 @Override 276 277 public void itemStateChanged(ItemEvent e) { 277 Main.pref.putBoolean("changeset-dialog.for-selected-objects-only", cbInSelectionOnly.isSelected());278 Config.getPref().putBoolean("changeset-dialog.for-selected-objects-only", cbInSelectionOnly.isSelected()); 278 279 pnlList.removeAll(); 279 280 if (cbInSelectionOnly.isSelected()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r12799 r12846 43 43 import org.openstreetmap.josm.gui.MapFrame; 44 44 import org.openstreetmap.josm.gui.MapFrame.MapModeChangeListener; 45 import org.openstreetmap.josm.gui.SideButton; 45 46 import org.openstreetmap.josm.gui.util.MultikeyActionsHandler; 46 47 import org.openstreetmap.josm.gui.util.MultikeyShortcutAction; 47 import org.openstreetmap.josm.gui.SideButton;48 48 import org.openstreetmap.josm.tools.ImageProvider; 49 49 import org.openstreetmap.josm.tools.InputMapUtils; -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r12799 r12846 66 66 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 67 67 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 68 import org.openstreetmap.josm.gui.layer.NativeScaleLayer; 68 69 import org.openstreetmap.josm.gui.util.MultikeyActionsHandler; 69 70 import org.openstreetmap.josm.gui.util.MultikeyShortcutAction.MultikeyInfo; 70 import org.openstreetmap.josm.gui.layer.NativeScaleLayer;71 71 import org.openstreetmap.josm.gui.widgets.DisableShortcutsOnFocusGainedTextField; 72 72 import org.openstreetmap.josm.gui.widgets.JosmTextField; 73 73 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 74 74 import org.openstreetmap.josm.gui.widgets.ScrollableTable; 75 import org.openstreetmap.josm.spi.preferences.Config; 75 76 import org.openstreetmap.josm.tools.ImageProvider; 76 77 import org.openstreetmap.josm.tools.InputMapUtils; … … 538 539 label.setFont(label.getFont().deriveFont(Font.BOLD)); 539 540 } 540 if ( Main.pref.getBoolean("dialog.layer.colorname", true)) {541 if (Config.getPref().getBoolean("dialog.layer.colorname", true)) { 541 542 AbstractProperty<Color> prop = layer.getColorProperty(); 542 543 Color c = prop == null ? null : prop.get(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r12831 r12846 64 64 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener; 65 65 import org.openstreetmap.josm.gui.mappaint.StyleSetting; 66 import org.openstreetmap.josm.gui.mappaint.StyleSettingGuiFactory; 66 67 import org.openstreetmap.josm.gui.mappaint.StyleSource; 67 68 import org.openstreetmap.josm.gui.mappaint.loader.MapPaintStyleLoader; 68 69 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 69 70 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference; 70 import org.openstreetmap.josm.gui.mappaint.StyleSettingGuiFactory;71 71 import org.openstreetmap.josm.gui.util.FileFilterAllFiles; 72 72 import org.openstreetmap.josm.gui.util.GuiHelper; -
trunk/src/org/openstreetmap/josm/gui/dialogs/OsmIdSelectionDialog.java
r12841 r12846 27 27 import javax.swing.plaf.basic.BasicComboBoxEditor; 28 28 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 31 30 import org.openstreetmap.josm.data.osm.PrimitiveId; … … 38 37 import org.openstreetmap.josm.gui.widgets.OsmIdTextField; 39 38 import org.openstreetmap.josm.gui.widgets.OsmPrimitiveTypesComboBox; 39 import org.openstreetmap.josm.spi.preferences.Config; 40 40 import org.openstreetmap.josm.tools.Utils; 41 41 … … 180 180 protected void restorePrimitivesHistory(HistoryComboBox cbHistory) { 181 181 List<String> cmtHistory = new LinkedList<>( 182 Main.pref.getList(getClass().getName() + ".primitivesHistory", new LinkedList<String>()));182 Config.getPref().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.putList(getClass().getName() + ".primitivesHistory", cbHistory.getHistory());195 Config.getPref().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("downloadprimitive.lasttype", 0));210 cbType.setSelectedIndex(Config.getPref().getInt("downloadprimitive.lasttype", 0)); 211 211 tfId.setType(cbType.getType()); 212 if ( Main.pref.getBoolean("downloadprimitive.autopaste", true)) {212 if (Config.getPref().getBoolean("downloadprimitive.autopaste", true)) { 213 213 tryToPasteFromClipboard(tfId, cbType); 214 214 } … … 221 221 String buf = ClipboardUtils.getClipboardStringContent(); 222 222 if (buf == null || buf.isEmpty()) return; 223 if (buf.length() > Main.pref.getInt("downloadprimitive.max-autopaste-length", 2000)) return;223 if (buf.length() > Config.getPref().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("downloadprimitive.lasttype", cbType.getSelectedIndex());246 Config.getPref().putInt("downloadprimitive.lasttype", cbType.getSelectedIndex()); 247 247 248 248 if (!tfId.readIds()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r12748 r12846 77 77 import org.openstreetmap.josm.gui.widgets.JosmTextField; 78 78 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 79 import org.openstreetmap.josm.spi.preferences.Config; 79 80 import org.openstreetmap.josm.tools.ImageProvider; 80 81 import org.openstreetmap.josm.tools.InputMapUtils; … … 122 123 123 124 private final transient HighlightHelper highlightHelper = new HighlightHelper(); 124 private final boolean highlightEnabled = Main.pref.getBoolean("draw.target-highlight", true);125 private final boolean highlightEnabled = Config.getPref().getBoolean("draw.target-highlight", true); 125 126 private final transient RecentRelationsAction recentRelationsAction; 126 127 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r12841 r12846 38 38 import javax.swing.event.ListSelectionListener; 39 39 40 import org.openstreetmap.josm.Main;41 40 import org.openstreetmap.josm.actions.AbstractSelectAction; 42 41 import org.openstreetmap.josm.actions.AutoScaleAction; … … 58 57 import org.openstreetmap.josm.data.osm.event.DatasetEventManager; 59 58 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode; 60 import org.openstreetmap.josm.data.osm.search.SearchSetting;61 59 import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; 62 60 import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent; … … 66 64 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 67 65 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 66 import org.openstreetmap.josm.data.osm.search.SearchSetting; 68 67 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 69 68 import org.openstreetmap.josm.gui.MainApplication; … … 82 81 import org.openstreetmap.josm.gui.widgets.ListPopupMenu; 83 82 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 83 import org.openstreetmap.josm.spi.preferences.Config; 84 84 import org.openstreetmap.josm.tools.ImageProvider; 85 85 import org.openstreetmap.josm.tools.InputMapUtils; … … 192 192 class MouseEventHandler extends PopupMenuLauncher { 193 193 private final HighlightHelper helper = new HighlightHelper(); 194 private final boolean highlightEnabled = Main.pref.getBoolean("draw.target-highlight", true);194 private final boolean highlightEnabled = Config.getPref().getBoolean("draw.target-highlight", true); 195 195 196 196 MouseEventHandler() { … … 524 524 } 525 525 } 526 int maxsize = Main.pref.getInt("select.history-size", SELECTION_HISTORY_SIZE);526 int maxsize = Config.getPref().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("selection.no_sort_above", 100_000)) {665 boolean quick = selection.size() > Main.pref.getInt("selection.fast_sort_above", 10_000);666 Comparator<OsmPrimitive> c = Main.pref.getBoolean("selection.sort_relations_before_ways", true)664 if (selection.size() <= Config.getPref().getInt("selection.no_sort_above", 100_000)) { 665 boolean quick = selection.size() > Config.getPref().getInt("selection.fast_sort_above", 10_000); 666 Comparator<OsmPrimitive> c = Config.getPref().getBoolean("selection.sort_relations_before_ways", true) 667 667 ? OsmPrimitiveComparator.orderingRelationsWaysNodes() 668 668 : OsmPrimitiveComparator.orderingWaysRelationsNodes(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r12841 r12846 69 69 import org.openstreetmap.josm.gui.util.WindowGeometry.WindowGeometryException; 70 70 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 71 import org.openstreetmap.josm.spi.preferences.Config; 71 72 import org.openstreetmap.josm.tools.Destroyable; 72 73 import org.openstreetmap.josm.tools.GBC; … … 245 246 toggleAction.putValue("help", helpId.substring(0, helpId.length()-6)); 246 247 247 isShowing = Main.pref.getBoolean(preferencePrefix+".visible", defShow);248 isDocked = Main.pref.getBoolean(preferencePrefix+".docked", true);249 isCollapsed = Main.pref.getBoolean(preferencePrefix+".minimized", false);248 isShowing = Config.getPref().getBoolean(preferencePrefix+".visible", defShow); 249 isDocked = Config.getPref().getBoolean(preferencePrefix+".docked", true); 250 isCollapsed = Config.getPref().getBoolean(preferencePrefix+".minimized", false); 250 251 buttonHiding = propButtonHiding.get(); 251 252 … … 257 258 258 259 MainApplication.redirectToMainContentPane(this); 259 Main.pref.addPreferenceChangeListener(this);260 Config.getPref().addPreferenceChangeListener(this); 260 261 261 262 registerInWindowMenu(); … … 468 469 } 469 470 Toolkit.getDefaultToolkit().removeAWTEventListener(this); 470 Main.pref.removePreferenceChangeListener(this);471 Config.getPref().removePreferenceChangeListener(this); 471 472 destroyComponents(this, false); 472 473 } … … 773 774 protected void setIsShowing(boolean val) { 774 775 isShowing = val; 775 Main.pref.putBoolean(preferencePrefix+".visible", val);776 Config.getPref().putBoolean(preferencePrefix+".visible", val); 776 777 stateChanged(); 777 778 } … … 782 783 } 783 784 isDocked = val; 784 Main.pref.putBoolean(preferencePrefix+".docked", val);785 Config.getPref().putBoolean(preferencePrefix+".docked", val); 785 786 stateChanged(); 786 787 } … … 788 789 protected void setIsCollapsed(boolean val) { 789 790 isCollapsed = val; 790 Main.pref.putBoolean(preferencePrefix+".minimized", val);791 Config.getPref().putBoolean(preferencePrefix+".minimized", val); 791 792 stateChanged(); 792 793 } … … 925 926 continue; 926 927 } 927 final JPanel buttonRowPanel = new JPanel( Main.pref.getBoolean("dialog.align.left", false)928 final JPanel buttonRowPanel = new JPanel(Config.getPref().getBoolean("dialog.align.left", false) 928 929 ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1, buttonRow.size())); 929 930 buttonsPanel.add(buttonRowPanel); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r12649 r12846 58 58 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 59 59 import org.openstreetmap.josm.io.OsmTransferException; 60 import org.openstreetmap.josm.spi.preferences.Config; 60 61 import org.openstreetmap.josm.tools.ImageProvider; 61 62 import org.openstreetmap.josm.tools.InputMapUtils; … … 493 494 ds.setSelected(sel); 494 495 } 495 if ( Main.pref.getBoolean("validator.autozoom", false)) {496 if (Config.getPref().getBoolean("validator.autozoom", false)) { 496 497 AutoScaleAction.zoomTo(sel); 497 498 } … … 573 574 */ 574 575 public void updateSelection(Collection<? extends OsmPrimitive> newSelection) { 575 if (! Main.pref.getBoolean(ValidatorPrefHelper.PREF_FILTER_BY_SELECTION, false))576 if (!Config.getPref().getBoolean(ValidatorPrefHelper.PREF_FILTER_BY_SELECTION, false)) 576 577 return; 577 578 if (newSelection.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/SingleChangesetDownloadPanel.java
r10494 r12846 22 22 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 23 23 import org.openstreetmap.josm.io.OnlineResource; 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 import org.openstreetmap.josm.tools.ImageProvider; 25 26 … … 60 61 add(btn); 61 62 62 if ( Main.pref.getBoolean("downloadchangeset.autopaste", true)) {63 if (Config.getPref().getBoolean("downloadchangeset.autopaste", true)) { 63 64 tfChangesetId.tryToPasteFromClipboard(); 64 65 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
r12841 r12846 15 15 import javax.swing.JScrollPane; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.gui.util.GuiHelper; 19 18 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 20 19 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 21 20 import org.openstreetmap.josm.io.ChangesetQuery; 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 23 23 /** … … 209 209 */ 210 210 public void rememberSettings() { 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());211 Config.getPref().putBoolean("changeset-query.advanced.user-restrictions", cbUserRestriction.isSelected()); 212 Config.getPref().putBoolean("changeset-query.advanced.open-restrictions", cbOpenAndCloseRestrictions.isSelected()); 213 Config.getPref().putBoolean("changeset-query.advanced.time-restrictions", cbTimeRestrictions.isSelected()); 214 Config.getPref().putBoolean("changeset-query.advanced.bbox-restrictions", cbBoundingBoxRestriction.isSelected()); 215 215 216 216 pnlUserRestriction.rememberSettings(); … … 223 223 */ 224 224 public void restoreFromSettings() { 225 cbUserRestriction.setSelected( Main.pref.getBoolean("changeset-query.advanced.user-restrictions", false));226 cbOpenAndCloseRestrictions.setSelected( Main.pref.getBoolean("changeset-query.advanced.open-restrictions", false));227 cbTimeRestrictions.setSelected( Main.pref.getBoolean("changeset-query.advanced.time-restrictions", false));228 cbBoundingBoxRestriction.setSelected( Main.pref.getBoolean("changeset-query.advanced.bbox-restrictions", false));225 cbUserRestriction.setSelected(Config.getPref().getBoolean("changeset-query.advanced.user-restrictions", false)); 226 cbOpenAndCloseRestrictions.setSelected(Config.getPref().getBoolean("changeset-query.advanced.open-restrictions", false)); 227 cbTimeRestrictions.setSelected(Config.getPref().getBoolean("changeset-query.advanced.time-restrictions", false)); 228 cbBoundingBoxRestriction.setSelected(Config.getPref().getBoolean("changeset-query.advanced.bbox-restrictions", false)); 229 229 } 230 230 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java
r12841 r12846 19 19 import javax.swing.JRadioButton; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.Bounds; 23 22 import org.openstreetmap.josm.data.UserIdentityManager; … … 27 26 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 28 27 import org.openstreetmap.josm.io.ChangesetQuery; 28 import org.openstreetmap.josm.spi.preferences.Config; 29 29 import org.openstreetmap.josm.tools.Logging; 30 30 … … 187 187 BasicQuery q = getSelectedQuery(); 188 188 if (q == null) { 189 Main.pref.put("changeset-query.basic.query", null);190 } else { 191 Main.pref.put("changeset-query.basic.query", q.toString());192 } 193 Main.pref.putBoolean("changeset-query.basic.my-changesets-only", cbMyChangesetsOnly.isSelected());189 Config.getPref().put("changeset-query.basic.query", null); 190 } else { 191 Config.getPref().put("changeset-query.basic.query", q.toString()); 192 } 193 Config.getPref().putBoolean("changeset-query.basic.my-changesets-only", cbMyChangesetsOnly.isSelected()); 194 194 } 195 195 … … 199 199 public void restoreFromPreferences() { 200 200 BasicQuery q; 201 String value = Main.pref.get("changeset-query.basic.query", null);201 String value = Config.getPref().get("changeset-query.basic.query", null); 202 202 if (value == null) { 203 203 q = BasicQuery.MOST_RECENT_CHANGESETS; … … 212 212 } 213 213 rbQueries.get(q).setSelected(true); 214 boolean mineOnly = Main.pref.getBoolean("changeset-query.basic.my-changesets-only", false);214 boolean mineOnly = Config.getPref().getBoolean("changeset-query.basic.my-changesets-only", false); 215 215 mineOnly = mineOnly || q.equals(BasicQuery.MY_OPEN_CHANGESETS); 216 216 cbMyChangesetsOnly.setSelected(mineOnly); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/OpenAndCloseStateRestrictionPanel.java
r11330 r12846 13 13 import javax.swing.JRadioButton; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 17 16 import org.openstreetmap.josm.io.ChangesetQuery; 17 import org.openstreetmap.josm.spi.preferences.Config; 18 18 19 19 /** … … 109 109 public void rememberSettings() { 110 110 if (rbBoth.isSelected()) { 111 Main.pref.put(PREF_QUERY_TYPE, "both");111 Config.getPref().put(PREF_QUERY_TYPE, "both"); 112 112 } else if (rbOpenOnly.isSelected()) { 113 Main.pref.put(PREF_QUERY_TYPE, "open");113 Config.getPref().put(PREF_QUERY_TYPE, "open"); 114 114 } else if (rbClosedOnly.isSelected()) { 115 Main.pref.put(PREF_QUERY_TYPE, "closed");115 Config.getPref().put(PREF_QUERY_TYPE, "closed"); 116 116 } 117 117 } … … 121 121 */ 122 122 public void restoreFromSettings() { 123 String v = Main.pref.get(PREF_QUERY_TYPE, "open");123 String v = Config.getPref().get(PREF_QUERY_TYPE, "open"); 124 124 rbBoth.setSelected("both".equals(v)); 125 125 rbOpenOnly.setSelected("open".equals(v)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/TimeRestrictionPanel.java
r11326 r12846 22 22 import javax.swing.JRadioButton; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 26 25 import org.openstreetmap.josm.gui.help.HelpUtil; … … 29 28 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 30 29 import org.openstreetmap.josm.io.ChangesetQuery; 30 import org.openstreetmap.josm.spi.preferences.Config; 31 31 32 32 /** … … 296 296 String prefRoot = "changeset-query.advanced.time-restrictions"; 297 297 if (rbClosedAfter.isSelected()) { 298 Main.pref.put(prefRoot + ".query-type", "closed-after");298 Config.getPref().put(prefRoot + ".query-type", "closed-after"); 299 299 } else if (rbClosedAfterAndCreatedBefore.isSelected()) { 300 Main.pref.put(prefRoot + ".query-type", "closed-after-created-before");301 } 302 Main.pref.put(prefRoot + ".closed-after.date", tfClosedAfterDate1.getText());303 Main.pref.put(prefRoot + ".closed-after.time", tfClosedAfterTime1.getText());304 Main.pref.put(prefRoot + ".closed-created.closed.date", tfClosedAfterDate2.getText());305 Main.pref.put(prefRoot + ".closed-created.closed.time", tfClosedAfterTime2.getText());306 Main.pref.put(prefRoot + ".closed-created.created.date", tfCreatedBeforeDate.getText());307 Main.pref.put(prefRoot + ".closed-created.created.time", tfCreatedBeforeTime.getText());300 Config.getPref().put(prefRoot + ".query-type", "closed-after-created-before"); 301 } 302 Config.getPref().put(prefRoot + ".closed-after.date", tfClosedAfterDate1.getText()); 303 Config.getPref().put(prefRoot + ".closed-after.time", tfClosedAfterTime1.getText()); 304 Config.getPref().put(prefRoot + ".closed-created.closed.date", tfClosedAfterDate2.getText()); 305 Config.getPref().put(prefRoot + ".closed-created.closed.time", tfClosedAfterTime2.getText()); 306 Config.getPref().put(prefRoot + ".closed-created.created.date", tfCreatedBeforeDate.getText()); 307 Config.getPref().put(prefRoot + ".closed-created.created.time", tfCreatedBeforeTime.getText()); 308 308 } 309 309 … … 313 313 public void restoreFromSettings() { 314 314 String prefRoot = "changeset-query.advanced.open-restrictions"; 315 String v = Main.pref.get(prefRoot + ".query-type", "closed-after");315 String v = Config.getPref().get(prefRoot + ".query-type", "closed-after"); 316 316 rbClosedAfter.setSelected("closed-after".equals(v)); 317 317 rbClosedAfterAndCreatedBefore.setSelected("closed-after-created-before".equals(v)); … … 319 319 rbClosedAfter.setSelected(true); 320 320 } 321 tfClosedAfterDate1.setText( Main.pref.get(prefRoot + ".closed-after.date", ""));322 tfClosedAfterTime1.setText( Main.pref.get(prefRoot + ".closed-after.time", ""));323 tfClosedAfterDate2.setText( Main.pref.get(prefRoot + ".closed-created.closed.date", ""));324 tfClosedAfterTime2.setText( Main.pref.get(prefRoot + ".closed-created.closed.time", ""));325 tfCreatedBeforeDate.setText( Main.pref.get(prefRoot + ".closed-created.created.date", ""));326 tfCreatedBeforeTime.setText( Main.pref.get(prefRoot + ".closed-created.created.time", ""));321 tfClosedAfterDate1.setText(Config.getPref().get(prefRoot + ".closed-after.date", "")); 322 tfClosedAfterTime1.setText(Config.getPref().get(prefRoot + ".closed-after.time", "")); 323 tfClosedAfterDate2.setText(Config.getPref().get(prefRoot + ".closed-created.closed.date", "")); 324 tfClosedAfterTime2.setText(Config.getPref().get(prefRoot + ".closed-created.closed.time", "")); 325 tfCreatedBeforeDate.setText(Config.getPref().get(prefRoot + ".closed-created.created.date", "")); 326 tfCreatedBeforeTime.setText(Config.getPref().get(prefRoot + ".closed-created.created.time", "")); 327 327 if (!valClosedAfterDate1.isValid()) { 328 328 tfClosedAfterDate1.setText(""); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UserRestrictionPanel.java
r12743 r12846 18 18 import javax.swing.JRadioButton; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.data.UserIdentityManager; 22 21 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 27 26 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 28 27 import org.openstreetmap.josm.io.ChangesetQuery; 28 import org.openstreetmap.josm.spi.preferences.Config; 29 29 import org.openstreetmap.josm.tools.CheckParameterUtil; 30 30 … … 261 261 public void rememberSettings() { 262 262 if (rbRestrictToMyself.isSelected()) { 263 Main.pref.put(PREF_QUERY_TYPE, "mine");263 Config.getPref().put(PREF_QUERY_TYPE, "mine"); 264 264 } else if (rbRestrictToUid.isSelected()) { 265 Main.pref.put(PREF_QUERY_TYPE, "uid");265 Config.getPref().put(PREF_QUERY_TYPE, "uid"); 266 266 } else if (rbRestrictToUserName.isSelected()) { 267 Main.pref.put(PREF_QUERY_TYPE, "username");268 } 269 Main.pref.put(PREF_ROOT + ".uid", tfUid.getText());270 Main.pref.put(PREF_ROOT + ".username", tfUserName.getText());267 Config.getPref().put(PREF_QUERY_TYPE, "username"); 268 } 269 Config.getPref().put(PREF_ROOT + ".uid", tfUid.getText()); 270 Config.getPref().put(PREF_ROOT + ".username", tfUserName.getText()); 271 271 } 272 272 … … 275 275 */ 276 276 public void restoreFromSettings() { 277 String v = Main.pref.get(PREF_QUERY_TYPE, "mine");277 String v = Config.getPref().get(PREF_QUERY_TYPE, "mine"); 278 278 if ("mine".equals(v)) { 279 279 UserIdentityManager im = UserIdentityManager.getInstance(); … … 288 288 rbRestrictToUserName.setSelected(true); 289 289 } 290 tfUid.setText( Main.pref.get(PREF_ROOT + ".uid", ""));290 tfUid.setText(Config.getPref().get(PREF_ROOT + ".uid", "")); 291 291 if (!valUid.isValid()) { 292 292 tfUid.setText(""); 293 293 } 294 tfUserName.setText( Main.pref.get(PREF_ROOT + ".username", ""));294 tfUserName.setText(Config.getPref().get(PREF_ROOT + ".username", "")); 295 295 } 296 296 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r12726 r12846 100 100 import org.openstreetmap.josm.gui.widgets.JosmTextField; 101 101 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 102 import org.openstreetmap.josm.spi.preferences.Config; 102 103 import org.openstreetmap.josm.tools.AlphanumComparator; 103 104 import org.openstreetmap.josm.tools.GBC; … … 257 258 258 259 // combine both tables and wrap them in a scrollPane 259 boolean top = Main.pref.getBoolean("properties.presets.top", true);260 boolean top = Config.getPref().getBoolean("properties.presets.top", true); 260 261 if (top) { 261 262 bothTables.add(presets, GBC.std().fill(GBC.HORIZONTAL).insets(5, 2, 5, 2).anchor(GBC.NORTHWEST)); … … 295 296 editHelper.loadTagsIfNeeded(); 296 297 297 Main.pref.addKeyPreferenceChangeListener("display.discardable-keys", preferenceListener);298 Config.getPref().addKeyPreferenceChangeListener("display.discardable-keys", preferenceListener); 298 299 } 299 300 … … 341 342 */ 342 343 private void setupBlankSpaceMenu() { 343 if ( Main.pref.getBoolean("properties.menu.add_edit_delete", true)) {344 if (Config.getPref().getBoolean("properties.menu.add_edit_delete", true)) { 344 345 blankSpaceMenuHandler.addAction(addAction); 345 346 PopupMenuLauncher launcher = new BlankSpaceMenuLauncher(blankSpaceMenu); … … 354 355 private void setupMembershipMenu() { 355 356 // setting up the membership table 356 if ( Main.pref.getBoolean("properties.menu.add_edit_delete", true)) {357 if (Config.getPref().getBoolean("properties.menu.add_edit_delete", true)) { 357 358 membershipMenuHandler.addAction(editAction); 358 359 membershipMenuHandler.addAction(deleteAction); … … 406 407 */ 407 408 private void setupTagsMenu() { 408 if ( Main.pref.getBoolean("properties.menu.add_edit_delete", true)) {409 if (Config.getPref().getBoolean("properties.menu.add_edit_delete", true)) { 409 410 tagMenu.add(addAction); 410 411 tagMenu.add(editAction); … … 541 542 public void destroy() { 542 543 super.destroy(); 543 Main.pref.removeKeyPreferenceChangeListener("display.discardable-keys", preferenceListener);544 Config.getPref().removeKeyPreferenceChangeListener("display.discardable-keys", preferenceListener); 544 545 Container parent = pluginHook.getParent(); 545 546 if (parent != null) { … … 573 574 tagData.setRowCount(0); 574 575 575 final boolean displayDiscardableKeys = Main.pref.getBoolean("display.discardable-keys", false);576 final boolean displayDiscardableKeys = Config.getPref().getBoolean("display.discardable-keys", false); 576 577 final Map<String, Integer> keyCount = new HashMap<>(); 577 578 final Map<String, String> tags = new HashMap<>(); … … 1136 1137 public void actionPerformed(ActionEvent e) { 1137 1138 try { 1138 String base = Main.pref.get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/");1139 String base = Config.getPref().get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/"); 1139 1140 String lang = LanguageInfo.getWikiLanguagePrefix(); 1140 1141 final List<URI> uris = new ArrayList<>(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollection.java
r12841 r12846 9 9 10 10 import org.openstreetmap.josm.data.osm.Tag; 11 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 11 12 import org.openstreetmap.josm.data.osm.search.SearchParseError; 12 13 import org.openstreetmap.josm.data.osm.search.SearchSetting; 13 import org.openstreetmap.josm.data.osm.search.SearchCompiler;14 14 import org.openstreetmap.josm.data.preferences.ListProperty; 15 15 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r12841 r12846 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.ListProperty;76 75 import org.openstreetmap.josm.data.preferences.EnumProperty; 77 76 import org.openstreetmap.josm.data.preferences.IntegerProperty; 77 import org.openstreetmap.josm.data.preferences.ListProperty; 78 78 import org.openstreetmap.josm.data.preferences.StringProperty; 79 79 import org.openstreetmap.josm.gui.ExtendedDialog; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r12758 r12846 100 100 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 101 101 import org.openstreetmap.josm.gui.util.WindowGeometry; 102 import org.openstreetmap.josm.spi.preferences.Config; 102 103 import org.openstreetmap.josm.tools.CheckParameterUtil; 103 104 import org.openstreetmap.josm.tools.Logging; … … 429 430 } 430 431 ); 431 tfRole.setText( Main.pref.get("relation.editor.generic.lastrole", ""));432 tfRole.setText(Config.getPref().get("relation.editor.generic.lastrole", "")); 432 433 return tfRole; 433 434 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
r12657 r12846 40 40 import org.openstreetmap.josm.gui.util.HighlightHelper; 41 41 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTable; 42 import org.openstreetmap.josm.spi.preferences.Config; 42 43 43 44 /** … … 129 130 130 131 private void initHighlighting() { 131 highlightEnabled = Main.pref.getBoolean("draw.target-highlight", true);132 highlightEnabled = Config.getPref().getBoolean("draw.target-highlight", true); 132 133 if (!highlightEnabled) return; 133 134 getMemberTableModel().getSelectionModel().addListSelectionListener(highlighterListener); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorAction.java
r9665 r12846 8 8 import javax.swing.event.TableModelListener; 9 9 10 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 10 11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable; 11 12 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 12 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;13 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 14 14 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddFromSelectionAction.java
r9665 r12846 11 11 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor; 12 12 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException; 13 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 13 14 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable; 14 15 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 15 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;16 16 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable; 17 17 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java
r10791 r12846 13 13 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 14 14 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 15 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 15 16 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable; 16 17 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 17 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;18 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 19 19 import org.openstreetmap.josm.gui.tagging.TagEditorModel; 20 20 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 21 import org.openstreetmap.josm.spi.preferences.Config; 21 22 import org.openstreetmap.josm.tools.ImageProvider; 22 23 import org.openstreetmap.josm.tools.InputMapUtils; … … 60 61 if (ret == 0) { //Yes, save the changes 61 62 //copied from OKAction.run() 62 Main.pref.put("relation.editor.generic.lastrole", tfRole.getText());63 Config.getPref().put("relation.editor.generic.lastrole", tfRole.getText()); 63 64 if (!applyChanges()) 64 65 return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/OKAction.java
r10424 r12846 6 6 import java.awt.event.ActionEvent; 7 7 8 import org.openstreetmap.josm. Main;8 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 9 9 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable; 10 10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 11 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;12 11 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 13 12 import org.openstreetmap.josm.gui.tagging.TagEditorModel; 14 13 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 14 import org.openstreetmap.josm.spi.preferences.Config; 15 15 import org.openstreetmap.josm.tools.ImageProvider; 16 16 … … 40 40 @Override 41 41 public void actionPerformed(ActionEvent e) { 42 Main.pref.put("relation.editor.generic.lastrole", tfRole.getText());42 Config.getPref().put("relation.editor.generic.lastrole", tfRole.getText()); 43 43 memberTable.stopHighlighting(); 44 44 if (!applyChanges()) -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r12841 r12846 23 23 import javax.swing.UIManager; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.actions.downloadtasks.ChangesetQueryTask; 27 26 import org.openstreetmap.josm.data.Bounds; … … 39 38 import org.openstreetmap.josm.gui.util.GuiHelper; 40 39 import org.openstreetmap.josm.io.ChangesetQuery; 40 import org.openstreetmap.josm.spi.preferences.Config; 41 41 import org.openstreetmap.josm.tools.ImageProvider; 42 42 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; … … 262 262 } 263 263 // Then add manual bookmarks previously saved in local preferences 264 Collection<Collection<String>> args = Main.pref.getArray("bookmarks", null);264 List<List<String>> args = Config.getPref().getListOfLists("bookmarks", null); 265 265 if (args != null) { 266 266 List<Bookmark> bookmarks = new LinkedList<>(); … … 315 315 coll.add(Arrays.asList(array)); 316 316 } 317 Main.pref.putListOfLists("bookmarks", coll);317 Config.getPref().putListOfLists("bookmarks", coll); 318 318 } 319 319 -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r12733 r12846 50 50 import org.openstreetmap.josm.io.OnlineResource; 51 51 import org.openstreetmap.josm.plugins.PluginHandler; 52 import org.openstreetmap.josm.spi.preferences.Config; 52 53 import org.openstreetmap.josm.tools.GBC; 53 54 import org.openstreetmap.josm.tools.ImageProvider; … … 363 364 DOWNLOAD_ZOOMTODATA.put(cbZoomToDownloadedData.isSelected()); 364 365 if (currentBounds != null) { 365 Main.pref.put("osm-download.bounds", currentBounds.encodeAsString(";"));366 Config.getPref().put("osm-download.bounds", currentBounds.encodeAsString(";")); 366 367 } 367 368 } … … 406 407 */ 407 408 public static Bounds getSavedDownloadBounds() { 408 String value = Main.pref.get("osm-download.bounds");409 String value = Config.getPref().get("osm-download.bounds"); 409 410 if (!value.isEmpty()) { 410 411 try { -
trunk/src/org/openstreetmap/josm/gui/download/DownloadObjectDialog.java
r12841 r12846 15 15 import org.openstreetmap.josm.gui.dialogs.OsmIdSelectionDialog; 16 16 import org.openstreetmap.josm.io.OnlineResource; 17 import org.openstreetmap.josm.spi.preferences.Config; 17 18 18 19 /** … … 59 60 protected Collection<Component> getComponentsBeforeHelp() { 60 61 newLayer.setToolTipText(tr("Select if the data should be downloaded into a new layer")); 61 newLayer.setSelected( Main.pref.getBoolean("download.newlayer"));62 newLayer.setSelected(Config.getPref().getBoolean("download.newlayer")); 62 63 63 64 referrers.setToolTipText(tr("Select if the referrers of the object should be downloaded as well, i.e.," 64 65 + "parent relations and for nodes, additionally, parent ways")); 65 referrers.setSelected( Main.pref.getBoolean("downloadprimitive.referrers", true));66 referrers.setSelected(Config.getPref().getBoolean("downloadprimitive.referrers", true)); 66 67 67 68 fullRel.setToolTipText(tr("Select if the members of a relation should be downloaded as well")); 68 fullRel.setSelected( Main.pref.getBoolean("downloadprimitive.full", true));69 fullRel.setSelected(Config.getPref().getBoolean("downloadprimitive.full", true)); 69 70 70 71 cbType.addItemListener(e -> referrers.setText(cbType.getType() == OsmPrimitiveType.NODE … … 103 104 super.windowClosed(e); 104 105 if (e != null && e.getComponent() == this && getValue() == 1) { 105 Main.pref.putBoolean("downloadprimitive.referrers", referrers.isSelected());106 Main.pref.putBoolean("downloadprimitive.full", fullRel.isSelected());107 Main.pref.putBoolean("download.newlayer", newLayer.isSelected());106 Config.getPref().putBoolean("downloadprimitive.referrers", referrers.isSelected()); 107 Config.getPref().putBoolean("downloadprimitive.full", fullRel.isSelected()); 108 Config.getPref().putBoolean("download.newlayer", newLayer.isSelected()); 108 109 } 109 110 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadSettings.java
r12684 r12846 2 2 package org.openstreetmap.josm.gui.download; 3 3 4 import java.util.Optional; 5 4 6 import org.openstreetmap.josm.data.Bounds; 5 6 import java.util.Optional;7 7 8 8 /** -
trunk/src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java
r12706 r12846 19 19 import javax.swing.event.ChangeListener; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask; 23 22 import org.openstreetmap.josm.actions.downloadtasks.DownloadGpsTask; … … 32 31 import org.openstreetmap.josm.gui.MapFrame; 33 32 import org.openstreetmap.josm.gui.util.GuiHelper; 33 import org.openstreetmap.josm.spi.preferences.Config; 34 34 import org.openstreetmap.josm.tools.GBC; 35 35 import org.openstreetmap.josm.tools.ImageProvider; … … 298 298 } else if (isDownloadNotes() && !isDownloadOsmData() && !isDownloadGpxData()) { 299 299 // see max_note_request_area in https://github.com/openstreetmap/openstreetmap-website/blob/master/config/example.application.yml 300 isAreaTooLarge = bbox.getArea() > Main.pref.getDouble("osm-server.max-request-area-notes", 25);300 isAreaTooLarge = bbox.getArea() > Config.getPref().getDouble("osm-server.max-request-area-notes", 25); 301 301 } else { 302 302 // see max_request_area in https://github.com/openstreetmap/openstreetmap-website/blob/master/config/example.application.yml 303 isAreaTooLarge = bbox.getArea() > Main.pref.getDouble("osm-server.max-request-area", 0.25);303 isAreaTooLarge = bbox.getArea() > Config.getPref().getDouble("osm-server.max-request-area", 0.25); 304 304 } 305 305 -
trunk/src/org/openstreetmap/josm/gui/download/OverpassQueryList.java
r12841 r12846 49 49 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 50 50 import org.openstreetmap.josm.gui.widgets.SearchTextResultListPanel; 51 import org.openstreetmap.josm.spi.preferences.Config; 51 52 import org.openstreetmap.josm.tools.GBC; 52 53 import org.openstreetmap.josm.tools.Logging; … … 254 255 } 255 256 256 Main.pref.putListOfMaps(PREFERENCE_ITEMS, toSave);257 Config.getPref().putListOfMaps(PREFERENCE_ITEMS, toSave); 257 258 } 258 259 … … 263 264 private static Map<String, SelectorItem> restorePreferences() { 264 265 Collection<Map<String, String>> toRetrieve = 265 Main.pref.getListOfMaps(PREFERENCE_ITEMS, Collections.emptyList());266 Config.getPref().getListOfMaps(PREFERENCE_ITEMS, Collections.emptyList()); 266 267 Map<String, SelectorItem> result = new HashMap<>(); 267 268 -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r12841 r12846 55 55 import org.openstreetmap.josm.io.NameFinder.SearchResult; 56 56 import org.openstreetmap.josm.io.OsmTransferException; 57 import org.openstreetmap.josm.spi.preferences.Config; 57 58 import org.openstreetmap.josm.tools.GBC; 58 59 import org.openstreetmap.josm.tools.HttpClient; … … 105 106 lpanel.add(new JLabel(tr("Choose the server for searching:"))); 106 107 lpanel.add(server); 107 String s = Main.pref.get("namefinder.server", SERVERS[0].name);108 String s = Config.getPref().get("namefinder.server", SERVERS[0].name); 108 109 for (int i = 0; i < SERVERS.length; ++i) { 109 110 if (SERVERS[i].name.equals(s)) { … … 115 116 cbSearchExpression = new HistoryComboBox(); 116 117 cbSearchExpression.setToolTipText(tr("Enter a place name to search for")); 117 List<String> cmtHistory = new LinkedList<>( Main.pref.getList(HISTORY_KEY, new LinkedList<String>()));118 List<String> cmtHistory = new LinkedList<>(Config.getPref().getList(HISTORY_KEY, new LinkedList<String>())); 118 119 Collections.reverse(cmtHistory); 119 120 cbSearchExpression.setPossibleItems(cmtHistory); … … 189 190 return; 190 191 cbSearchExpression.addCurrentItemToHistory(); 191 Main.pref.putList(HISTORY_KEY, cbSearchExpression.getHistory());192 Config.getPref().putList(HISTORY_KEY, cbSearchExpression.getHistory()); 192 193 NameQueryTask task = new NameQueryTask(cbSearchExpression.getText()); 193 194 MainApplication.worker.submit(task); … … 227 228 this.searchExpression = searchExpression; 228 229 useserver = (Server) server.getSelectedItem(); 229 Main.pref.put("namefinder.server", useserver.name);230 Config.getPref().put("namefinder.server", useserver.name); 230 231 } 231 232 -
trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java
r12643 r12846 14 14 import org.openstreetmap.josm.actions.HelpAction; 15 15 import org.openstreetmap.josm.gui.MainApplication; 16 import org.openstreetmap.josm.spi.preferences.Config; 16 17 import org.openstreetmap.josm.tools.LanguageInfo; 17 18 import org.openstreetmap.josm.tools.LanguageInfo.LocaleType; … … 33 34 */ 34 35 public static String getWikiBaseUrl() { 35 return Main.pref.get("help.baseurl", Main.getJOSMWebsite());36 return Config.getPref().get("help.baseurl", Main.getJOSMWebsite()); 36 37 } 37 38 … … 132 133 if (ret == null) 133 134 return ret; 134 ret = '/' + ret + Main.pref.get("help.pathhelp", "/Help").replaceAll("^\\/+", ""); // remove leading /135 ret = '/' + ret + Config.getPref().get("help.pathhelp", "/Help").replaceAll("^\\/+", ""); // remove leading / 135 136 return ret.replaceAll("\\/+", "\\/"); // collapse sequences of // 136 137 } -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r12841 r12846 35 35 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 36 36 import org.openstreetmap.josm.io.XmlWriter; 37 import org.openstreetmap.josm.spi.preferences.Config; 37 38 import org.openstreetmap.josm.tools.ImageProvider; 38 39 import org.openstreetmap.josm.tools.OpenBrowser; … … 341 342 Object val = tbl.getColumnModel().getColumn(col).getHeaderValue(); 342 343 Component comp = tcr.getTableCellRendererComponent(tbl, val, false, false, -1, col); 343 maxwidth = Math.max(comp.getPreferredSize().width + Main.pref.getInt("table.header-inset", 0), maxwidth);344 maxwidth = Math.max(comp.getPreferredSize().width + Config.getPref().getInt("table.header-inset", 0), maxwidth); 344 345 345 346 int spacing = tbl.getIntercellSpacing().width; -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r12841 r12846 28 28 import javax.swing.event.HyperlinkEvent; 29 29 30 import org.openstreetmap.josm.Main;31 30 import org.openstreetmap.josm.data.osm.Changeset; 32 31 import org.openstreetmap.josm.gui.MainApplication; 33 32 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 34 33 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 34 import org.openstreetmap.josm.spi.preferences.Config; 35 35 import org.openstreetmap.josm.tools.CheckParameterUtil; 36 36 import org.openstreetmap.josm.tools.GBC; … … 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.getList(HISTORY_KEY, new LinkedList<String>()));80 List<String> cmtHistory = new LinkedList<>(Config.getPref().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.getList(SOURCE_HISTORY_KEY, getDefaultSources()));102 List<String> sourceHistory = new LinkedList<>(Config.getPref().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.putList(HISTORY_KEY, hcbUploadComment.getHistory());169 Main.pref.putInt(HISTORY_LAST_USED_KEY, (int) (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));168 Config.getPref().putList(HISTORY_KEY, hcbUploadComment.getHistory()); 169 Config.getPref().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.putList(SOURCE_HISTORY_KEY, hcbUploadSource.getHistory());172 Config.getPref().putList(SOURCE_HISTORY_KEY, hcbUploadSource.getHistory()); 173 173 } 174 174 -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
r12841 r12846 23 23 import javax.swing.event.ListDataListener; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.data.osm.Changeset; 27 26 import org.openstreetmap.josm.data.osm.ChangesetCache; … … 29 28 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 30 29 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 30 import org.openstreetmap.josm.spi.preferences.Config; 31 31 import org.openstreetmap.josm.tools.CheckParameterUtil; 32 32 import org.openstreetmap.josm.tools.ImageProvider; … … 156 156 cbCloseAfterUpload.setToolTipText(tr("Select to close the changeset after the next upload")); 157 157 add(cbCloseAfterUpload, gc); 158 cbCloseAfterUpload.setSelected( Main.pref.getBoolean("upload.changeset.close", true));158 cbCloseAfterUpload.setSelected(Config.getPref().getBoolean("upload.changeset.close", true)); 159 159 cbCloseAfterUpload.addItemListener(new CloseAfterUploadItemStateListener()); 160 160 … … 256 256 case ItemEvent.SELECTED: 257 257 firePropertyChange(CLOSE_CHANGESET_AFTER_UPLOAD, false, true); 258 Main.pref.putBoolean("upload.changeset.close", true);258 Config.getPref().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.putBoolean("upload.changeset.close", false);262 Config.getPref().putBoolean("upload.changeset.close", false); 263 263 break; 264 264 default: // Do nothing -
trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java
r12821 r12846 42 42 import org.openstreetmap.josm.io.auth.AbstractCredentialsAgent; 43 43 import org.openstreetmap.josm.io.auth.CredentialsAgentResponse; 44 import org.openstreetmap.josm.spi.preferences.Config; 44 45 import org.openstreetmap.josm.tools.ImageProvider; 45 46 import org.openstreetmap.josm.tools.InputMapUtils; … … 355 356 tfUserName.setToolTipText(tr("Please enter the user name for authenticating at your proxy server")); 356 357 tfPassword.setToolTipText(tr("Please enter the password for authenticating at your proxy server")); 357 lblHeading.setText( 358 "<html>" + tr("Authenticating at the HTTP proxy ''{0}'' failed. Please enter a valid username and a valid password.", 359 Main.pref.get(DefaultProxySelector.PROXY_HTTP_HOST) + ':' + 360 Main.pref.get(DefaultProxySelector.PROXY_HTTP_PORT)) + "</html>"); 358 lblHeading.setText("<html>" + tr("Authenticating at the HTTP proxy ''{0}'' failed. Please enter a valid username and a valid password.", 359 Config.getPref().get(DefaultProxySelector.PROXY_HTTP_HOST) + ':' + 360 Config.getPref().get(DefaultProxySelector.PROXY_HTTP_PORT)) + "</html>"); 361 361 lblWarning.setText("<html>" + 362 362 tr("Warning: depending on the authentication method the proxy server uses the password may be transferred unencrypted.") -
trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
r12841 r12846 50 50 import org.openstreetmap.josm.plugins.PluginInformation; 51 51 import org.openstreetmap.josm.plugins.ReadLocalPluginInformationTask; 52 import org.openstreetmap.josm.spi.preferences.Config; 52 53 import org.openstreetmap.josm.tools.LanguageInfo; 53 54 import org.openstreetmap.josm.tools.Logging; … … 400 401 MainApplication.worker.submit(pluginDownloadTask); 401 402 } 402 List<String> pls = new ArrayList<>( Main.pref.getList("plugins"));403 List<String> pls = new ArrayList<>(Config.getPref().getList("plugins")); 403 404 for (PluginInformation pi2: toInstallPlugins) { 404 405 if (!pls.contains(pi2.name)) { … … 413 414 new File(Main.pref.getPluginsDirectory(), pi4.name+".jar").deleteOnExit(); 414 415 } 415 Main.pref.putList("plugins", pls);416 Config.getPref().putList("plugins", pls); 416 417 }); 417 418 } -
trunk/src/org/openstreetmap/josm/gui/io/RecentlyOpenedFilesMenu.java
r12841 r12846 17 17 import javax.swing.event.MenuListener; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.actions.OpenFileAction.OpenFileTask; 21 20 import org.openstreetmap.josm.gui.MainApplication; 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 import org.openstreetmap.josm.tools.ImageProvider; 23 23 … … 58 58 private void rebuild() { 59 59 removeAll(); 60 Collection<String> fileHistory = Main.pref.getList("file-open.history");60 Collection<String> fileHistory = Config.getPref().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.putList("file-open.history", null);103 Config.getPref().putList("file-open.history", null); 104 104 } 105 105 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r12841 r12846 60 60 import org.openstreetmap.josm.io.UploadStrategy; 61 61 import org.openstreetmap.josm.io.UploadStrategySpecification; 62 import org.openstreetmap.josm.spi.preferences.Config; 62 63 import org.openstreetmap.josm.tools.GBC; 63 64 import org.openstreetmap.josm.tools.ImageOverlay; … … 252 253 setMinimumSize(new Dimension(600, 350)); 253 254 254 Main.pref.addPreferenceChangeListener(this);255 Config.getPref().addPreferenceChangeListener(this); 255 256 } 256 257 … … 653 654 654 655 private static String getLastChangesetTagFromHistory(String historyKey, List<String> def) { 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));656 Collection<String> history = Config.getPref().getList(historyKey, def); 657 int age = (int) (System.currentTimeMillis() / 1000 - Config.getPref().getInt(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0)); 657 658 if (history != null && age < Main.pref.getLong(BasicUploadSettingsPanel.HISTORY_MAX_AGE_KEY, TimeUnit.HOURS.toMillis(4)) 658 659 && !history.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
r12841 r12846 31 31 import javax.swing.event.DocumentListener; 32 32 33 import org.openstreetmap.josm.Main;34 33 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 35 34 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 39 38 import org.openstreetmap.josm.io.UploadStrategy; 40 39 import org.openstreetmap.josm.io.UploadStrategySpecification; 40 import org.openstreetmap.josm.spi.preferences.Config; 41 41 import org.openstreetmap.josm.tools.Logging; 42 42 … … 323 323 UploadStrategy strategy = UploadStrategy.getFromPreferences(); 324 324 rbStrategy.get(strategy).setSelected(true); 325 int chunkSize = Main.pref.getInt("osm-server.upload-strategy.chunk-size", 1);325 int chunkSize = Config.getPref().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("osm-server.upload-strategy.chunk-size", chunkSize);339 Config.getPref().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
r12841 r12846 36 36 import org.openstreetmap.josm.io.Compression; 37 37 import org.openstreetmap.josm.io.GpxWriter; 38 import org.openstreetmap.josm.spi.preferences.Config; 38 39 import org.openstreetmap.josm.tools.CheckParameterUtil; 39 40 import org.openstreetmap.josm.tools.GBC; … … 110 111 p.add(new JScrollPane(desc), GBC.eop().fill(GBC.BOTH)); 111 112 112 JCheckBox author = new JCheckBox(tr("Add author information"), Main.pref.getBoolean("lastAddAuthor", true));113 JCheckBox author = new JCheckBox(tr("Add author information"), Config.getPref().getBoolean("lastAddAuthor", true)); 113 114 p.add(author, GBC.eol()); 114 115 … … 162 163 setCanceled(false); 163 164 164 Main.pref.putBoolean("lastAddAuthor", author.isSelected());165 Config.getPref().putBoolean("lastAddAuthor", author.isSelected()); 165 166 if (!authorName.getText().isEmpty()) { 166 Main.pref.put("lastAuthorName", authorName.getText());167 Config.getPref().put("lastAuthorName", authorName.getText()); 167 168 } 168 169 if (!copyright.getText().isEmpty()) { 169 Main.pref.put("lastCopyright", copyright.getText());170 Config.getPref().put("lastCopyright", copyright.getText()); 170 171 } 171 172 … … 231 232 } 232 233 if (copyright.getText().isEmpty()) { 233 copyright.setText(Optional.ofNullable(data.getString(META_COPYRIGHT_LICENSE)).orElseGet( 234 () -> Main.pref.get("lastCopyright", "https://creativecommons.org/licenses/by-sa/2.5"))); 234 copyright.setText(Optional.ofNullable(data.getString(META_COPYRIGHT_LICENSE)).orElseGet(() -> Config.getPref().get("lastCopyright", "https://creativecommons.org/licenses/by-sa/2.5"))); 235 235 copyright.setCaretPosition(0); 236 236 } … … 280 280 emailLabel.setEnabled(b); 281 281 if (b) { 282 authorName.setText(Optional.ofNullable(data.getString(META_AUTHOR_NAME)).orElseGet(() -> Main.pref.get("lastAuthorName")));283 email.setText(Optional.ofNullable(data.getString(META_AUTHOR_EMAIL)).orElseGet(() -> Main.pref.get("lastAuthorEmail")));282 authorName.setText(Optional.ofNullable(data.getString(META_AUTHOR_NAME)).orElseGet(() -> Config.getPref().get("lastAuthorName"))); 283 email.setText(Optional.ofNullable(data.getString(META_AUTHOR_EMAIL)).orElseGet(() -> Config.getPref().get("lastAuthorEmail"))); 284 284 } else { 285 285 authorName.setText(""); -
trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxImporter.java
r12671 r12846 10 10 import javax.swing.JOptionPane; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.ExtensionFileFilter; 14 13 import org.openstreetmap.josm.data.gpx.GpxData; … … 20 19 import org.openstreetmap.josm.io.Compression; 21 20 import org.openstreetmap.josm.io.GpxReader; 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 import org.openstreetmap.josm.tools.Logging; 23 23 import org.xml.sax.SAXException; … … 95 95 */ 96 96 public static ExtensionFileFilter getFileFilter() { 97 return ExtensionFileFilter.newFilterWithArchiveExtensions( 98 "gpx", Main.pref.get("save.extension.gpx", "gpx"), tr("GPX Files"), true); 97 return ExtensionFileFilter.newFilterWithArchiveExtensions("gpx", Config.getPref().get("save.extension.gpx", "gpx"), tr("GPX Files"), true); 99 98 } 100 99 … … 148 147 gpxLayer = new GpxLayer(data, gpxLayerName, data.storageFile != null); 149 148 } 150 if ( Main.pref.getBoolean("marker.makeautomarkers", true) && !data.waypoints.isEmpty()) {149 if (Config.getPref().getBoolean("marker.makeautomarkers", true) && !data.waypoints.isEmpty()) { 151 150 markerLayer = new MarkerLayer(data, markerLayerName, data.storageFile, gpxLayer); 152 151 if (markerLayer.data.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/io/importexport/NMEAImporter.java
r12671 r12846 23 23 import org.openstreetmap.josm.io.Compression; 24 24 import org.openstreetmap.josm.io.nmea.NmeaReader; 25 import org.openstreetmap.josm.spi.preferences.Config; 25 26 26 27 /** … … 55 56 GuiHelper.runInEDT(() -> { 56 57 MainApplication.getLayerManager().addLayer(gpxLayer); 57 if ( Main.pref.getBoolean("marker.makeautomarkers", true)) {58 if (Config.getPref().getBoolean("marker.makeautomarkers", true)) { 58 59 MarkerLayer ml = new MarkerLayer(r.data, tr("Markers from {0}", fn), fileFinal, gpxLayer); 59 60 if (!ml.data.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java
r12800 r12846 22 22 import org.openstreetmap.josm.io.OsmWriter; 23 23 import org.openstreetmap.josm.io.OsmWriterFactory; 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 import org.openstreetmap.josm.tools.Logging; 25 26 import org.openstreetmap.josm.tools.Utils; … … 90 91 91 92 doSave(file, layer); 92 if ((noBackup || ! Main.pref.getBoolean("save.keepbackup", false)) && tmpFile != null) {93 if ((noBackup || !Config.getPref().getBoolean("save.keepbackup", false)) && tmpFile != null) { 93 94 Utils.deleteFile(tmpFile); 94 95 } -
trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java
r12671 r12846 46 46 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 47 47 import org.openstreetmap.josm.gui.util.GuiHelper; 48 import org.openstreetmap.josm.spi.preferences.Config; 48 49 import org.openstreetmap.josm.tools.Logging; 49 50 import org.openstreetmap.josm.tools.Utils; … … 193 194 String filename = String.format("%1$s_%2$tY%2$tm%2$td_%2$tH%2$tM%2$tS%2$tL%3$s", 194 195 layer.layerFileName, now, index == 0 ? "" : ('_' + Integer.toString(index))); 195 File result = new File(autosaveDir, filename + '.' + Main.pref.get("autosave.extension", "osm"));196 File result = new File(autosaveDir, filename + '.' + Config.getPref().get("autosave.extension", "osm")); 196 197 try { 197 198 if (index > PROP_INDEX_LIMIT.get()) -
trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
r12671 r12846 23 23 import javax.swing.SwingUtilities; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.actions.SaveActionBase; 27 26 import org.openstreetmap.josm.data.Bounds; … … 43 42 import org.openstreetmap.josm.io.OsmApi; 44 43 import org.openstreetmap.josm.io.XmlWriter; 44 import org.openstreetmap.josm.spi.preferences.Config; 45 45 import org.openstreetmap.josm.tools.ColorHelper; 46 46 import org.openstreetmap.josm.tools.ImageProvider; … … 165 165 Point p = mv.getPoint(noteData.getSelectedNote().getLatLon()); 166 166 167 g.setColor(ColorHelper.html2color( Main.pref.get("color.selected")));167 g.setColor(ColorHelper.html2color(Config.getPref().get("color.selected"))); 168 168 g.drawRect(p.x - (iconWidth / 2), p.y - iconHeight, 169 169 iconWidth - 1, iconHeight - 1); -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r12809 r12846 104 104 import org.openstreetmap.josm.gui.widgets.FileChooserManager; 105 105 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 106 import org.openstreetmap.josm.spi.preferences.Config; 106 107 import org.openstreetmap.josm.tools.AlphanumComparator; 107 108 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 430 431 @Override public void paint(final Graphics2D g, final MapView mv, Bounds box) { 431 432 boolean active = mv.getLayerManager().getActiveLayer() == this; 432 boolean inactive = !active && Main.pref.getBoolean("draw.data.inactive_color", true);433 boolean inactive = !active && Config.getPref().getBoolean("draw.data.inactive_color", true); 433 434 boolean virtual = !inactive && mv.isVirtualNodesEnabled(); 434 435 435 436 // draw the hatched area for non-downloaded region. only draw if we're the active 436 437 // and bounds are defined; don't draw for inactive layers or loaded GPX files etc 437 if (active && Main.pref.getBoolean("draw.data.downloaded_area", true) && !data.getDataSources().isEmpty()) {438 if (active && Config.getPref().getBoolean("draw.data.downloaded_area", true) && !data.getDataSources().isEmpty()) { 438 439 // initialize area with current viewport 439 440 Rectangle b = mv.getBounds(); … … 872 873 } 873 874 MainApplication.getLayerManager().addLayer(gpxLayer); 874 if ( Main.pref.getBoolean("marker.makeautomarkers", true) && !gpxData.waypoints.isEmpty()) {875 if (Config.getPref().getBoolean("marker.makeautomarkers", true) && !gpxData.waypoints.isEmpty()) { 875 876 MainApplication.getLayerManager().addLayer(new MarkerLayer(gpxData, tr("Converted from: {0}", getName()), null, gpxLayer)); 876 877 } … … 1089 1090 File file = getAssociatedFile(); 1090 1091 if (file == null && isRenamed()) { 1091 StringBuilder filename = new StringBuilder( Main.pref.get("lastDirectory")).append('/').append(getName());1092 StringBuilder filename = new StringBuilder(Config.getPref().get("lastDirectory")).append('/').append(getName()); 1092 1093 if (!OsmImporter.FILE_FILTER.acceptName(filename.toString())) { 1093 1094 filename.append('.').append(extension); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r12841 r12846 79 79 import org.openstreetmap.josm.gui.widgets.JosmTextField; 80 80 import org.openstreetmap.josm.io.GpxReader; 81 import org.openstreetmap.josm.spi.preferences.Config; 81 82 import org.openstreetmap.josm.tools.ExifReader; 82 83 import org.openstreetmap.josm.tools.GBC; … … 172 173 break; 173 174 case DONE: 174 Main.pref.put("geoimage.timezone", timezone.formatTimezone());175 Main.pref.put("geoimage.delta", delta.formatOffset());176 Main.pref.putBoolean("geoimage.showThumbs", yLayer.useThumbs);175 Config.getPref().put("geoimage.timezone", timezone.formatTimezone()); 176 Config.getPref().put("geoimage.delta", delta.formatOffset()); 177 Config.getPref().putBoolean("geoimage.showThumbs", yLayer.useThumbs); 177 178 178 179 yLayer.useThumbs = cbShowThumbs.isSelected(); … … 421 422 JosmComboBox<String> cbTimezones = new JosmComboBox<>(vtTimezones.toArray(new String[vtTimezones.size()])); 422 423 423 String tzId = Main.pref.get("geoimage.timezoneid", "");424 String tzId = Config.getPref().get("geoimage.timezoneid", ""); 424 425 TimeZone defaultTz; 425 426 if (tzId.isEmpty()) { … … 529 530 String tzValue = selectedTz.substring(pos + 1, selectedTz.length() - 1); 530 531 531 Main.pref.put("geoimage.timezoneid", tzId);532 Config.getPref().put("geoimage.timezoneid", tzId); 532 533 tfOffset.setText(Offset.milliseconds(delta).formatOffset()); 533 534 tfTimezone.setText(tzValue); … … 584 585 585 586 try { 586 timezone = Timezone.parseTimezone(Optional.ofNullable( Main.pref.get("geoimage.timezone", "0:00")).orElse("0:00"));587 timezone = Timezone.parseTimezone(Optional.ofNullable(Config.getPref().get("geoimage.timezone", "0:00")).orElse("0:00")); 587 588 } catch (ParseException e) { 588 589 timezone = Timezone.ZERO; … … 593 594 594 595 try { 595 delta = Offset.parseOffset( Main.pref.get("geoimage.delta", "0"));596 delta = Offset.parseOffset(Config.getPref().get("geoimage.delta", "0")); 596 597 } catch (ParseException e) { 597 598 delta = Offset.ZERO; … … 627 628 labelPosition.setEnabled(cbExifImg.isEnabled() || cbTaggedImg.isEnabled()); 628 629 629 boolean ticked = yLayer.thumbsLoaded || Main.pref.getBoolean("geoimage.showThumbs", false);630 boolean ticked = yLayer.thumbsLoaded || Config.getPref().getBoolean("geoimage.showThumbs", false); 630 631 cbShowThumbs = new JCheckBox(tr("Show Thumbnail images on the map"), ticked); 631 632 cbShowThumbs.setEnabled(!yLayer.thumbsLoaded); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r12620 r12846 26 26 import javax.swing.JComponent; 27 27 28 import org.openstreetmap.josm. Main;28 import org.openstreetmap.josm.spi.preferences.Config; 29 29 import org.openstreetmap.josm.tools.ExifReader; 30 30 import org.openstreetmap.josm.tools.Logging; … … 58 58 private String osdText; 59 59 60 private static final int DRAG_BUTTON = Main.pref.getBoolean("geoimage.agpifo-style-drag-and-zoom", false) ? 1 : 3;60 private static final int DRAG_BUTTON = Config.getPref().getBoolean("geoimage.agpifo-style-drag-and-zoom", false) ? 1 : 3; 61 61 private static final int ZOOM_BUTTON = DRAG_BUTTON == 1 ? 3 : 1; 62 62 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java
r12630 r12846 22 22 import org.openstreetmap.josm.data.cache.JCSCacheManager; 23 23 import org.openstreetmap.josm.gui.MainApplication; 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 import org.openstreetmap.josm.tools.ExifReader; 25 26 import org.openstreetmap.josm.tools.Logging; … … 38 39 private MediaTracker tracker; 39 40 private ICacheAccess<String, BufferedImageCacheEntry> cache; 40 private final boolean cacheOff = Main.pref.getBoolean("geoimage.noThumbnailCache", false);41 private final boolean cacheOff = Config.getPref().getBoolean("geoimage.noThumbnailCache", false); 41 42 42 43 private ThumbsLoader(Collection<ImageEntry> data, GeoImageLayer layer) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java
r12841 r12846 36 36 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 37 37 import org.openstreetmap.josm.gui.widgets.UrlLabel; 38 import org.openstreetmap.josm.spi.preferences.Config; 38 39 import org.openstreetmap.josm.tools.GBC; 39 40 import org.openstreetmap.josm.tools.ImageProvider; … … 119 120 for (Marker marker : layer.data) { 120 121 final Node node = new Node(marker.getCoor()); 121 final Collection<String> mapping = Main.pref.getList("gpx.to-osm-mapping", Arrays.asList(122 final Collection<String> mapping = Config.getPref().getList("gpx.to-osm-mapping", Arrays.asList( 122 123 GpxConstants.GPX_NAME, "name", 123 124 GpxConstants.GPX_DESC, "description", -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java
r12841 r12846 19 19 import org.openstreetmap.josm.gui.layer.GpxLayer; 20 20 import org.openstreetmap.josm.gui.widgets.DateEditorWithSlider; 21 import org.openstreetmap.josm.spi.preferences.Config; 21 22 import org.openstreetmap.josm.tools.GBC; 22 23 … … 105 106 Main.pref.putLong(prefDateMin, dateFrom.getDate().getTime()); 106 107 Main.pref.putLong(prefDateMax, dateTo.getDate().getTime()); 107 Main.pref.putBoolean(prefDate0, noTimestampCb.isSelected());108 Config.getPref().putBoolean(prefDate0, noTimestampCb.isSelected()); 108 109 } 109 110 … … 117 118 long t2 = Main.pref.getLong(prefDateMax, 0); 118 119 if (t2 != 0) dateTo.setDate(new Date(t2)); 119 noTimestampCb.setSelected( Main.pref.getBoolean(prefDate0, false));120 noTimestampCb.setSelected(Config.getPref().getBoolean(prefDate0, false)); 120 121 } 121 122 -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongPanel.java
r12841 r12846 19 19 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 20 20 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 21 import org.openstreetmap.josm.spi.preferences.Config; 21 22 import org.openstreetmap.josm.tools.GBC; 22 23 import org.openstreetmap.josm.tools.ImageProvider; … … 60 61 this.prefNear = prefNear; 61 62 62 cbDownloadOsmData = new JCheckBox(tr("OpenStreetMap data"), Main.pref.getBoolean(prefOsm, true));63 cbDownloadOsmData = new JCheckBox(tr("OpenStreetMap data"), Config.getPref().getBoolean(prefOsm, true)); 63 64 cbDownloadOsmData.setToolTipText(tr("Select to download OSM data.")); 64 65 add(cbDownloadOsmData, GBC.std().insets(1, 5, 1, 5)); 65 cbDownloadGpxData = new JCheckBox(tr("Raw GPS data"), Main.pref.getBoolean(prefGps, false));66 cbDownloadGpxData = new JCheckBox(tr("Raw GPS data"), Config.getPref().getBoolean(prefGps, false)); 66 67 cbDownloadGpxData.setToolTipText(tr("Select to download GPS traces.")); 67 68 add(cbDownloadGpxData, GBC.eol().insets(5, 5, 1, 5)); … … 85 86 add(new JLabel(tr("Download near:")), GBC.eol()); 86 87 downloadNear = new JList<>(new String[]{tr("track only"), tr("waypoints only"), tr("track and waypoints")}); 87 downloadNear.setSelectedIndex( Main.pref.getInt(prefNear, 0));88 downloadNear.setSelectedIndex(Config.getPref().getInt(prefNear, 0)); 88 89 add(downloadNear, GBC.eol()); 89 90 } else { … … 138 139 */ 139 140 protected final void rememberSettings() { 140 Main.pref.putBoolean(prefOsm, isDownloadOsmData());141 Main.pref.putBoolean(prefGps, isDownloadGpxData());142 Main.pref.putDouble(prefDist, getDistance());143 Main.pref.putDouble(prefArea, getArea());141 Config.getPref().putBoolean(prefOsm, isDownloadOsmData()); 142 Config.getPref().putBoolean(prefGps, isDownloadGpxData()); 143 Config.getPref().putDouble(prefDist, getDistance()); 144 Config.getPref().putDouble(prefArea, getArea()); 144 145 if (prefNear != null) { 145 Main.pref.putInt(prefNear, getNear());146 Config.getPref().putInt(prefNear, getNear()); 146 147 } 147 148 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r12841 r12846 53 53 import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationListener; 54 54 import org.openstreetmap.josm.io.CachedFile; 55 import org.openstreetmap.josm.spi.preferences.Config; 55 56 import org.openstreetmap.josm.tools.ColorScale; 56 57 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 183 184 184 185 private void setupColors() { 185 hdopAlpha = Main.pref.getInt("hdop.color.alpha", -1);186 hdopAlpha = Config.getPref().getInt("hdop.color.alpha", -1); 186 187 velocityScale = ColorScale.createHSBScale(256); 187 188 /** Colors (without custom alpha channel, if given) for HDOP painting. **/ … … 320 321 colorModeDynamic = Main.pref.getBoolean("draw.rawgps.colors.dynamic", spec, false); 321 322 /* good HDOP's are between 1 and 3, very bad HDOP's go into 3 digit values */ 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;323 hdoprange = Config.getPref().getInt("hdop.range", 7); 324 minTrackDurationForTimeColoring = Config.getPref().getInt("draw.rawgps.date-coloring-min-dt", 60); 325 largePointAlpha = Config.getPref().getInt("draw.rawgps.large.alpha", -1) & 0xFF; 325 326 326 327 // get heatmap parameters … … 428 429 // set hints for the render 429 430 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, 430 Main.pref.getBoolean("mappaint.gpx.use-antialiasing", false) ?431 Config.getPref().getBoolean("mappaint.gpx.use-antialiasing", false) ? 431 432 RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); 432 433 -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r12725 r12846 32 32 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 33 33 import org.openstreetmap.josm.io.audio.AudioUtil; 34 import org.openstreetmap.josm.spi.preferences.Config; 34 35 import org.openstreetmap.josm.tools.ImageProvider; 35 36 import org.openstreetmap.josm.tools.Utils; … … 138 139 boolean timedMarkersOmitted = false; 139 140 boolean untimedMarkersOmitted = false; 140 double snapDistance = Main.pref.getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3);141 double snapDistance = Config.getPref().getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3); 141 142 // about 25 m 142 143 WayPoint wayPointFromTimeStamp = null; … … 171 172 172 173 // (a) try explicit timestamped waypoints - unless suppressed 173 if (hasWaypoints && Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true)) {174 if (hasWaypoints && Config.getPref().getBoolean("marker.audiofromexplicitwaypoints", true)) { 174 175 for (WayPoint w : layer.data.waypoints) { 175 176 if (w.time > firstTime) { … … 182 183 183 184 // (b) try explicit waypoints without timestamps - unless suppressed 184 if (hasWaypoints && Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true)) {185 if (hasWaypoints && Config.getPref().getBoolean("marker.audiofromuntimedwaypoints", true)) { 185 186 for (WayPoint w : layer.data.waypoints) { 186 187 if (waypoints.contains(w)) { … … 202 203 203 204 // (c) use explicitly named track points, again unless suppressed 204 if (layer.data.tracks != null && Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false)205 if (layer.data.tracks != null && Config.getPref().getBoolean("marker.audiofromnamedtrackpoints", false) 205 206 && !layer.data.tracks.isEmpty()) { 206 207 for (GpxTrack track : layer.data.tracks) { … … 216 217 217 218 // (d) use timestamp of file as location on track 218 if (hasTracks && Main.pref.getBoolean("marker.audiofromwavtimestamps", false)) {219 if (hasTracks && Config.getPref().getBoolean("marker.audiofromwavtimestamps", false)) { 219 220 double lastModified = audioFile.lastModified() / 1000.0; // lastModified is in milliseconds 220 221 double duration = AudioUtil.getCalibratedDuration(audioFile); 221 222 double startTime = lastModified - duration; 222 223 startTime = firstStartTime + (startTime - firstStartTime) 223 / Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */);224 / Config.getPref().getDouble("audio.calibration", 1.0 /* default, ratio */); 224 225 WayPoint w1 = null; 225 226 WayPoint w2 = null; … … 259 260 260 261 // (f) simply add a single marker at the start of the track 261 if (( Main.pref.getBoolean("marker.audiofromstart") || waypoints.isEmpty()) && hasTracks) {262 if ((Config.getPref().getBoolean("marker.audiofromstart") || waypoints.isEmpty()) && hasTracks) { 262 263 boolean gotOne = false; 263 264 for (GpxTrack track : layer.data.tracks) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportImagesAction.java
r12671 r12846 21 21 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 22 22 import org.openstreetmap.josm.gui.widgets.FileChooserManager; 23 import org.openstreetmap.josm.spi.preferences.Config; 23 24 import org.openstreetmap.josm.tools.ImageProvider; 24 25 import org.openstreetmap.josm.tools.Utils; … … 68 69 } 69 70 JpgImporter importer = new JpgImporter(layer); 70 AbstractFileChooser fc = new FileChooserManager(true, "geoimage.lastdirectory", Main.pref.get("lastDirectory")).71 AbstractFileChooser fc = new FileChooserManager(true, "geoimage.lastdirectory", Config.getPref().get("lastDirectory")). 71 72 createFileChooser(true, null, importer.filter, JFileChooser.FILES_AND_DIRECTORIES).openFileChooser(); 72 73 if (fc != null) { -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/ReprojectionTile.java
r12841 r12846 15 15 import org.openstreetmap.josm.data.projection.Projections; 16 16 import org.openstreetmap.josm.gui.MainApplication; 17 import org.openstreetmap.josm.spi.preferences.Config; 17 18 import org.openstreetmap.josm.tools.ImageWarp; 18 19 import org.openstreetmap.josm.tools.Utils; … … 113 114 double scaleMapView = MainApplication.getMap().mapView.getScale(); 114 115 ImageWarp.Interpolation interpolation; 115 switch ( Main.pref.get("imagery.warp.pixel-interpolation", "bilinear")) {116 switch (Config.getPref().get("imagery.warp.pixel-interpolation", "bilinear")) { 116 117 case "nearest_neighbor": 117 118 interpolation = ImageWarp.Interpolation.NEAREST_NEIGHBOR; … … 159 160 160 161 ImageWarp.PointTransform transform; 161 int stride = Main.pref.getInt("imagery.warp.projection-interpolation.stride", 7);162 int stride = Config.getPref().getInt("imagery.warp.projection-interpolation.stride", 7); 162 163 if (stride > 0) { 163 164 transform = new ImageWarp.GridTransform(pointTransform, stride); -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileSourceDisplaySettings.java
r12713 r12846 13 13 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 14 14 import org.openstreetmap.josm.io.session.SessionAwareReadApply; 15 import org.openstreetmap.josm.spi.preferences.Config; 15 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 16 17 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 101 102 for (String p : prefixes) { 102 103 String key = p + "." + name; 103 boolean currentValue = Main.pref.getBoolean(key, true);104 if (! Main.pref.get(key).isEmpty()) {104 boolean currentValue = Config.getPref().getBoolean(key, true); 105 if (!Config.getPref().get(key).isEmpty()) { 105 106 value = currentValue; 106 107 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java
r12725 r12846 11 11 import javax.swing.border.Border; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.coor.LatLon; 15 14 import org.openstreetmap.josm.gui.MainApplication; 16 15 import org.openstreetmap.josm.gui.MapView; 16 import org.openstreetmap.josm.spi.preferences.Config; 17 17 import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider; 18 18 … … 67 67 68 68 String labelText = getText(); 69 if (labelText != null && Main.pref.getBoolean("marker.buttonlabels", true)) {69 if (labelText != null && Config.getPref().getBoolean("marker.buttonlabels", true)) { 70 70 g.drawString(labelText, screen.x+4, screen.y+2); 71 71 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r12725 r12846 51 51 import org.openstreetmap.josm.gui.layer.gpx.ConvertToDataLayerAction; 52 52 import org.openstreetmap.josm.io.audio.AudioPlayer; 53 import org.openstreetmap.josm.spi.preferences.Config; 53 54 import org.openstreetmap.josm.tools.ImageProvider; 54 55 import org.openstreetmap.josm.tools.Logging; … … 230 231 components.add(SeparatorLayerAction.INSTANCE); 231 232 components.add(new SynchronizeAudio()); 232 if ( Main.pref.getBoolean("marker.traceaudio", true)) {233 if (Config.getPref().getBoolean("marker.traceaudio", true)) { 233 234 components.add(new MoveAudio()); 234 235 } … … 439 440 */ 440 441 private boolean isTextOrIconShown() { 441 String current = Main.pref.get("marker.show "+getName(), "show");442 String current = Config.getPref().get("marker.show "+getName(), "show"); 442 443 return "show".equalsIgnoreCase(current); 443 444 } … … 491 492 @Override 492 493 public void actionPerformed(ActionEvent e) { 493 Main.pref.put("marker.show "+layer.getName(), layer.isTextOrIconShown() ? "hide" : "show");494 Config.getPref().put("marker.show "+layer.getName(), layer.isTextOrIconShown() ? "hide" : "show"); 494 495 layer.invalidate(); 495 496 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r12841 r12846 28 28 import org.openstreetmap.josm.io.audio.AudioPlayer; 29 29 import org.openstreetmap.josm.io.audio.AudioUtil; 30 import org.openstreetmap.josm.spi.preferences.Config; 30 31 31 32 /** … … 60 61 private PlayHeadMarker() { 61 62 super(LatLon.ZERO, "", 62 Main.pref.get("marker.audiotracericon", "audio-tracer"),63 Config.getPref().get("marker.audiotracericon", "audio-tracer"), 63 64 null, -1.0, 0.0); 64 enabled = Main.pref.getBoolean("marker.traceaudio", true);65 enabled = Config.getPref().getBoolean("marker.traceaudio", true); 65 66 if (!enabled) return; 66 dropTolerance = Main.pref.getInt("marker.playHeadDropTolerance", 50);67 dropTolerance = Config.getPref().getInt("marker.playHeadDropTolerance", 50); 67 68 if (MainApplication.isDisplayingMapView()) { 68 69 MapFrame map = MainApplication.getMap(); … … 294 295 jumpToMarker = true; 295 296 if (timer == null) { 296 animationInterval = Main.pref.getDouble("marker.audioanimationinterval", 1.0); //milliseconds297 animationInterval = Config.getPref().getDouble("marker.audioanimationinterval", 1.0); //milliseconds 297 298 timer = new Timer((int) (animationInterval * 1000.0), e -> timerAction()); 298 299 timer.setInitialDelay(0); -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r12700 r12846 11 11 import java.util.Map.Entry; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 15 14 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; … … 33 32 import org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel; 34 33 import org.openstreetmap.josm.gui.util.GuiHelper; 34 import org.openstreetmap.josm.spi.preferences.Config; 35 35 import org.openstreetmap.josm.tools.Pair; 36 36 import org.openstreetmap.josm.tools.Utils; … … 74 74 public ElemStyles() { 75 75 styleSources = new ArrayList<>(); 76 Main.pref.addPreferenceChangeListener(this);76 Config.getPref().addPreferenceChangeListener(this); 77 77 } 78 78 … … 517 517 * Determines whether primitive has area-type {@link StyleElement}s, but 518 518 * no line-type StyleElements. 519 * 519 * 520 520 * {@link TextElement} is ignored, as it can be both line and area-type. 521 521 * @param p the OSM primitive … … 551 551 * 552 552 * In addition, it adds an intermediate cache for the preference values, 553 * as frequent preference lookup (using <code> Main.pref.get()</code>) for553 * as frequent preference lookup (using <code>Config.getPref().get()</code>) for 554 554 * each primitive can be slow during rendering. 555 555 * … … 564 564 res = preferenceCache.get(key); 565 565 } else { 566 res = Main.pref.get(key, null);566 res = Config.getPref().get(key, null); 567 567 preferenceCache.put(key, res); 568 568 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r12841 r12846 27 27 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 28 28 import org.openstreetmap.josm.io.CachedFile; 29 import org.openstreetmap.josm.spi.preferences.Config; 29 30 import org.openstreetmap.josm.tools.ImageProvider; 30 31 import org.openstreetmap.josm.tools.ListenerList; … … 256 257 } 257 258 258 Collection<String> prefIconDirs = Main.pref.getList("mappaint.icon.sources");259 Collection<String> prefIconDirs = Config.getPref().getList("mappaint.icon.sources"); 259 260 for (String fileset : prefIconDirs) { 260 261 String[] a; … … 271 272 } 272 273 273 if ( Main.pref.getBoolean("mappaint.icon.enable-defaults", true)) {274 if (Config.getPref().getBoolean("mappaint.icon.enable-defaults", true)) { 274 275 /* don't prefix icon path, as it should be generic */ 275 276 dirs.add("resource://images/"); … … 299 300 final long startTime = System.currentTimeMillis(); 300 301 source.loadStyleSource(); 301 if ( Main.pref.getBoolean("mappaint.auto_reload_local_styles", true) && source.isLocal()) {302 if (Config.getPref().getBoolean("mappaint.auto_reload_local_styles", true) && source.isLocal()) { 302 303 try { 303 304 Main.fileWatcher.registerSource(source); -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSetting.java
r12841 r12846 2 2 package org.openstreetmap.josm.gui.mappaint; 3 3 4 import org.openstreetmap.josm. Main;4 import org.openstreetmap.josm.spi.preferences.Config; 5 5 import org.openstreetmap.josm.tools.Logging; 6 6 … … 66 66 @Override 67 67 public Object getValue() { 68 String val = Main.pref.get(prefKey, null);68 String val = Config.getPref().get(prefKey, null); 69 69 if (val == null) return def; 70 70 return Boolean.valueOf(val); … … 77 77 boolean b = (Boolean) o; 78 78 if (b == def) { 79 Main.pref.put(prefKey, null);79 Config.getPref().put(prefKey, null); 80 80 } else { 81 Main.pref.putBoolean(prefKey, b);81 Config.getPref().putBoolean(prefKey, b); 82 82 } 83 83 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r12756 r12846 28 28 import org.openstreetmap.josm.data.osm.OsmPrimitive; 29 29 import org.openstreetmap.josm.data.osm.Way; 30 import org.openstreetmap.josm.data.osm.search.SearchParseError;31 30 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 32 31 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match; 32 import org.openstreetmap.josm.data.osm.search.SearchParseError; 33 33 import org.openstreetmap.josm.gui.mappaint.Cascade; 34 34 import org.openstreetmap.josm.gui.mappaint.Environment; -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r12649 r12846 32 32 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 33 33 import org.openstreetmap.josm.data.osm.AbstractPrimitive.KeyValueVisitor; 34 import org.openstreetmap.josm.data.preferences.sources.SourceEntry;35 34 import org.openstreetmap.josm.data.osm.Node; 36 35 import org.openstreetmap.josm.data.osm.OsmPrimitive; 37 36 import org.openstreetmap.josm.data.osm.Relation; 38 37 import org.openstreetmap.josm.data.osm.Way; 38 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; 39 39 import org.openstreetmap.josm.gui.mappaint.Cascade; 40 40 import org.openstreetmap.josm.gui.mappaint.Environment; -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r12841 r12846 7 7 import java.util.Objects; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 10 import org.openstreetmap.josm.data.osm.Relation; … … 17 16 import org.openstreetmap.josm.gui.mappaint.Environment; 18 17 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 18 import org.openstreetmap.josm.spi.preferences.Config; 19 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 20 20 import org.openstreetmap.josm.tools.HiDPISupport; … … 90 90 ); 91 91 92 fillImage.alpha = Utils.clamp( Main.pref.getInt("mappaint.fill-image-alpha", 255), 0, 255);92 fillImage.alpha = Utils.clamp(Config.getPref().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
r12841 r12846 12 12 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 import org.openstreetmap.josm.spi.preferences.Config; 14 15 import org.openstreetmap.josm.tools.LanguageInfo; 15 16 … … 233 234 */ 234 235 public final void initNameTagsFromPreferences() { 235 if ( Main.pref== null) {236 if (Config.getPref() == null) { 236 237 this.nameTags = new ArrayList<>(Arrays.asList(DEFAULT_NAME_TAGS)); 237 238 this.nameComplementTags = new ArrayList<>(Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS)); 238 239 } else { 239 240 this.nameTags = new ArrayList<>( 240 Main.pref.getList("mappaint.nameOrder", Arrays.asList(DEFAULT_NAME_TAGS))241 Config.getPref().getList("mappaint.nameOrder", Arrays.asList(DEFAULT_NAME_TAGS)) 241 242 ); 242 243 this.nameComplementTags = new ArrayList<>( 243 Main.pref.getList("mappaint.nameComplementOrder", Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS))244 Config.getPref().getList("mappaint.nameComplementOrder", Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS)) 244 245 ); 245 246 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r12841 r12846 10 10 import java.util.stream.IntStream; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.osm.Node; 14 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 25 24 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.BoxProvider; 26 25 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.SimpleBoxProvider; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.CheckParameterUtil; 28 28 import org.openstreetmap.josm.tools.Logging; … … 196 196 mapImage.offsetY = Math.round(offsetYF); 197 197 198 mapImage.alpha = Utils.clamp( Main.pref.getInt("mappaint.icon-image-alpha", 255), 0, 255);198 mapImage.alpha = Utils.clamp(Config.getPref().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) { … … 356 356 // This is only executed once, so no performance concerns. 357 357 // However, it would be better, if the settings could be changed at runtime. 358 int size = max( 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) 358 int size = max(Config.getPref().getInt("mappaint.node.selected-size", 5), 359 Config.getPref().getInt("mappaint.node.unselected-size", 3), 360 Config.getPref().getInt("mappaint.node.connection-size", 5), 361 Config.getPref().getInt("mappaint.node.tagged-size", 3) 363 362 ); 364 363 return new SimpleBoxProvider(new Rectangle(-size/2, -size/2, size, size)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java
r12841 r12846 7 7 import java.util.Objects; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 10 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; … … 15 14 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 16 15 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction.RelativeFloat; 16 import org.openstreetmap.josm.spi.preferences.Config; 17 17 18 18 /** … … 148 148 s = defaultFontSize; 149 149 if (s == null) { 150 defaultFontSize = s = (float) Main.pref.getInt("mappaint.fontsize", 8);150 defaultFontSize = s = (float) Config.getPref().getInt("mappaint.fontsize", 8); 151 151 } 152 152 } … … 161 161 n = defaultFontName; 162 162 if (n == null) { 163 defaultFontName = n = Main.pref.get("mappaint.font", "Droid Sans");163 defaultFontName = n = Config.getPref().get("mappaint.font", "Droid Sans"); 164 164 } 165 165 } -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r12841 r12846 93 93 import org.openstreetmap.josm.io.OnlineResource; 94 94 import org.openstreetmap.josm.io.OsmTransferException; 95 import org.openstreetmap.josm.spi.preferences.Config; 95 96 import org.openstreetmap.josm.tools.GBC; 96 97 import org.openstreetmap.josm.tools.ImageOverlay; … … 423 424 424 425 if (!iconPaths.isEmpty()) { 425 if ( Main.pref.putList(iconPref, iconPaths)) {426 if (Config.getPref().putList(iconPref, iconPaths)) { 426 427 changed = true; 427 428 } 428 } else if ( Main.pref.putList(iconPref, null)) {429 } else if (Config.getPref().putList(iconPref, null)) { 429 430 changed = true; 430 431 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r12841 r12846 71 71 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 72 72 import org.openstreetmap.josm.gui.util.GuiHelper; 73 import org.openstreetmap.josm.spi.preferences.Config; 73 74 import org.openstreetmap.josm.tools.GBC; 74 75 import org.openstreetmap.josm.tools.ImageProvider; … … 488 489 private void setActionAndAdapt(ActionDefinition action) { 489 490 this.act = action; 490 doNotHide.setSelected( Main.pref.getBoolean("toolbar.always-visible", true));491 doNotHide.setSelected(Config.getPref().getBoolean("toolbar.always-visible", true)); 491 492 remove.setVisible(act != null); 492 493 shortcutEdit.setVisible(act != null); … … 502 503 // remove the button from toolbar preferences 503 504 t.remove(res); 504 Main.pref.putList("toolbar", t);505 Config.getPref().putList("toolbar", t); 505 506 MainApplication.getToolbar().refreshToolbarControl(); 506 507 } … … 532 533 public void actionPerformed(ActionEvent e) { 533 534 boolean sel = ((JCheckBoxMenuItem) e.getSource()).getState(); 534 Main.pref.putBoolean("toolbar.always-visible", sel);535 Main.pref.putBoolean("menu.always-visible", sel);535 Config.getPref().putBoolean("toolbar.always-visible", sel); 536 Config.getPref().putBoolean("menu.always-visible", sel); 536 537 } 537 538 }); … … 987 988 t = Collections.singletonList(EMPTY_TOOLBAR_MARKER); 988 989 } 989 Main.pref.putList("toolbar", t);990 Config.getPref().putList("toolbar", t); 990 991 MainApplication.getToolbar().refreshToolbarControl(); 991 992 return false; … … 1002 1003 control.setComponentPopupMenu(popupMenu); 1003 1004 }); 1004 Main.pref.addPreferenceChangeListener(e -> {1005 Config.getPref().addPreferenceChangeListener(e -> { 1005 1006 if ("toolbar.visible".equals(e.getKey())) { 1006 1007 refreshToolbarControl(); … … 1074 1075 public static Collection<String> getToolString() { 1075 1076 1076 Collection<String> toolStr = Main.pref.getList("toolbar", Arrays.asList(deftoolbar));1077 Collection<String> toolStr = Config.getPref().getList("toolbar", Arrays.asList(deftoolbar)); 1077 1078 if (toolStr == null || toolStr.isEmpty()) { 1078 1079 toolStr = Arrays.asList(deftoolbar); … … 1188 1189 } 1189 1190 1190 boolean visible = Main.pref.getBoolean("toolbar.visible", true);1191 boolean visible = Config.getPref().getBoolean("toolbar.visible", true); 1191 1192 1192 1193 control.setFocusTraversalKeysEnabled(!unregisterTab); … … 1214 1215 } 1215 1216 } 1216 Main.pref.putList("toolbar", t);1217 Config.getPref().putList("toolbar", t); 1217 1218 MainApplication.getToolbar().refreshToolbarControl(); 1218 1219 } -
trunk/src/org/openstreetmap/josm/gui/preferences/audio/AudioPreference.java
r12841 r12846 11 11 import javax.swing.JPanel; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 15 14 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; … … 18 17 import org.openstreetmap.josm.gui.widgets.JosmTextField; 19 18 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 19 import org.openstreetmap.josm.spi.preferences.Config; 20 20 import org.openstreetmap.josm.tools.GBC; 21 21 … … 60 60 61 61 // audioMenuVisible 62 audioMenuVisible.setSelected(! Main.pref.getBoolean("audio.menuinvisible"));62 audioMenuVisible.setSelected(!Config.getPref().getBoolean("audio.menuinvisible")); 63 63 audioMenuVisible.setToolTipText(tr("Show or hide the audio menu entry on the main menu bar.")); 64 64 audio.add(audioMenuVisible, GBC.eol().insets(0, 0, 0, 0)); 65 65 66 66 // audioTraceVisible 67 markerAudioTraceVisible.setSelected( Main.pref.getBoolean("marker.traceaudio", true));67 markerAudioTraceVisible.setSelected(Config.getPref().getBoolean("marker.traceaudio", true)); 68 68 markerAudioTraceVisible.setToolTipText( 69 69 tr("Display a moving icon representing the point on the synchronized track where the audio currently playing was recorded.")); … … 71 71 72 72 // buttonLabels 73 markerButtonLabels.setSelected( Main.pref.getBoolean("marker.buttonlabels", true));73 markerButtonLabels.setSelected(Config.getPref().getBoolean("marker.buttonlabels", true)); 74 74 markerButtonLabels.setToolTipText(tr("Put text labels against audio (and image and web) markers as well as their button icons.")); 75 75 audio.add(markerButtonLabels, GBC.eol().insets(0, 0, 0, 0)); … … 78 78 79 79 // audioMarkersFromExplicitWaypoints 80 audioMarkersFromExplicitWaypoints.setSelected( Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true));80 audioMarkersFromExplicitWaypoints.setSelected(Config.getPref().getBoolean("marker.audiofromexplicitwaypoints", true)); 81 81 audioMarkersFromExplicitWaypoints.setToolTipText(tr("When importing audio, apply it to any waypoints in the GPX layer.")); 82 82 audio.add(audioMarkersFromExplicitWaypoints, GBC.eol().insets(10, 0, 0, 0)); 83 83 84 84 // audioMarkersFromUntimedWaypoints 85 audioMarkersFromUntimedWaypoints.setSelected( Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true));85 audioMarkersFromUntimedWaypoints.setSelected(Config.getPref().getBoolean("marker.audiofromuntimedwaypoints", true)); 86 86 audioMarkersFromUntimedWaypoints.setToolTipText(tr("When importing audio, apply it to any waypoints in the GPX layer.")); 87 87 audio.add(audioMarkersFromUntimedWaypoints, GBC.eol().insets(10, 0, 0, 0)); 88 88 89 89 // audioMarkersFromNamedTrackpoints 90 audioMarkersFromNamedTrackpoints.setSelected( Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false));90 audioMarkersFromNamedTrackpoints.setSelected(Config.getPref().getBoolean("marker.audiofromnamedtrackpoints", false)); 91 91 audioMarkersFromNamedTrackpoints.setToolTipText( 92 92 tr("Automatically create audio markers from trackpoints (rather than explicit waypoints) with names or descriptions.")); … … 94 94 95 95 // audioMarkersFromWavTimestamps 96 audioMarkersFromWavTimestamps.setSelected( Main.pref.getBoolean("marker.audiofromwavtimestamps", false));96 audioMarkersFromWavTimestamps.setSelected(Config.getPref().getBoolean("marker.audiofromwavtimestamps", false)); 97 97 audioMarkersFromWavTimestamps.setToolTipText( 98 98 tr("Create audio markers at the position on the track corresponding to the modified time of each audio WAV file imported.")); … … 100 100 101 101 // audioMarkersFromStart 102 audioMarkersFromStart.setSelected( Main.pref.getBoolean("marker.audiofromstart"));102 audioMarkersFromStart.setSelected(Config.getPref().getBoolean("marker.audiofromstart")); 103 103 audioMarkersFromStart.setToolTipText( 104 104 tr("Automatically create audio markers from trackpoints (rather than explicit waypoints) with names or descriptions.")); 105 105 audio.add(audioMarkersFromStart, GBC.eol().insets(10, 0, 0, 0)); 106 106 107 audioForwardBackAmount.setText( Main.pref.get("audio.forwardbackamount", "10.0"));107 audioForwardBackAmount.setText(Config.getPref().get("audio.forwardbackamount", "10.0")); 108 108 audioForwardBackAmount.setToolTipText(tr("The number of seconds to jump forward or back when the relevant button is pressed")); 109 109 audio.add(new JLabel(tr("Forward/back time (seconds)")), GBC.std()); 110 110 audio.add(audioForwardBackAmount, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5)); 111 111 112 audioFastForwardMultiplier.setText( Main.pref.get("audio.fastfwdmultiplier", "1.3"));112 audioFastForwardMultiplier.setText(Config.getPref().get("audio.fastfwdmultiplier", "1.3")); 113 113 audioFastForwardMultiplier.setToolTipText(tr("The amount by which the speed is multiplied for fast forwarding")); 114 114 audio.add(new JLabel(tr("Fast forward multiplier")), GBC.std()); 115 115 audio.add(audioFastForwardMultiplier, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5)); 116 116 117 audioLeadIn.setText( Main.pref.get("audio.leadin", "1.0"));117 audioLeadIn.setText(Config.getPref().get("audio.leadin", "1.0")); 118 118 audioLeadIn.setToolTipText( 119 119 tr("Playback starts this number of seconds before (or after, if negative) the audio track position requested")); … … 121 121 audio.add(audioLeadIn, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5)); 122 122 123 audioCalibration.setText( Main.pref.get("audio.calibration", "1.0"));123 audioCalibration.setText(Config.getPref().get("audio.calibration", "1.0")); 124 124 audioCalibration.setToolTipText(tr("The ratio of voice recorder elapsed time to true elapsed time")); 125 125 audio.add(new JLabel(tr("Voice recorder calibration")), GBC.std()); … … 133 133 @Override 134 134 public boolean ok() { 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 Main.pref.put("audio.forwardbackamount", audioForwardBackAmount.getText());144 Main.pref.put("audio.fastfwdmultiplier", audioFastForwardMultiplier.getText());145 Main.pref.put("audio.leadin", audioLeadIn.getText());146 Main.pref.put("audio.calibration", audioCalibration.getText());135 Config.getPref().putBoolean("audio.menuinvisible", !audioMenuVisible.isSelected()); 136 Config.getPref().putBoolean("marker.traceaudio", markerAudioTraceVisible.isSelected()); 137 Config.getPref().putBoolean("marker.buttonlabels", markerButtonLabels.isSelected()); 138 Config.getPref().putBoolean("marker.audiofromexplicitwaypoints", audioMarkersFromExplicitWaypoints.isSelected()); 139 Config.getPref().putBoolean("marker.audiofromuntimedwaypoints", audioMarkersFromUntimedWaypoints.isSelected()); 140 Config.getPref().putBoolean("marker.audiofromnamedtrackpoints", audioMarkersFromNamedTrackpoints.isSelected()); 141 Config.getPref().putBoolean("marker.audiofromwavtimestamps", audioMarkersFromWavTimestamps.isSelected()); 142 Config.getPref().putBoolean("marker.audiofromstart", audioMarkersFromStart.isSelected()); 143 Config.getPref().put("audio.forwardbackamount", audioForwardBackAmount.getText()); 144 Config.getPref().put("audio.fastfwdmultiplier", audioFastForwardMultiplier.getText()); 145 Config.getPref().put("audio.leadin", audioLeadIn.getText()); 146 Config.getPref().put("audio.calibration", audioCalibration.getText()); 147 147 return false; 148 148 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r12620 r12846 46 46 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 47 47 import org.openstreetmap.josm.gui.util.GuiHelper; 48 import org.openstreetmap.josm.spi.preferences.Config; 48 49 import org.openstreetmap.josm.tools.ColorHelper; 49 50 import org.openstreetmap.josm.tools.GBC; … … 272 273 boolean ret = false; 273 274 for (String d : del) { 274 Main.pref.put("color."+d, null);275 Config.getPref().put("color."+d, null); 275 276 } 276 277 for (int i = 0; i < colors.getRowCount(); ++i) { -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r12841 r12846 13 13 import javax.swing.JScrollPane; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.actions.ExpertToggleAction; 17 16 import org.openstreetmap.josm.gui.autofilter.AutoFilterManager; … … 24 23 import org.openstreetmap.josm.gui.util.GuiHelper; 25 24 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 25 import org.openstreetmap.josm.spi.preferences.Config; 26 26 import org.openstreetmap.josm.tools.GBC; 27 27 … … 79 79 directionHint.addActionListener(e -> { 80 80 if (directionHint.isSelected()) { 81 headArrow.setSelected( Main.pref.getBoolean("draw.segment.head_only", false));81 headArrow.setSelected(Config.getPref().getBoolean("draw.segment.head_only", false)); 82 82 } else { 83 83 headArrow.setSelected(false); … … 86 86 }); 87 87 directionHint.setToolTipText(tr("Draw direction hints for way segments.")); 88 directionHint.setSelected( Main.pref.getBoolean("draw.segment.direction", false));88 directionHint.setSelected(Config.getPref().getBoolean("draw.segment.direction", false)); 89 89 90 90 // only on the head of a way 91 91 headArrow.setToolTipText(tr("Only on the head of a way.")); 92 headArrow.setSelected( Main.pref.getBoolean("draw.segment.head_only", false));92 headArrow.setSelected(Config.getPref().getBoolean("draw.segment.head_only", false)); 93 93 headArrow.setEnabled(directionHint.isSelected()); 94 94 95 95 // draw oneway arrows 96 96 onewayArrow.setToolTipText(tr("Draw arrows in the direction of oneways and other directed features.")); 97 onewayArrow.setSelected( Main.pref.getBoolean("draw.oneway", true));97 onewayArrow.setSelected(Config.getPref().getBoolean("draw.oneway", true)); 98 98 99 99 // segment order number 100 100 segmentOrderNumber.setToolTipText(tr("Draw the order numbers of all segments within their way.")); 101 segmentOrderNumber.setSelected( Main.pref.getBoolean("draw.segment.order_number", false));101 segmentOrderNumber.setSelected(Config.getPref().getBoolean("draw.segment.order_number", false)); 102 102 segmentOrderNumberOnSelectedWay.setToolTipText(tr("Draw the order numbers of all segments within their way.")); 103 segmentOrderNumberOnSelectedWay.setSelected( Main.pref.getBoolean("draw.segment.order_number.on_selected", false));103 segmentOrderNumberOnSelectedWay.setSelected(Config.getPref().getBoolean("draw.segment.order_number.on_selected", false)); 104 104 105 105 // downloaded area 106 106 sourceBounds.setToolTipText(tr("Draw the boundaries of data loaded from the server.")); 107 sourceBounds.setSelected( Main.pref.getBoolean("draw.data.downloaded_area", true));107 sourceBounds.setSelected(Config.getPref().getBoolean("draw.data.downloaded_area", true)); 108 108 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("mappaint.node.virtual-size", 8) != 0);111 virtualNodes.setSelected(Config.getPref().getInt("mappaint.node.virtual-size", 8) != 0); 112 112 113 113 // background layers in inactive color 114 114 inactive.setToolTipText(tr("Draw the inactive data layers in a different color.")); 115 inactive.setSelected( Main.pref.getBoolean("draw.data.inactive_color", true));115 inactive.setSelected(Config.getPref().getBoolean("draw.data.inactive_color", true)); 116 116 117 117 // antialiasing 118 118 useAntialiasing.setToolTipText(tr("Apply antialiasing to the map view resulting in a smoother appearance.")); 119 useAntialiasing.setSelected( Main.pref.getBoolean("mappaint.use-antialiasing", true));119 useAntialiasing.setSelected(Config.getPref().getBoolean("mappaint.use-antialiasing", true)); 120 120 121 121 // wireframe mode antialiasing 122 122 useWireframeAntialiasing.setToolTipText(tr("Apply antialiasing to the map view in wireframe mode resulting in a smoother appearance.")); 123 useWireframeAntialiasing.setSelected( Main.pref.getBoolean("mappaint.wireframe.use-antialiasing", false));123 useWireframeAntialiasing.setSelected(Config.getPref().getBoolean("mappaint.wireframe.use-antialiasing", false)); 124 124 125 125 // highlighting 126 126 useHighlighting.setToolTipText(tr("Hightlight target nodes and ways while drawing or selecting")); 127 useHighlighting.setSelected( Main.pref.getBoolean("draw.target-highlight", true));127 useHighlighting.setSelected(Config.getPref().getBoolean("draw.target-highlight", true)); 128 128 129 129 drawHelperLine.setToolTipText(tr("Draw rubber-band helper line")); 130 drawHelperLine.setSelected( Main.pref.getBoolean("draw.helper-line", true));130 drawHelperLine.setSelected(Config.getPref().getBoolean("draw.helper-line", true)); 131 131 132 132 // outlineOnly 133 133 outlineOnly.setToolTipText(tr("This option suppresses the filling of areas, overriding anything specified in the selected style.")); 134 outlineOnly.setSelected( Main.pref.getBoolean("draw.data.area_outline_only", false));134 outlineOnly.setSelected(Config.getPref().getBoolean("draw.data.area_outline_only", false)); 135 135 136 136 // discardable keys 137 137 discardableKeys.setToolTipText(tr("Display keys which have been deemed uninteresting to the point that they can be silently removed.")); 138 discardableKeys.setSelected( Main.pref.getBoolean("display.discardable-keys", false));138 discardableKeys.setSelected(Config.getPref().getBoolean("display.discardable-keys", false)); 139 139 140 140 // auto filters … … 195 195 public boolean ok() { 196 196 boolean restart = gpxPanel.savePreferences(); 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());197 Config.getPref().putBoolean("draw.data.area_outline_only", outlineOnly.isSelected()); 198 Config.getPref().putBoolean("draw.segment.direction", directionHint.isSelected()); 199 Config.getPref().putBoolean("draw.segment.head_only", headArrow.isSelected()); 200 Config.getPref().putBoolean("draw.oneway", onewayArrow.isSelected()); 201 Config.getPref().putBoolean("draw.segment.order_number", segmentOrderNumber.isSelected()); 202 Config.getPref().putBoolean("draw.segment.order_number.on_selected", segmentOrderNumberOnSelectedWay.isSelected()); 203 Config.getPref().putBoolean("draw.data.downloaded_area", sourceBounds.isSelected()); 204 Config.getPref().putBoolean("draw.data.inactive_color", inactive.isSelected()); 205 Config.getPref().putBoolean("mappaint.use-antialiasing", useAntialiasing.isSelected()); 206 Config.getPref().putBoolean("mappaint.wireframe.use-antialiasing", useWireframeAntialiasing.isSelected()); 207 Config.getPref().putBoolean("draw.target-highlight", useHighlighting.isSelected()); 208 Config.getPref().putBoolean("draw.helper-line", drawHelperLine.isSelected()); 209 Config.getPref().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("mappaint.node.virtual-size", 8);212 int vn = Config.getPref().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("mappaint.node.virtual-size", vn);220 Config.getPref().putInt("mappaint.node.virtual-size", vn); 221 221 return restart; 222 222 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r12844 r12846 31 31 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 32 32 import org.openstreetmap.josm.gui.widgets.JosmTextField; 33 import org.openstreetmap.josm.spi.preferences.Config; 33 34 import org.openstreetmap.josm.tools.GBC; 34 35 import org.openstreetmap.josm.tools.Logging; … … 385 386 */ 386 387 public final void loadPreferences() { 387 makeAutoMarkers.setSelected( Main.pref.getBoolean("marker.makeautomarkers", true));388 if (layerName != null && Main.pref.get("draw.rawgps.lines."+layerName).isEmpty()389 && Main.pref.get("draw.rawgps.lines.local."+layerName).isEmpty()) {388 makeAutoMarkers.setSelected(Config.getPref().getBoolean("marker.makeautomarkers", true)); 389 if (layerName != null && Config.getPref().get("draw.rawgps.lines."+layerName).isEmpty() 390 && Config.getPref().get("draw.rawgps.lines.local."+layerName).isEmpty()) { 390 391 // no line preferences for layer is found 391 392 drawRawGpsLinesGlobal.setSelected(true); … … 411 412 hdopCircleGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.hdopcircle", layerName, false)); 412 413 largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large", layerName, false)); 413 useGpsAntialiasing.setSelected( Main.pref.getBoolean("mappaint.gpx.use-antialiasing", false));414 useGpsAntialiasing.setSelected(Config.getPref().getBoolean("mappaint.gpx.use-antialiasing", false)); 414 415 415 416 drawRawGpsLinesActionListener.actionPerformed(null); 416 417 417 if (layerName != null && Main.pref.get("draw.rawgps.colors."+layerName).isEmpty()) {418 if (layerName != null && Config.getPref().get("draw.rawgps.colors."+layerName).isEmpty()) { 418 419 colorTypeGlobal.setSelected(true); 419 420 colorDynamic.setSelected(false); … … 454 455 layerNameDot = ""; 455 456 } 456 Main.pref.putBoolean("marker.makeautomarkers"+layerNameDot, makeAutoMarkers.isSelected());457 Config.getPref().putBoolean("marker.makeautomarkers"+layerNameDot, makeAutoMarkers.isSelected()); 457 458 if (drawRawGpsLinesGlobal.isSelected()) { 458 Main.pref.put("draw.rawgps.lines" + layerNameDot, null);459 Main.pref.put("draw.rawgps.max-line-length" + layerNameDot, null);460 Main.pref.put("draw.rawgps.lines.local" + layerNameDot, null);461 Main.pref.put("draw.rawgps.max-line-length.local" + layerNameDot, null);462 Main.pref.put("draw.rawgps.lines.force"+layerNameDot, null);463 Main.pref.put("draw.rawgps.direction"+layerNameDot, null);464 Main.pref.put("draw.rawgps.alternatedirection"+layerNameDot, null);465 Main.pref.put("draw.rawgps.min-arrow-distance"+layerNameDot, null);459 Config.getPref().put("draw.rawgps.lines" + layerNameDot, null); 460 Config.getPref().put("draw.rawgps.max-line-length" + layerNameDot, null); 461 Config.getPref().put("draw.rawgps.lines.local" + layerNameDot, null); 462 Config.getPref().put("draw.rawgps.max-line-length.local" + layerNameDot, null); 463 Config.getPref().put("draw.rawgps.lines.force"+layerNameDot, null); 464 Config.getPref().put("draw.rawgps.direction"+layerNameDot, null); 465 Config.getPref().put("draw.rawgps.alternatedirection"+layerNameDot, null); 466 Config.getPref().put("draw.rawgps.min-arrow-distance"+layerNameDot, null); 466 467 } else { 467 468 if (layerName == null || !locLayer) { 468 Main.pref.putBoolean("draw.rawgps.lines" + layerNameDot, drawRawGpsLinesAll.isSelected());469 Main.pref.put("draw.rawgps.max-line-length" + layerNameDot, drawRawGpsMaxLineLength.getText());469 Config.getPref().putBoolean("draw.rawgps.lines" + layerNameDot, drawRawGpsLinesAll.isSelected()); 470 Config.getPref().put("draw.rawgps.max-line-length" + layerNameDot, drawRawGpsMaxLineLength.getText()); 470 471 } 471 472 if (layerName == null || locLayer) { 472 Main.pref.putBoolean("draw.rawgps.lines.local" + layerNameDot,473 Config.getPref().putBoolean("draw.rawgps.lines.local" + layerNameDot, 473 474 drawRawGpsLinesAll.isSelected() || drawRawGpsLinesLocal.isSelected()); 474 Main.pref.put("draw.rawgps.max-line-length.local" + layerNameDot,475 Config.getPref().put("draw.rawgps.max-line-length.local" + layerNameDot, 475 476 drawRawGpsMaxLineLengthLocal.getText()); 476 477 } 477 Main.pref.putBoolean("draw.rawgps.lines.force"+layerNameDot, forceRawGpsLines.isSelected());478 Main.pref.putBoolean("draw.rawgps.direction"+layerNameDot, drawGpsArrows.isSelected());479 Main.pref.putBoolean("draw.rawgps.alternatedirection"+layerNameDot, drawGpsArrowsFast.isSelected());480 Main.pref.put("draw.rawgps.min-arrow-distance"+layerNameDot, drawGpsArrowsMinDist.getText());481 } 482 483 Main.pref.putBoolean("draw.rawgps.hdopcircle"+layerNameDot, hdopCircleGpsPoints.isSelected());484 Main.pref.putBoolean("draw.rawgps.large"+layerNameDot, largeGpsPoints.isSelected());485 Main.pref.put("draw.rawgps.linewidth"+layerNameDot, drawLineWidth.getText());486 Main.pref.putBoolean("draw.rawgps.lines.alpha-blend"+layerNameDot, drawLineWithAlpha.isSelected());487 488 Main.pref.putBoolean("mappaint.gpx.use-antialiasing", useGpsAntialiasing.isSelected());478 Config.getPref().putBoolean("draw.rawgps.lines.force"+layerNameDot, forceRawGpsLines.isSelected()); 479 Config.getPref().putBoolean("draw.rawgps.direction"+layerNameDot, drawGpsArrows.isSelected()); 480 Config.getPref().putBoolean("draw.rawgps.alternatedirection"+layerNameDot, drawGpsArrowsFast.isSelected()); 481 Config.getPref().put("draw.rawgps.min-arrow-distance"+layerNameDot, drawGpsArrowsMinDist.getText()); 482 } 483 484 Config.getPref().putBoolean("draw.rawgps.hdopcircle"+layerNameDot, hdopCircleGpsPoints.isSelected()); 485 Config.getPref().putBoolean("draw.rawgps.large"+layerNameDot, largeGpsPoints.isSelected()); 486 Config.getPref().put("draw.rawgps.linewidth"+layerNameDot, drawLineWidth.getText()); 487 Config.getPref().putBoolean("draw.rawgps.lines.alpha-blend"+layerNameDot, drawLineWithAlpha.isSelected()); 488 489 Config.getPref().putBoolean("mappaint.gpx.use-antialiasing", useGpsAntialiasing.isSelected()); 489 490 490 491 TemplateEntryProperty.forMarker(layerName).put(waypointLabelPattern.getText()); … … 492 493 493 494 if (colorTypeGlobal.isSelected()) { 494 Main.pref.put("draw.rawgps.colors"+layerNameDot, null);495 Main.pref.put("draw.rawgps.colors.dynamic"+layerNameDot, null);496 Main.pref.put("draw.rawgps.colorTracksTunec"+layerNameDot, null);495 Config.getPref().put("draw.rawgps.colors"+layerNameDot, null); 496 Config.getPref().put("draw.rawgps.colors.dynamic"+layerNameDot, null); 497 Config.getPref().put("draw.rawgps.colorTracksTunec"+layerNameDot, null); 497 498 return false; 498 499 } else if (colorTypeVelocity.isSelected()) { 499 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 1);500 Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 1); 500 501 } else if (colorTypeDilution.isSelected()) { 501 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 2);502 Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 2); 502 503 } else if (colorTypeDirection.isSelected()) { 503 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 3);504 Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 3); 504 505 } else if (colorTypeTime.isSelected()) { 505 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 4);506 Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 4); 506 507 } else if (colorTypeHeatMap.isSelected()) { 507 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 5);508 Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 5); 508 509 } else { 509 Main.pref.putInt("draw.rawgps.colors"+layerNameDot, 0);510 } 511 Main.pref.putBoolean("draw.rawgps.colors.dynamic"+layerNameDot, colorDynamic.isSelected());510 Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 0); 511 } 512 Config.getPref().putBoolean("draw.rawgps.colors.dynamic"+layerNameDot, colorDynamic.isSelected()); 512 513 int ccti = colorTypeVelocityTune.getSelectedIndex(); 513 Main.pref.putInt("draw.rawgps.colorTracksTune"+layerNameDot, ccti == 2 ? 10 : (ccti == 1 ? 20 : 45));514 Main.pref.putInt("draw.rawgps.heatmap.colormap"+layerNameDot, colorTypeHeatMapTune.getSelectedIndex());515 Main.pref.putBoolean("draw.rawgps.heatmap.use-points"+layerNameDot, colorTypeHeatMapPoints.isSelected());516 Main.pref.putInt("draw.rawgps.heatmap.gain"+layerNameDot, colorTypeHeatMapGain.getValue());517 Main.pref.putInt("draw.rawgps.heatmap.lower-limit"+layerNameDot, colorTypeHeatMapLowerLimit.getValue());514 Config.getPref().putInt("draw.rawgps.colorTracksTune"+layerNameDot, ccti == 2 ? 10 : (ccti == 1 ? 20 : 45)); 515 Config.getPref().putInt("draw.rawgps.heatmap.colormap"+layerNameDot, colorTypeHeatMapTune.getSelectedIndex()); 516 Config.getPref().putBoolean("draw.rawgps.heatmap.use-points"+layerNameDot, colorTypeHeatMapPoints.isSelected()); 517 Config.getPref().putInt("draw.rawgps.heatmap.gain"+layerNameDot, colorTypeHeatMapGain.getValue()); 518 Config.getPref().putInt("draw.rawgps.heatmap.lower-limit"+layerNameDot, colorTypeHeatMapLowerLimit.getValue()); 518 519 519 520 return false; -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r12841 r12846 39 39 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 40 40 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 41 import org.openstreetmap.josm.spi.preferences.Config; 41 42 import org.openstreetmap.josm.tools.GBC; 42 43 import org.openstreetmap.josm.tools.Logging; … … 124 125 // Show splash screen on startup 125 126 showSplashScreen.setToolTipText(tr("Show splash screen at startup")); 126 showSplashScreen.setSelected( Main.pref.getBoolean("draw.splashscreen", true));127 showSplashScreen.setSelected(Config.getPref().getBoolean("draw.splashscreen", true)); 127 128 panel.add(showSplashScreen, GBC.eop().insets(20, 0, 0, 0)); 128 129 129 130 // Show ID in selection 130 131 showID.setToolTipText(tr("Show object ID in selection lists")); 131 showID.setSelected( Main.pref.getBoolean("osm-primitives.showid", false));132 showID.setSelected(Config.getPref().getBoolean("osm-primitives.showid", false)); 132 133 133 134 // Show localized names 134 135 showLocalizedName.setToolTipText(tr("Show localized name in selection lists, if available")); 135 showLocalizedName.setSelected( Main.pref.getBoolean("osm-primitives.localize-name", true));136 showLocalizedName.setSelected(Config.getPref().getBoolean("osm-primitives.localize-name", true)); 136 137 ExpertToggleAction.addVisibilitySwitcher(showLocalizedName); 137 138 … … 202 203 public boolean ok() { 203 204 boolean mod = false; 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());205 Config.getPref().putBoolean("draw.splashscreen", showSplashScreen.isSelected()); 206 Config.getPref().putBoolean("osm-primitives.showid", showID.isSelected()); 207 Config.getPref().putBoolean("osm-primitives.localize-name", showLocalizedName.isSelected()); 207 208 MapFrame.MODELESS.put(modeless.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());209 Config.getPref().putBoolean(ToggleDialog.PROP_DYNAMIC_BUTTONS.getKey(), dynamicButtons.isSelected()); 210 Config.getPref().putBoolean(DateUtils.PROP_ISO_DATES.getKey(), isoDates.isSelected()); 211 Config.getPref().putBoolean(FileChooserManager.PROP_USE_NATIVE_FILE_DIALOG.getKey(), nativeFileChoosers.isSelected()); 211 212 MapMover.PROP_ZOOM_REVERSE_WHEEL.put(zoomReverseWheel.isSelected()); 212 213 NavigatableComponent.PROP_ZOOM_INTERMEDIATE_STEPS.put(zoomIntermediateSteps.isSelected()); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LanguagePreference.java
r10134 r12846 18 18 import javax.swing.ListCellRenderer; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 22 21 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; … … 25 24 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 26 25 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.GBC; 28 28 import org.openstreetmap.josm.tools.I18n; … … 55 55 // Selecting the language BEFORE the JComboBox listens to model changes speed up initialization by ~35ms (see #7386) 56 56 // See https://stackoverflow.com/questions/3194958/fast-replacement-for-jcombobox-basiccomboboxui 57 model.selectLanguage( Main.pref.get(LANGUAGE));57 model.selectLanguage(Config.getPref().get(LANGUAGE)); 58 58 langCombo = new JosmComboBox<>(model); 59 59 langCombo.setRenderer(new LanguageCellRenderer()); … … 73 73 public boolean ok() { 74 74 if (langCombo.getSelectedItem() == null) 75 return Main.pref.put(LANGUAGE, null);75 return Config.getPref().put(LANGUAGE, null); 76 76 else 77 return Main.pref.put(LANGUAGE,77 return Config.getPref().put(LANGUAGE, 78 78 LanguageInfo.getJOSMLocaleCode((Locale) langCombo.getSelectedItem())); 79 79 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r12841 r12846 29 29 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 30 30 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 31 import org.openstreetmap.josm.spi.preferences.Config; 31 32 import org.openstreetmap.josm.tools.GBC; 32 33 import org.openstreetmap.josm.tools.Logging; … … 65 66 public void addGui(PreferenceTabbedPane gui) { 66 67 enableIconDefault = new JCheckBox(tr("Enable built-in icon defaults"), 67 Main.pref.getBoolean("mappaint.icon.enable-defaults", true));68 Config.getPref().getBoolean("mappaint.icon.enable-defaults", true)); 68 69 69 70 sources = new MapPaintSourceEditor(); … … 105 106 @Override 106 107 public Collection<String> getInitialIconPathsList() { 107 return Main.pref.getList(ICONPREF, null);108 return Config.getPref().getList(ICONPREF, null); 108 109 } 109 110 … … 170 171 @Override 171 172 public boolean ok() { 172 boolean reload = Main.pref.putBoolean("mappaint.icon.enable-defaults", enableIconDefault.isSelected());173 boolean reload = Config.getPref().putBoolean("mappaint.icon.enable-defaults", enableIconDefault.isSelected()); 173 174 reload |= sources.finish(); 174 175 if (reload) { -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r12841 r12846 32 32 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 33 33 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 34 import org.openstreetmap.josm.spi.preferences.Config; 34 35 import org.openstreetmap.josm.tools.GBC; 35 36 import org.openstreetmap.josm.tools.Logging; … … 168 169 public void addGui(PreferenceTabbedPane gui) { 169 170 sortMenu = new JCheckBox(tr("Sort presets menu alphabetically"), 170 Main.pref.getBoolean("taggingpreset.sortmenu", false));171 Config.getPref().getBoolean("taggingpreset.sortmenu", false)); 171 172 172 173 final JPanel panel = new JPanel(new GridBagLayout()); … … 206 207 @Override 207 208 public Collection<String> getInitialIconPathsList() { 208 return Main.pref.getList(ICONPREF, null);209 return Config.getPref().getList(ICONPREF, null); 209 210 } 210 211 … … 246 247 @Override 247 248 public boolean ok() { 248 boolean restart = Main.pref.putBoolean("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null);249 boolean restart = Config.getPref().putBoolean("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null); 249 250 restart |= sources.finish(); 250 251 -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r12841 r12846 61 61 import org.openstreetmap.josm.plugins.ReadLocalPluginInformationTask; 62 62 import org.openstreetmap.josm.plugins.ReadRemotePluginInformationTask; 63 import org.openstreetmap.josm.spi.preferences.Config; 63 64 import org.openstreetmap.josm.tools.GBC; 64 65 import org.openstreetmap.josm.tools.ImageProvider; … … 302 303 List<String> l = new LinkedList<>(model.getSelectedPluginNames()); 303 304 Collections.sort(l); 304 Main.pref.putList("plugins", l);305 Config.getPref().putList("plugins", l); 305 306 if (!model.getNewlyDeactivatedPlugins().isEmpty()) 306 307 return true; … … 359 360 model.updateAvailablePlugins(task.getAvailablePlugins()); 360 361 pnlPluginPreferences.refreshView(); 361 Main.pref.putInt("pluginmanager.version", Version.getInstance().getVersion()); // fix #7030362 Config.getPref().putInt("pluginmanager.version", Version.getInstance().getVersion()); // fix #7030 362 363 }); 363 364 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r12841 r12846 15 15 import java.util.Set; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.gui.util.ChangeNotifier; 19 18 import org.openstreetmap.josm.plugins.PluginException; 20 19 import org.openstreetmap.josm.plugins.PluginHandler; 21 20 import org.openstreetmap.josm.plugins.PluginInformation; 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 import org.openstreetmap.josm.tools.Logging; 23 23 … … 40 40 public PluginPreferencesModel() { 41 41 currentActivePlugins = new HashSet<>(); 42 currentActivePlugins.addAll( Main.pref.getList("plugins"));42 currentActivePlugins.addAll(Config.getPref().getList("plugins")); 43 43 } 44 44 … … 80 80 filterDisplayedPlugins(filterExpression); 81 81 Set<String> activePlugins = new HashSet<>(); 82 activePlugins.addAll( Main.pref.getList("plugins"));82 activePlugins.addAll(Config.getPref().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.getList("plugins", null);232 Collection<String> enabledPlugins = Config.getPref().getList("plugins", null); 233 233 if (enabledPlugins == null) { 234 234 this.selectedPluginsMap.clear(); -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java
r12841 r12846 20 20 import javax.swing.event.ChangeListener; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 24 23 import org.openstreetmap.josm.gui.widgets.JosmTextField; 25 24 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 26 25 import org.openstreetmap.josm.plugins.PluginHandler; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.Logging; 28 28 … … 175 175 */ 176 176 public final void initFromPreferences() { 177 rbVersionBasedUpatePolicy.get(Optional.ofNullable(Policy.fromPreferenceValue( 178 Main.pref.get("pluginmanager.version-based-update.policy", "ask"))).orElse(Policy.ASK)).setSelected(true); 179 rbTimeBasedUpatePolicy.get(Optional.ofNullable(Policy.fromPreferenceValue( 180 Main.pref.get("pluginmanager.time-based-update.policy", "ask"))).orElse(Policy.ASK)).setSelected(true); 181 182 String pref = Main.pref.get("pluginmanager.warntime", null); 177 rbVersionBasedUpatePolicy.get(Optional.ofNullable(Policy.fromPreferenceValue(Config.getPref().get("pluginmanager.version-based-update.policy", "ask"))).orElse(Policy.ASK)).setSelected(true); 178 rbTimeBasedUpatePolicy.get(Optional.ofNullable(Policy.fromPreferenceValue(Config.getPref().get("pluginmanager.time-based-update.policy", "ask"))).orElse(Policy.ASK)).setSelected(true); 179 180 String pref = Config.getPref().get("pluginmanager.warntime", null); 183 181 int days = 0; 184 182 if (pref != null) { 185 183 // remove legacy preference 186 Main.pref.put("pluginmanager.warntime", null);184 Config.getPref().put("pluginmanager.warntime", null); 187 185 try { 188 186 days = Integer.parseInt(pref.trim()); … … 196 194 } 197 195 if (days == 0) { 198 days = Main.pref.getInt("pluginmanager.time-based-update.interval", PluginHandler.DEFAULT_TIME_BASED_UPDATE_INTERVAL);196 days = Config.getPref().getInt("pluginmanager.time-based-update.interval", PluginHandler.DEFAULT_TIME_BASED_UPDATE_INTERVAL); 199 197 } 200 198 tfUpdateInterval.setText(Integer.toString(days)); … … 210 208 for (Policy p: Policy.values()) { 211 209 if (rbVersionBasedUpatePolicy.get(p).isSelected()) { 212 Main.pref.put("pluginmanager.version-based-update.policy", p.getPreferencesValue());210 Config.getPref().put("pluginmanager.version-based-update.policy", p.getPreferencesValue()); 213 211 break; 214 212 } … … 219 217 for (Policy p: Policy.values()) { 220 218 if (rbTimeBasedUpatePolicy.get(p).isSelected()) { 221 Main.pref.put("pluginmanager.time-based-update.policy", p.getPreferencesValue());219 Config.getPref().put("pluginmanager.time-based-update.policy", p.getPreferencesValue()); 222 220 break; 223 221 } … … 235 233 days = PluginHandler.DEFAULT_TIME_BASED_UPDATE_INTERVAL; 236 234 } 237 Main.pref.putInt("pluginmanager.time-based-update.interval", days);235 Config.getPref().putInt("pluginmanager.time-based-update.interval", days); 238 236 } 239 237 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
r12841 r12846 20 20 import javax.swing.plaf.basic.BasicComboBoxEditor; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.projection.CustomProjection; 24 23 import org.openstreetmap.josm.data.projection.Projection; … … 31 30 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 32 31 import org.openstreetmap.josm.gui.widgets.JosmTextField; 32 import org.openstreetmap.josm.spi.preferences.Config; 33 33 import org.openstreetmap.josm.tools.GBC; 34 34 import org.openstreetmap.josm.tools.ImageProvider; … … 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.getList("projection.custom.value.history", samples));77 List<String> inputHistory = new LinkedList<>(Config.getPref().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.putList("projection.custom.value.history", cbInput.getHistory());151 Config.getPref().putList("projection.custom.value.history", cbInput.getHistory()); 152 152 } 153 153 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r12841 r12846 41 41 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 42 42 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 43 import org.openstreetmap.josm.spi.preferences.Config; 43 44 import org.openstreetmap.josm.tools.GBC; 44 45 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 482 483 } 483 484 id = pc.getId(); 484 Main.pref.putList("projection.sub."+id, pref == null ? null : new ArrayList<>(pref));485 Config.getPref().putList("projection.sub."+id, pref == null ? null : new ArrayList<>(pref)); 485 486 if (makeDefault) { 486 487 PROP_PROJECTION_DEFAULT.put(id); … … 560 561 */ 561 562 public static Collection<String> getSubprojectionPreference(String pcId) { 562 return Main.pref.getList("projection.sub."+pcId, null);563 return Config.getPref().getList("projection.sub."+pcId, null); 563 564 } 564 565 -
trunk/src/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreference.java
r12841 r12846 38 38 import org.openstreetmap.josm.io.remotecontrol.RemoteControlHttpsServer; 39 39 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler; 40 import org.openstreetmap.josm.spi.preferences.Config; 40 41 import org.openstreetmap.josm.tools.GBC; 41 42 import org.openstreetmap.josm.tools.Logging; … … 93 94 + tr("JOSM will always listen at <b>port {0}</b> (http) and <b>port {1}</b> (https) on localhost." 94 95 + "<br>These ports are not configurable because they are referenced by external applications talking to JOSM.", 95 Main.pref.get("remote.control.port", "8111"),96 Main.pref.get("remote.control.https.port", "8112")) + "</html>");96 Config.getPref().get("remote.control.port", "8111"), 97 Config.getPref().get("remote.control.https.port", "8112")) + "</html>"); 97 98 portLabel.setFont(portLabel.getFont().deriveFont(Font.PLAIN)); 98 99 remote.add(portLabel, GBC.eol().insets(5, 5, 0, 10).fill(GBC.HORIZONTAL)); … … 167 168 remote.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 168 169 169 loadInNewLayer.setSelected( Main.pref.getBoolean(RequestHandler.loadInNewLayerKey, RequestHandler.loadInNewLayerDefault));170 alwaysAskUserConfirm.setSelected( Main.pref.getBoolean(RequestHandler.globalConfirmationKey, RequestHandler.globalConfirmationDefault));170 loadInNewLayer.setSelected(Config.getPref().getBoolean(RequestHandler.loadInNewLayerKey, RequestHandler.loadInNewLayerDefault)); 171 alwaysAskUserConfirm.setSelected(Config.getPref().getBoolean(RequestHandler.globalConfirmationKey, RequestHandler.globalConfirmationDefault)); 171 172 172 173 ActionListener remoteControlEnabled = e -> { … … 196 197 if (enabled) { 197 198 for (Entry<PermissionPrefWithDefault, JCheckBox> p : prefs.entrySet()) { 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());199 Config.getPref().putBoolean(p.getKey().pref, p.getValue().isSelected()); 200 } 201 Config.getPref().putBoolean(RequestHandler.loadInNewLayerKey, loadInNewLayer.isSelected()); 202 Config.getPref().putBoolean(RequestHandler.globalConfirmationKey, alwaysAskUserConfirm.isSelected()); 202 203 } 203 204 if (changed) { -
trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java
r12686 r12846 24 24 import org.openstreetmap.josm.io.OsmApi; 25 25 import org.openstreetmap.josm.io.auth.CredentialsManager; 26 import org.openstreetmap.josm.spi.preferences.Config; 26 27 import org.openstreetmap.josm.tools.Logging; 27 28 … … 143 144 authMethod = "oauth"; 144 145 } 145 Main.pref.put("osm-server.auth-method", authMethod);146 Config.getPref().put("osm-server.auth-method", authMethod); 146 147 if ("basic".equals(authMethod)) { 147 148 // save username and password and clear the OAuth token -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r12841 r12846 27 27 import javax.swing.text.JTextComponent; 28 28 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.data.preferences.ListProperty; 31 30 import org.openstreetmap.josm.gui.MainApplication; … … 37 36 import org.openstreetmap.josm.io.OsmApiInitializationException; 38 37 import org.openstreetmap.josm.io.OsmTransferCanceledException; 38 import org.openstreetmap.josm.spi.preferences.Config; 39 39 import org.openstreetmap.josm.tools.ImageProvider; 40 40 import org.openstreetmap.josm.tools.Logging; … … 145 145 String hmiUrl = getStrippedApiUrl(); 146 146 if (cbUseDefaultServerUrl.isSelected() || OsmApi.DEFAULT_API_URL.equals(hmiUrl)) { 147 Main.pref.put("osm-server.url", null);147 Config.getPref().put("osm-server.url", null); 148 148 } else { 149 Main.pref.put("osm-server.url", hmiUrl);149 Config.getPref().put("osm-server.url", hmiUrl); 150 150 tfOsmServerUrl.addCurrentItemToHistory(); 151 151 SERVER_URL_HISTORY.put(tfOsmServerUrl.getHistory()); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java
r12805 r12846 25 25 import javax.swing.JRadioButton; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.gui.help.HelpUtil; 29 28 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; … … 36 35 import org.openstreetmap.josm.io.auth.CredentialsAgentException; 37 36 import org.openstreetmap.josm.io.auth.CredentialsManager; 37 import org.openstreetmap.josm.spi.preferences.Config; 38 38 import org.openstreetmap.josm.tools.GBC; 39 39 import org.openstreetmap.josm.tools.Logging; … … 264 264 */ 265 265 public final void initFromPreferences() { 266 ProxyPolicy pp = Optional.ofNullable(ProxyPolicy.fromName( Main.pref.get(DefaultProxySelector.PROXY_POLICY, null)))266 ProxyPolicy pp = Optional.ofNullable(ProxyPolicy.fromName(Config.getPref().get(DefaultProxySelector.PROXY_POLICY, null))) 267 267 .orElse(ProxyPolicy.NO_PROXY); 268 268 rbProxyPolicy.get(pp).setSelected(true); 269 String value = Main.pref.get("proxy.host", null);269 String value = Config.getPref().get("proxy.host", null); 270 270 if (value != null) { 271 271 // legacy support 272 272 tfProxyHttpHost.setText(value); 273 Main.pref.put("proxy.host", null);273 Config.getPref().put("proxy.host", null); 274 274 } else { 275 tfProxyHttpHost.setText( Main.pref.get(DefaultProxySelector.PROXY_HTTP_HOST, ""));276 } 277 value = Main.pref.get("proxy.port", null);275 tfProxyHttpHost.setText(Config.getPref().get(DefaultProxySelector.PROXY_HTTP_HOST, "")); 276 } 277 value = Config.getPref().get("proxy.port", null); 278 278 if (value != null) { 279 279 // legacy support 280 280 tfProxyHttpPort.setText(value); 281 Main.pref.put("proxy.port", null);281 Config.getPref().put("proxy.port", null); 282 282 } else { 283 tfProxyHttpPort.setText( Main.pref.get(DefaultProxySelector.PROXY_HTTP_PORT, ""));284 } 285 tfProxySocksHost.setText( Main.pref.get(DefaultProxySelector.PROXY_SOCKS_HOST, ""));286 tfProxySocksPort.setText( Main.pref.get(DefaultProxySelector.PROXY_SOCKS_PORT, ""));283 tfProxyHttpPort.setText(Config.getPref().get(DefaultProxySelector.PROXY_HTTP_PORT, "")); 284 } 285 tfProxySocksHost.setText(Config.getPref().get(DefaultProxySelector.PROXY_SOCKS_HOST, "")); 286 tfProxySocksPort.setText(Config.getPref().get(DefaultProxySelector.PROXY_SOCKS_PORT, "")); 287 287 288 288 if (pp.equals(ProxyPolicy.USE_SYSTEM_SETTINGS) && !DefaultProxySelector.willJvmRetrieveSystemProxies()) { … … 358 358 } 359 359 } 360 Main.pref.put(DefaultProxySelector.PROXY_POLICY, Optional.ofNullable(policy).orElse(ProxyPolicy.NO_PROXY).getName());361 Main.pref.put(DefaultProxySelector.PROXY_HTTP_HOST, tfProxyHttpHost.getText());362 Main.pref.put(DefaultProxySelector.PROXY_HTTP_PORT, tfProxyHttpPort.getText());363 Main.pref.put(DefaultProxySelector.PROXY_SOCKS_HOST, tfProxySocksHost.getText());364 Main.pref.put(DefaultProxySelector.PROXY_SOCKS_PORT, tfProxySocksPort.getText());360 Config.getPref().put(DefaultProxySelector.PROXY_POLICY, Optional.ofNullable(policy).orElse(ProxyPolicy.NO_PROXY).getName()); 361 Config.getPref().put(DefaultProxySelector.PROXY_HTTP_HOST, tfProxyHttpHost.getText()); 362 Config.getPref().put(DefaultProxySelector.PROXY_HTTP_PORT, tfProxyHttpPort.getText()); 363 Config.getPref().put(DefaultProxySelector.PROXY_SOCKS_HOST, tfProxySocksHost.getText()); 364 Config.getPref().put(DefaultProxySelector.PROXY_SOCKS_PORT, tfProxySocksPort.getText()); 365 365 366 366 // update the proxy selector -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java
r12649 r12846 12 12 import org.openstreetmap.josm.Main; 13 13 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 14 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;15 14 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; 16 15 import org.openstreetmap.josm.data.preferences.sources.SourceProvider; 17 16 import org.openstreetmap.josm.data.preferences.sources.SourceType; 17 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 18 18 import org.openstreetmap.josm.data.validation.OsmValidator; 19 19 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker; -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreference.java
r12841 r12846 16 16 import javax.swing.JPanel; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 20 19 import org.openstreetmap.josm.data.validation.OsmValidator; … … 28 27 import org.openstreetmap.josm.gui.util.GuiHelper; 29 28 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 29 import org.openstreetmap.josm.spi.preferences.Config; 30 30 import org.openstreetmap.josm.tools.GBC; 31 31 … … 116 116 OsmValidator.initializeTests(testsToInitialize); 117 117 118 Main.pref.putList(ValidatorPrefHelper.PREF_SKIP_TESTS, tests);119 Main.pref.putList(ValidatorPrefHelper.PREF_SKIP_TESTS_BEFORE_UPLOAD, testsBeforeUpload);118 Config.getPref().putList(ValidatorPrefHelper.PREF_SKIP_TESTS, tests); 119 Config.getPref().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/ac/AutoCompletingComboBox.java
r12630 r12846 23 23 import javax.swing.text.StyleConstants; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.gui.MainApplication; 27 26 import org.openstreetmap.josm.gui.MapFrame; 28 27 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 29 28 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 29 import org.openstreetmap.josm.spi.preferences.Config; 30 30 import org.openstreetmap.josm.tools.Logging; 31 31 … … 140 140 Object item; 141 141 // if the text is a number we don't autocomplete 142 if ( Main.pref.getBoolean("autocomplete.dont_complete_numbers", true)) {142 if (Config.getPref().getBoolean("autocomplete.dont_complete_numbers", true)) { 143 143 try { 144 144 Long.parseLong(str); -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java
r12620 r12846 20 20 import javax.swing.text.StyleConstants; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.gui.util.CellEditorSupport; 24 23 import org.openstreetmap.josm.gui.widgets.JosmTextField; 24 import org.openstreetmap.josm.spi.preferences.Config; 25 25 import org.openstreetmap.josm.tools.Logging; 26 26 … … 79 79 String currentText = getText(0, getLength()); 80 80 // if the text starts with a number we don't autocomplete 81 if ( Main.pref.getBoolean("autocomplete.dont_complete_numbers", true)) {81 if (Config.getPref().getBoolean("autocomplete.dont_complete_numbers", true)) { 82 82 try { 83 83 Long.parseLong(str); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r12841 r12846 60 60 import org.openstreetmap.josm.gui.tagging.presets.items.Space; 61 61 import org.openstreetmap.josm.gui.util.GuiHelper; 62 import org.openstreetmap.josm.spi.preferences.Config; 62 63 import org.openstreetmap.josm.tools.GBC; 63 64 import org.openstreetmap.josm.tools.ImageProvider; … … 210 211 } 211 212 File arch = TaggingPresetReader.getZipIcons(); 212 final Collection<String> s = Main.pref.getList("taggingpreset.icon.sources", null);213 final Collection<String> s = Config.getPref().getList("taggingpreset.icon.sources", null); 213 214 ImageProvider imgProv = new ImageProvider(iconName); 214 215 imgProv.setDirs(s); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
r12841 r12846 24 24 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 25 25 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 26 import org.openstreetmap.josm.spi.preferences.Config; 26 27 import org.openstreetmap.josm.tools.ImageProvider; 27 28 import org.openstreetmap.josm.tools.Logging; … … 127 128 128 129 protected static ImageIcon loadImageIcon(String iconName, File zipIcons, Integer maxSize) { 129 final Collection<String> s = Main.pref.getList("taggingpreset.icon.sources", null);130 final Collection<String> s = Config.getPref().getList("taggingpreset.icon.sources", null); 130 131 ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true); 131 132 if (maxSize != null) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r12841 r12846 14 14 import javax.swing.JSeparator; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 17 import org.openstreetmap.josm.gui.MainApplication; … … 22 21 import org.openstreetmap.josm.gui.tagging.presets.items.Roles; 23 22 import org.openstreetmap.josm.gui.tagging.presets.items.Roles.Role; 23 import org.openstreetmap.josm.spi.preferences.Config; 24 24 import org.openstreetmap.josm.tools.Logging; 25 25 import org.openstreetmap.josm.tools.MultiMap; … … 91 91 } 92 92 for (JMenu submenu : submenus.values()) { 93 if (submenu.getItemCount() >= Main.pref.getInt("taggingpreset.min-elements-for-scroller", 15)) {93 if (submenu.getItemCount() >= Config.getPref().getInt("taggingpreset.min-elements-for-scroller", 15)) { 94 94 MenuScroller.setScrollerFor(submenu); 95 95 } 96 96 } 97 97 } 98 if ( Main.pref.getBoolean("taggingpreset.sortmenu")) {98 if (Config.getPref().getBoolean("taggingpreset.sortmenu")) { 99 99 TaggingPresetMenu.sortMenu(MainApplication.getMenu().presetsMenu); 100 100 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java
r11452 r12846 4 4 import javax.swing.JPanel; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 8 7 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPriority; 9 8 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 10 9 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 10 import org.openstreetmap.josm.spi.preferences.Config; 11 11 import org.openstreetmap.josm.tools.GBC; 12 12 … … 56 56 AutoCompletingTextField tf = new AutoCompletingTextField(); 57 57 initAutoCompletionField(tf, key); 58 if ( Main.pref.getBoolean("taggingpreset.display-keys-as-hint", true)) {58 if (Config.getPref().getBoolean("taggingpreset.display-keys-as-hint", true)) { 59 59 tf.setHint(key); 60 60 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r12620 r12846 31 31 import javax.swing.ListModel; 32 32 33 import org.openstreetmap.josm.Main;34 33 import org.openstreetmap.josm.data.osm.OsmPrimitive; 35 34 import org.openstreetmap.josm.data.osm.Tag; 36 35 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 37 36 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector; 37 import org.openstreetmap.josm.spi.preferences.Config; 38 38 import org.openstreetmap.josm.tools.AlphanumComparator; 39 39 import org.openstreetmap.josm.tools.GBC; … … 493 493 } 494 494 495 if (values_sort && Main.pref.getBoolean("taggingpreset.sortvalues", true)) {495 if (values_sort && Config.getPref().getBoolean("taggingpreset.sortvalues", true)) { 496 496 Collections.sort(entries); 497 497 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java
r12659 r12846 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 16 import org.openstreetmap.josm.data.osm.Tag; 17 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 17 18 import org.openstreetmap.josm.data.osm.search.SearchParseError; 18 19 import org.openstreetmap.josm.data.osm.search.SearchSetting; 19 import org.openstreetmap.josm.data.osm.search.SearchCompiler;20 20 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 21 21 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetType; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
r12620 r12846 22 22 import javax.swing.JToggleButton; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 26 25 import org.openstreetmap.josm.data.osm.Tag; … … 29 28 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 30 29 import org.openstreetmap.josm.gui.widgets.JosmTextField; 30 import org.openstreetmap.josm.spi.preferences.Config; 31 31 import org.openstreetmap.josm.tools.GBC; 32 32 import org.openstreetmap.josm.tools.Logging; … … 72 72 initAutoCompletionField(textField, key); 73 73 } 74 if ( Main.pref.getBoolean("taggingpreset.display-keys-as-hint", true)) {74 if (Config.getPref().getBoolean("taggingpreset.display-keys-as-hint", true)) { 75 75 textField.setHint(key); 76 76 } -
trunk/src/org/openstreetmap/josm/gui/util/WindowGeometry.java
r12678 r12846 20 20 21 21 import org.openstreetmap.josm.Main; 22 import org.openstreetmap.josm.spi.preferences.Config; 22 23 import org.openstreetmap.josm.tools.CheckParameterUtil; 23 24 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 206 207 207 208 protected final void initFromPreferences(String preferenceKey) throws WindowGeometryException { 208 String value = Main.pref.get(preferenceKey);209 String value = Config.getPref().get(preferenceKey); 209 210 if (value.isEmpty()) 210 211 throw new WindowGeometryException( … … 275 276 value.append("x=").append(topLeft.x).append(",y=").append(topLeft.y) 276 277 .append(",width=").append(extent.width).append(",height=").append(extent.height); 277 Main.pref.put(preferenceKey, value.toString());278 Config.getPref().put(preferenceKey, value.toString()); 278 279 } 279 280 -
trunk/src/org/openstreetmap/josm/gui/widgets/CompileSearchTextDecorator.java
r12656 r12846 9 9 import javax.swing.text.JTextComponent; 10 10 11 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 11 12 import org.openstreetmap.josm.data.osm.search.SearchParseError; 12 import org.openstreetmap.josm.data.osm.search.SearchCompiler;13 13 import org.openstreetmap.josm.tools.Logging; 14 14 -
trunk/src/org/openstreetmap/josm/gui/widgets/FileChooserManager.java
r9991 r12846 15 15 import org.openstreetmap.josm.actions.SaveActionBase; 16 16 import org.openstreetmap.josm.data.preferences.BooleanProperty; 17 import org.openstreetmap.josm.spi.preferences.Config; 17 18 18 19 /** … … 90 91 this.open = open; 91 92 this.lastDirProperty = lastDirProperty == null || lastDirProperty.isEmpty() ? "lastDirectory" : lastDirProperty; 92 this.curDir = Main.pref.get(this.lastDirProperty).isEmpty() ?93 this.curDir = Config.getPref().get(this.lastDirProperty).isEmpty() ? 93 94 defaultDir == null || defaultDir.isEmpty() ? "." : defaultDir 94 : Main.pref.get(this.lastDirProperty);95 : Config.getPref().get(this.lastDirProperty); 95 96 } 96 97 … … 345 346 346 347 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) { 347 Main.pref.put(lastDirProperty, fc.getCurrentDirectory().getAbsolutePath());348 Config.getPref().put(lastDirProperty, fc.getCurrentDirectory().getAbsolutePath()); 348 349 } 349 350 -
trunk/src/org/openstreetmap/josm/gui/widgets/HistoryComboBox.java
r12841 r12846 6 6 import javax.swing.text.JTextComponent; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 9 import org.openstreetmap.josm.spi.preferences.Config; 10 10 11 11 /** … … 24 24 */ 25 25 public HistoryComboBox() { 26 int maxsize = Main.pref.getInt("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE);26 int maxsize = Config.getPref().getInt("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE); 27 27 model = new ComboBoxHistory(maxsize); 28 28 setModel(model); -
trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java
r12620 r12846 23 23 import javax.swing.undo.UndoManager; 24 24 25 import org.openstreetmap.josm. Main;25 import org.openstreetmap.josm.spi.preferences.Config; 26 26 import org.openstreetmap.josm.tools.ImageProvider; 27 27 import org.openstreetmap.josm.tools.Logging; … … 172 172 JMenuItem mi = new JMenuItem(action); 173 173 mi.setText(label); 174 if (iconName != null && Main.pref.getBoolean("text.popupmenu.useicons", true)) {174 if (iconName != null && Config.getPref().getBoolean("text.popupmenu.useicons", true)) { 175 175 ImageIcon icon = ImageProvider.get(iconName, ImageProvider.ImageSizes.SMALLICON); 176 176 if (icon != null) { -
trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
r12841 r12846 12 12 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.spi.preferences.Config; 14 15 import org.openstreetmap.josm.tools.Logging; 15 16 import org.openstreetmap.josm.tools.Utils; … … 91 92 return false; 92 93 } 93 return Main.pref.getInt("cache." + ident, 0) + updateInterval < TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())94 return Config.getPref().getInt("cache." + ident, 0) + updateInterval < TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()) 94 95 || !isCacheValid(); 95 96 } … … 141 142 this.data = updateData(); 142 143 saveToDisk(); 143 Main.pref.putInt("cache." + ident, (int) (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));144 Config.getPref().putInt("cache." + ident, (int) (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); 144 145 return data; 145 146 } -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r12841 r12846 28 28 29 29 import org.openstreetmap.josm.Main; 30 import org.openstreetmap.josm.spi.preferences.Config; 30 31 import org.openstreetmap.josm.tools.HttpClient; 31 32 import org.openstreetmap.josm.tools.Logging; … … 381 382 if (!"file".equals(url.getProtocol())) { 382 383 String prefKey = getPrefKey(url, destDir); 383 List<String> localPath = new ArrayList<>( Main.pref.getList(prefKey));384 List<String> localPath = new ArrayList<>(Config.getPref().getList(prefKey)); 384 385 if (localPath.size() == 2) { 385 386 File lfile = new File(localPath.get(1)); … … 388 389 } 389 390 } 390 Main.pref.putList(prefKey, null);391 Config.getPref().putList(prefKey, null); 391 392 } 392 393 } catch (MalformedURLException e) { … … 419 420 Long ifModifiedSince = null; 420 421 File localFile = null; 421 List<String> localPathEntry = new ArrayList<>( Main.pref.getList(prefKey));422 List<String> localPathEntry = new ArrayList<>(Config.getPref().getList(prefKey)); 422 423 boolean offline = false; 423 424 try { … … 476 477 if (localFile == null) 477 478 throw new AssertionError(); 478 Main.pref.putList(prefKey,479 Config.getPref().putList(prefKey, 479 480 Arrays.asList(Long.toString(System.currentTimeMillis()), localPathEntry.get(1))); 480 481 return localFile; … … 488 489 localFile = new File(destDir, localPath); 489 490 if (Main.platform.rename(destDirFile, localFile)) { 490 Main.pref.putList(prefKey,491 Config.getPref().putList(prefKey, 491 492 Arrays.asList(Long.toString(System.currentTimeMillis()), localFile.toString())); 492 493 } else { -
trunk/src/org/openstreetmap/josm/io/CertificateAmendment.java
r12623 r12846 29 29 30 30 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.spi.preferences.Config; 31 32 import org.openstreetmap.josm.tools.Logging; 32 33 import org.openstreetmap.josm.tools.Utils; … … 119 120 */ 120 121 public static void addMissingCertificates() throws IOException, GeneralSecurityException { 121 if (! Main.pref.getBoolean("tls.add-missing-certificates", true))122 if (!Config.getPref().getBoolean("tls.add-missing-certificates", true)) 122 123 return; 123 124 KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r12841 r12846 18 18 import java.util.TreeSet; 19 19 20 import org.openstreetmap.josm. Main;20 import org.openstreetmap.josm.spi.preferences.Config; 21 21 import org.openstreetmap.josm.tools.Logging; 22 22 … … 126 126 */ 127 127 public final void initFromPreferences() { 128 String value = Main.pref.get(PROXY_POLICY);128 String value = Config.getPref().get(PROXY_POLICY); 129 129 if (value.isEmpty()) { 130 130 proxyPolicy = ProxyPolicy.NO_PROXY; … … 137 137 } 138 138 } 139 String host = Main.pref.get(PROXY_HTTP_HOST, null);140 int port = parseProxyPortValue(PROXY_HTTP_PORT, Main.pref.get(PROXY_HTTP_PORT, null));139 String host = Config.getPref().get(PROXY_HTTP_HOST, null); 140 int port = parseProxyPortValue(PROXY_HTTP_PORT, Config.getPref().get(PROXY_HTTP_PORT, null)); 141 141 httpProxySocketAddress = null; 142 142 if (proxyPolicy.equals(ProxyPolicy.USE_HTTP_PROXY)) { … … 149 149 } 150 150 151 host = Main.pref.get(PROXY_SOCKS_HOST, null);152 port = parseProxyPortValue(PROXY_SOCKS_PORT, Main.pref.get(PROXY_SOCKS_PORT, null));151 host = Config.getPref().get(PROXY_SOCKS_HOST, null); 152 port = parseProxyPortValue(PROXY_SOCKS_PORT, Config.getPref().get(PROXY_SOCKS_PORT, null)); 153 153 socksProxySocketAddress = null; 154 154 if (proxyPolicy.equals(ProxyPolicy.USE_SOCKS_PROXY)) { … … 161 161 } 162 162 proxyExceptions = new HashSet<>( 163 Main.pref.getList(PROXY_EXCEPTIONS,163 Config.getPref().getList(PROXY_EXCEPTIONS, 164 164 Arrays.asList("localhost", IPV4_LOOPBACK, IPV6_LOOPBACK)) 165 165 ); -
trunk/src/org/openstreetmap/josm/io/MessageNotifier.java
r12767 r12846 20 20 import org.openstreetmap.josm.io.auth.CredentialsManager; 21 21 import org.openstreetmap.josm.io.auth.JosmPreferencesCredentialAgent; 22 import org.openstreetmap.josm.spi.preferences.Config; 22 23 import org.openstreetmap.josm.tools.Logging; 23 24 import org.openstreetmap.josm.tools.Utils; … … 142 143 return credManager.lookupOAuthAccessToken() != null; 143 144 } else { 144 String username = Main.pref.get("osm-server.username", null);145 String password = Main.pref.get("osm-server.password", null);145 String username = Config.getPref().get("osm-server.username", null); 146 String password = Config.getPref().get("osm-server.password", null); 146 147 return username != null && !username.isEmpty() && password != null && !password.isEmpty(); 147 148 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r12841 r12846 24 24 import java.util.concurrent.Future; 25 25 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.data.osm.DataSet; 28 27 import org.openstreetmap.josm.data.osm.DataSetMerger; … … 37 36 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 38 37 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 38 import org.openstreetmap.josm.spi.preferences.Config; 39 39 import org.openstreetmap.josm.tools.Logging; 40 40 import org.openstreetmap.josm.tools.Utils; … … 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("osm.download.threads", OsmApi.MAX_DOWNLOAD_THREADS);323 int threadsNumber = Config.getPref().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
r12841 r12846 33 33 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 34 34 import org.openstreetmap.josm.io.Capabilities.CapabilitiesParser; 35 import org.openstreetmap.josm.spi.preferences.Config; 35 36 import org.openstreetmap.josm.tools.CheckParameterUtil; 36 37 import org.openstreetmap.josm.tools.HttpClient; … … 132 133 133 134 private static String getServerUrlFromPref() { 134 return Main.pref.get("osm-server.url", DEFAULT_API_URL);135 return Config.getPref().get("osm-server.url", DEFAULT_API_URL); 135 136 } 136 137 … … 593 594 */ 594 595 protected int getMaxRetries() { 595 int ret = Main.pref.getInt("osm-server.max-num-retries", DEFAULT_MAX_NUM_RETRIES);596 int ret = Config.getPref().getInt("osm-server.max-num-retries", DEFAULT_MAX_NUM_RETRIES); 596 597 return Math.max(ret, 0); 597 598 } … … 611 612 */ 612 613 public static String getAuthMethod() { 613 return Main.pref.get("osm-server.auth-method", "oauth");614 return Config.getPref().get("osm-server.auth-method", "oauth"); 614 615 } 615 616 -
trunk/src/org/openstreetmap/josm/io/UploadStrategy.java
r12687 r12846 7 7 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.spi.preferences.Config; 9 10 import org.openstreetmap.josm.tools.Logging; 10 11 … … 76 77 */ 77 78 public static UploadStrategy getFromPreferences() { 78 String v = Main.pref.get("osm-server.upload-strategy", null);79 String v = Config.getPref().get("osm-server.upload-strategy", null); 79 80 if (v == null) { 80 81 // legacy support. Until 12/2009 we had osm-server.atomic-upload only. … … 82 83 // When the preferences are saved the next time, "osm-server.upload-strategy" 83 84 // will be inserted. 84 v = Main.pref.get("osm-server.atomic-upload", null);85 v = Config.getPref().get("osm-server.atomic-upload", null); 85 86 if (v != null) { 86 87 Main.pref.removeFromCollection("osm-server.atomic-upload", v); … … 110 111 */ 111 112 public static void saveToPreferences(UploadStrategy strategy) { 112 Main.pref.put("osm-server.upload-strategy", strategy.getPreferenceValue());113 Config.getPref().put("osm-server.upload-strategy", strategy.getPreferenceValue()); 113 114 } 114 115 } -
trunk/src/org/openstreetmap/josm/io/audio/AudioPlayer.java
r12715 r12846 5 5 import java.net.URL; 6 6 7 import org.openstreetmap.josm. Main;7 import org.openstreetmap.josm.spi.preferences.Config; 8 8 import org.openstreetmap.josm.tools.JosmRuntimeException; 9 9 import org.openstreetmap.josm.tools.Logging; … … 234 234 command = new Execute(); 235 235 playingUrl = null; 236 double leadIn = Main.pref.getDouble("audio.leadin", 1.0 /* default, seconds */);237 double calibration = Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */);236 double leadIn = Config.getPref().getDouble("audio.leadin", 1.0 /* default, seconds */); 237 double calibration = Config.getPref().getDouble("audio.calibration", 1.0 /* default, ratio */); 238 238 try { 239 239 soundPlayer = (SoundPlayer) Class.forName("org.openstreetmap.josm.io.audio.JavaFxMediaPlayer").getConstructor().newInstance(); -
trunk/src/org/openstreetmap/josm/io/audio/AudioUtil.java
r12620 r12846 16 16 17 17 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.spi.preferences.Config; 18 19 import org.openstreetmap.josm.tools.Logging; 19 20 … … 44 45 * audioFormat.getFrameSize() /* bytes per frame */; 45 46 double naturalLength = filesize / bytesPerSecond; 46 double calibration = Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */);47 double calibration = Config.getPref().getDouble("audio.calibration", 1.0 /* default, ratio */); 47 48 return naturalLength / calibration; 48 49 } catch (UnsupportedAudioFileException | IOException e) { -
trunk/src/org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java
r12805 r12846 11 11 import javax.swing.text.html.HTMLEditorKit; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.oauth.OAuthToken; 15 14 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 16 15 import org.openstreetmap.josm.io.DefaultProxySelector; 17 16 import org.openstreetmap.josm.io.OsmApi; 17 import org.openstreetmap.josm.spi.preferences.Config; 18 18 19 19 /** … … 36 36 case SERVER: 37 37 if (Objects.equals(OsmApi.getOsmApi().getHost(), host)) { 38 user = Main.pref.get("osm-server.username", null);39 password = Main.pref.get("osm-server.password", null);38 user = Config.getPref().get("osm-server.username", null); 39 password = Config.getPref().get("osm-server.password", null); 40 40 } else if (host != null) { 41 user = Main.pref.get("server.username."+host, null);42 password = Main.pref.get("server.password."+host, null);41 user = Config.getPref().get("server.username."+host, null); 42 password = Config.getPref().get("server.password."+host, null); 43 43 } else { 44 44 user = null; … … 49 49 return new PasswordAuthentication(user, password == null ? new char[0] : password.toCharArray()); 50 50 case PROXY: 51 user = Main.pref.get(DefaultProxySelector.PROXY_USER, null);52 password = Main.pref.get(DefaultProxySelector.PROXY_PASS, null);51 user = Config.getPref().get(DefaultProxySelector.PROXY_USER, null); 52 password = Config.getPref().get(DefaultProxySelector.PROXY_PASS, null); 53 53 if (user == null) 54 54 return null; … … 68 68 case SERVER: 69 69 if (Objects.equals(OsmApi.getOsmApi().getHost(), host)) { 70 Main.pref.put("osm-server.username", credentials.getUserName());70 Config.getPref().put("osm-server.username", credentials.getUserName()); 71 71 if (credentials.getPassword() == null) { 72 Main.pref.put("osm-server.password", null);72 Config.getPref().put("osm-server.password", null); 73 73 } else { 74 Main.pref.put("osm-server.password", String.valueOf(credentials.getPassword()));74 Config.getPref().put("osm-server.password", String.valueOf(credentials.getPassword())); 75 75 } 76 76 } else if (host != null) { 77 Main.pref.put("server.username."+host, credentials.getUserName());77 Config.getPref().put("server.username."+host, credentials.getUserName()); 78 78 if (credentials.getPassword() == null) { 79 Main.pref.put("server.password."+host, null);79 Config.getPref().put("server.password."+host, null); 80 80 } else { 81 Main.pref.put("server.password."+host, String.valueOf(credentials.getPassword()));81 Config.getPref().put("server.password."+host, String.valueOf(credentials.getPassword())); 82 82 } 83 83 } 84 84 break; 85 85 case PROXY: 86 Main.pref.put(DefaultProxySelector.PROXY_USER, credentials.getUserName());86 Config.getPref().put(DefaultProxySelector.PROXY_USER, credentials.getUserName()); 87 87 if (credentials.getPassword() == null) { 88 Main.pref.put(DefaultProxySelector.PROXY_PASS, null);88 Config.getPref().put(DefaultProxySelector.PROXY_PASS, null); 89 89 } else { 90 Main.pref.put(DefaultProxySelector.PROXY_PASS, String.valueOf(credentials.getPassword()));90 Config.getPref().put(DefaultProxySelector.PROXY_PASS, String.valueOf(credentials.getPassword())); 91 91 } 92 92 break; … … 103 103 @Override 104 104 public OAuthToken lookupOAuthAccessToken() throws CredentialsAgentException { 105 String accessTokenKey = Main.pref.get("oauth.access-token.key", null);106 String accessTokenSecret = Main.pref.get("oauth.access-token.secret", null);105 String accessTokenKey = Config.getPref().get("oauth.access-token.key", null); 106 String accessTokenSecret = Config.getPref().get("oauth.access-token.secret", null); 107 107 if (accessTokenKey == null && accessTokenSecret == null) 108 108 return null; … … 119 119 public void storeOAuthAccessToken(OAuthToken accessToken) throws CredentialsAgentException { 120 120 if (accessToken == null) { 121 Main.pref.put("oauth.access-token.key", null);122 Main.pref.put("oauth.access-token.secret", null);121 Config.getPref().put("oauth.access-token.key", null); 122 Config.getPref().put("oauth.access-token.secret", null); 123 123 } else { 124 Main.pref.put("oauth.access-token.key", accessToken.getKey());125 Main.pref.put("oauth.access-token.secret", accessToken.getSecret());124 Config.getPref().put("oauth.access-token.key", accessToken.getKey()); 125 Config.getPref().put("oauth.access-token.secret", accessToken.getSecret()); 126 126 } 127 127 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/PermissionPrefWithDefault.java
r8510 r12846 7 7 import java.util.List; 8 8 9 import org.openstreetmap.josm. Main;9 import org.openstreetmap.josm.spi.preferences.Config; 10 10 11 11 /** … … 54 54 55 55 public boolean isAllowed() { 56 return Main.pref.getBoolean(pref, defaultVal);56 return Config.getPref().getBoolean(pref, defaultVal); 57 57 } 58 58 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java
r12703 r12846 11 11 import org.openstreetmap.josm.data.preferences.BooleanProperty; 12 12 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler; 13 import org.openstreetmap.josm.spi.preferences.Config; 13 14 import org.openstreetmap.josm.tools.Logging; 14 15 … … 105 106 */ 106 107 public static InetAddress getInet6Address() throws UnknownHostException { 107 for (InetAddress a : InetAddress.getAllByName( Main.pref.get("remote.control.host.ipv6", "::1"))) {108 for (InetAddress a : InetAddress.getAllByName(Config.getPref().get("remote.control.host.ipv6", "::1"))) { 108 109 if (a instanceof Inet6Address) { 109 110 return a; … … 121 122 public static InetAddress getInet4Address() throws UnknownHostException { 122 123 // Return an address to the loopback interface by default 123 for (InetAddress a : InetAddress.getAllByName( Main.pref.get("remote.control.host.ipv4", "127.0.0.1"))) {124 for (InetAddress a : InetAddress.getAllByName(Config.getPref().get("remote.control.host.ipv4", "127.0.0.1"))) { 124 125 if (a instanceof Inet4Address) { 125 126 return a; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpServer.java
r12841 r12846 9 9 import java.net.SocketException; 10 10 11 import org.openstreetmap.josm. Main;11 import org.openstreetmap.josm.spi.preferences.Config; 12 12 import org.openstreetmap.josm.tools.Logging; 13 13 … … 33 33 public static void restartRemoteControlHttpServer() { 34 34 stopRemoteControlHttpServer(); 35 int port = Main.pref.getInt("remote.control.port", 8111);35 int port = Config.getPref().getInt("remote.control.port", 8111); 36 36 try { 37 37 instance4 = new RemoteControlHttpServer(port, false); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java
r12841 r12846 41 41 import org.openstreetmap.josm.Main; 42 42 import org.openstreetmap.josm.data.preferences.StringProperty; 43 import org.openstreetmap.josm.spi.preferences.Config; 43 44 import org.openstreetmap.josm.tools.Logging; 44 45 … … 312 313 stopRemoteControlHttpsServer(); 313 314 if (RemoteControl.PROP_REMOTECONTROL_HTTPS_ENABLED.get()) { 314 int port = Main.pref.getInt("remote.control.https.port", HTTPS_PORT);315 int port = Config.getPref().getInt("remote.control.https.port", HTTPS_PORT); 315 316 try { 316 317 instance4 = new RemoteControlHttpsServer(port, false); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
r12726 r12846 8 8 import java.util.Map; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.actions.AutoScaleAction; 12 11 import org.openstreetmap.josm.command.AddCommand; … … 20 19 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; 21 20 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 import org.openstreetmap.josm.tools.Logging; 23 23 … … 92 92 Point p = mapView.getPoint(ll); 93 93 node = mapView.getNearestNode(p, OsmPrimitive::isUsable); 94 if (node != null && node.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remotecontrol.tolerance", 0.1)) {94 if (node != null && node.getCoor().greatCircleDistance(ll) > Config.getPref().getDouble("remotecontrol.tolerance", 0.1)) { 95 95 node = null; // node is too far 96 96 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
r12726 r12846 28 28 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; 29 29 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 30 import org.openstreetmap.josm.spi.preferences.Config; 30 31 31 32 /** … … 130 131 MapView mapView = MainApplication.getMap().mapView; 131 132 nd = mapView.getNearestNode(mapView.getPoint(ll), OsmPrimitive::isUsable); 132 if (nd != null && nd.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remote.tolerance", 0.1)) {133 if (nd != null && nd.getCoor().greatCircleDistance(ll) > Config.getPref().getDouble("remote.tolerance", 0.1)) { 133 134 nd = null; // node is too far 134 135 } … … 138 139 for (Entry<LatLon, Node> entry : addedNodes.entrySet()) { 139 140 LatLon lOld = entry.getKey(); 140 if (lOld.greatCircleDistance(ll) < Main.pref.getDouble("remotecontrol.tolerance", 0.1)) {141 if (lOld.greatCircleDistance(ll) < Config.getPref().getDouble("remotecontrol.tolerance", 0.1)) { 141 142 prev = entry.getValue(); 142 143 break; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r12643 r12846 15 15 import org.openstreetmap.josm.gui.MainApplication; 16 16 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 17 import org.openstreetmap.josm.spi.preferences.Config; 17 18 import org.openstreetmap.josm.tools.Logging; 18 19 import org.openstreetmap.josm.tools.Utils; … … 40 41 Logging.debug("Remote control, /import: defaulting to DownloadOsmTask"); 41 42 new DownloadOsmTask().loadUrl(isLoadInNewLayer(), url.toExternalForm(), null); 42 } else if ( Main.pref.getBoolean("remotecontrol.import.interactive", true)) {43 } else if (Config.getPref().getBoolean("remotecontrol.import.interactive", true)) { 43 44 // OpenLocationAction queries the user if more than one task is suitable 44 45 MainApplication.getMenu().openLocation.openUrl(isLoadInNewLayer(), url.toExternalForm()); … … 101 102 protected void validateRequest() throws RequestHandlerBadRequestException { 102 103 String urlString = args != null ? args.get("url") : null; 103 if ( Main.pref.getBoolean("remotecontrol.importhandler.fix_url_query", true)) {104 if (Config.getPref().getBoolean("remotecontrol.importhandler.fix_url_query", true)) { 104 105 urlString = Utils.fixURLQuery(urlString); 105 106 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r12656 r12846 23 23 import org.openstreetmap.josm.data.osm.Relation; 24 24 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 25 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 25 26 import org.openstreetmap.josm.data.osm.search.SearchParseError; 26 import org.openstreetmap.josm.data.osm.search.SearchCompiler;27 27 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 28 28 import org.openstreetmap.josm.gui.MainApplication; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r12620 r12846 20 20 import org.openstreetmap.josm.Main; 21 21 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 22 import org.openstreetmap.josm.spi.preferences.Config; 22 23 import org.openstreetmap.josm.tools.Logging; 23 24 import org.openstreetmap.josm.tools.Utils; … … 147 148 */ 148 149 PermissionPrefWithDefault permissionPref = getPermissionPref(); 149 if (permissionPref != null && permissionPref.pref != null && ! Main.pref.getBoolean(permissionPref.pref, permissionPref.defaultVal)) {150 if (permissionPref != null && permissionPref.pref != null && !Config.getPref().getBoolean(permissionPref.pref, permissionPref.defaultVal)) { 150 151 String err = MessageFormat.format("RemoteControl: ''{0}'' forbidden by preferences", myCommand); 151 152 Logging.info(err); … … 156 157 * If yes, display specific confirmation message. 157 158 */ 158 if ( Main.pref.getBoolean(globalConfirmationKey, globalConfirmationDefault)) {159 if (Config.getPref().getBoolean(globalConfirmationKey, globalConfirmationDefault)) { 159 160 // Ensure dialog box does not exceed main window size 160 161 Integer maxWidth = (int) Math.max(200, Main.parent.getWidth()*0.6); … … 276 277 return args.get("new_layer") != null && !args.get("new_layer").isEmpty() 277 278 ? Boolean.parseBoolean(args.get("new_layer")) 278 : Main.pref.getBoolean(loadInNewLayerKey, loadInNewLayerDefault);279 : Config.getPref().getBoolean(loadInNewLayerKey, loadInNewLayerDefault); 279 280 } 280 281 -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r12841 r12846 67 67 import org.openstreetmap.josm.io.OfflineAccessException; 68 68 import org.openstreetmap.josm.io.OnlineResource; 69 import org.openstreetmap.josm.spi.preferences.Config; 69 70 import org.openstreetmap.josm.tools.GBC; 70 71 import org.openstreetmap.josm.tools.I18n; … … 422 423 String togglePreferenceKey = null; 423 424 int v = Version.getInstance().getVersion(); 424 if ( Main.pref.getInt("pluginmanager.version", 0) < v) {425 if (Config.getPref().getInt("pluginmanager.version", 0) < v) { 425 426 message = 426 427 "<html>" … … 434 435 long tim = System.currentTimeMillis(); 435 436 long last = Main.pref.getLong("pluginmanager.lastupdate", 0); 436 Integer maxTime = Main.pref.getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL);437 Integer maxTime = Config.getPref().getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL); 437 438 long d = TimeUnit.MILLISECONDS.toDays(tim - last); 438 439 if ((last <= 0) || (maxTime <= 0)) { 439 Main.pref.put("pluginmanager.lastupdate", Long.toString(tim));440 Config.getPref().put("pluginmanager.lastupdate", Long.toString(tim)); 440 441 } else if (d > maxTime) { 441 442 message = … … 454 455 // check whether automatic update at startup was disabled 455 456 // 456 String policy = Main.pref.get(togglePreferenceKey, "ask").trim().toLowerCase(Locale.ENGLISH);457 String policy = Config.getPref().get(togglePreferenceKey, "ask").trim().toLowerCase(Locale.ENGLISH); 457 458 switch(policy) { 458 459 case "never": … … 508 509 switch(ret) { 509 510 case 0: 510 Main.pref.put(togglePreferenceKey, "always");511 Config.getPref().put(togglePreferenceKey, "always"); 511 512 break; 512 513 case JOptionPane.CLOSED_OPTION: 513 514 case 1: 514 Main.pref.put(togglePreferenceKey, "never");515 Config.getPref().put(togglePreferenceKey, "never"); 515 516 break; 516 517 default: // Do nothing 517 518 } 518 519 } else { 519 Main.pref.put(togglePreferenceKey, "ask");520 Config.getPref().put(togglePreferenceKey, "ask"); 520 521 } 521 522 return ret == 0; … … 607 608 if (!task.getDownloadedPlugins().isEmpty()) { 608 609 // update plugin list in preferences 609 Set<String> plugins = new HashSet<>( Main.pref.getList("plugins"));610 Set<String> plugins = new HashSet<>(Config.getPref().getList("plugins")); 610 611 for (PluginInformation plugin : task.getDownloadedPlugins()) { 611 612 plugins.add(plugin.name); 612 613 } 613 Main.pref.putList("plugins", new ArrayList<>(plugins));614 Config.getPref().putList("plugins", new ArrayList<>(plugins)); 614 615 // restart 615 616 try { … … 969 970 try { 970 971 monitor.beginTask(tr("Determining plugins to load...")); 971 Set<String> plugins = new HashSet<>( Main.pref.getList("plugins", new LinkedList<String>()));972 Set<String> plugins = new HashSet<>(Config.getPref().getList("plugins", new LinkedList<String>())); 972 973 Logging.debug("Plugins list initialized to {0}", plugins); 973 974 String systemProp = System.getProperty("josm.plugins"); … … 1157 1158 if (pluginsWanted == null) { 1158 1159 // if all plugins updated, remember the update because it was successful 1159 Main.pref.putInt("pluginmanager.version", Version.getInstance().getVersion());1160 Main.pref.put("pluginmanager.lastupdate", Long.toString(System.currentTimeMillis()));1160 Config.getPref().putInt("pluginmanager.version", Version.getInstance().getVersion()); 1161 Config.getPref().put("pluginmanager.lastupdate", Long.toString(System.currentTimeMillis())); 1161 1162 } 1162 1163 return plugins; … … 1450 1451 return null; 1451 1452 1452 Set<String> plugins = new HashSet<>( Main.pref.getList("plugins"));1453 Set<String> plugins = new HashSet<>(Config.getPref().getList("plugins")); 1453 1454 final PluginInformation pluginInfo = plugin.getPluginInformation(); 1454 1455 if (!plugins.contains(pluginInfo.name)) … … 1465 1466 // deactivate the plugin 1466 1467 plugins.remove(plugin.getPluginInformation().name); 1467 Main.pref.putList("plugins", new ArrayList<>(plugins));1468 Config.getPref().putList("plugins", new ArrayList<>(plugins)); 1468 1469 GuiHelper.runInEDTAndWait(() -> JOptionPane.showMessageDialog( 1469 1470 Main.parent, … … 1484 1485 */ 1485 1486 public static Collection<String> getBugReportInformation() { 1486 final Collection<String> pl = new TreeSet<>( Main.pref.getList("plugins", new LinkedList<>()));1487 final Collection<String> pl = new TreeSet<>(Config.getPref().getList("plugins", new LinkedList<>())); 1487 1488 for (final PluginProxy pp : pluginList) { 1488 1489 PluginInformation pi = pp.getPluginInformation(); … … 1569 1570 1570 1571 public void initDontShowAgain(String preferencesKey) { 1571 String policy = Main.pref.get(preferencesKey, "ask");1572 String policy = Config.getPref().get(preferencesKey, "ask"); 1572 1573 policy = policy.trim().toLowerCase(Locale.ENGLISH); 1573 1574 cbDontShowAgain.setSelected(!"ask".equals(policy)); -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r12841 r12846 38 38 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 39 39 import org.openstreetmap.josm.io.OsmTransferException; 40 import org.openstreetmap.josm.spi.preferences.Config; 40 41 import org.openstreetmap.josm.tools.GBC; 41 42 import org.openstreetmap.josm.tools.HttpClient; … … 143 144 protected String downloadPluginList(String site, final ProgressMonitor monitor) { 144 145 /* replace %<x> with empty string or x=plugins (separated with comma) */ 145 String pl = Utils.join(",", Main.pref.getList("plugins"));146 String pl = Utils.join(",", Config.getPref().getList("plugins")); 146 147 String printsite = site.replaceAll("%<(.*)>", ""); 147 148 if (pl != null && !pl.isEmpty()) { -
trunk/src/org/openstreetmap/josm/tools/GuiSizesHelper.java
r12682 r12846 6 6 import java.awt.Toolkit; 7 7 8 import org.openstreetmap.josm. Main;8 import org.openstreetmap.josm.spi.preferences.Config; 9 9 10 10 /** … … 32 32 synchronized (GuiSizesHelper.class) { 33 33 if (screenDPI == -1) { 34 float scalePref = (float) Main.pref.getDouble("gui.scale", 1.0);34 float scalePref = (float) Config.getPref().getDouble("gui.scale", 1.0); 35 35 if (scalePref != 0) { 36 36 screenDPI = 96f * scalePref; -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r12841 r12846 36 36 import org.openstreetmap.josm.io.UTFInputStreamReader; 37 37 import org.openstreetmap.josm.io.auth.DefaultAuthenticator; 38 import org.openstreetmap.josm.spi.preferences.Config; 38 39 39 40 /** … … 45 46 private URL url; 46 47 private final String requestMethod; 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));48 private int connectTimeout = (int) TimeUnit.SECONDS.toMillis(Config.getPref().getInt("socket.timeout.connect", 15)); 49 private int readTimeout = (int) TimeUnit.SECONDS.toMillis(Config.getPref().getInt("socket.timeout.read", 30)); 49 50 private byte[] requestBody; 50 51 private long ifModifiedSince; 51 52 private final Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); 52 private int maxRedirects = Main.pref.getInt("socket.maxredirects", 5);53 private int maxRedirects = Config.getPref().getInt("socket.maxredirects", 5); 53 54 private boolean useCache; 54 55 private String reasonForRequest; -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r12841 r12846 72 72 import org.openstreetmap.josm.io.CachedFile; 73 73 import org.openstreetmap.josm.plugins.PluginHandler; 74 import org.openstreetmap.josm.spi.preferences.Config; 74 75 import org.w3c.dom.Element; 75 76 import org.w3c.dom.Node; … … 122 123 public enum ImageSizes { 123 124 /** SMALL_ICON value of an Action */ 124 SMALLICON( Main.pref.getInt("iconsize.smallicon", 16)),125 SMALLICON(Config.getPref().getInt("iconsize.smallicon", 16)), 125 126 /** LARGE_ICON_KEY value of an Action */ 126 LARGEICON( Main.pref.getInt("iconsize.largeicon", 24)),127 LARGEICON(Config.getPref().getInt("iconsize.largeicon", 24)), 127 128 /** map icon */ 128 MAP( Main.pref.getInt("iconsize.map", 16)),129 MAP(Config.getPref().getInt("iconsize.map", 16)), 129 130 /** map icon maximum size */ 130 MAPMAX( Main.pref.getInt("iconsize.mapmax", 48)),131 MAPMAX(Config.getPref().getInt("iconsize.mapmax", 48)), 131 132 /** cursor icon size */ 132 CURSOR( Main.pref.getInt("iconsize.cursor", 32)),133 CURSOR(Config.getPref().getInt("iconsize.cursor", 32)), 133 134 /** cursor overlay icon size */ 134 135 CURSOROVERLAY(CURSOR), … … 142 143 * @since 8323 143 144 */ 144 LAYER( Main.pref.getInt("iconsize.layer", 16)),145 LAYER(Config.getPref().getInt("iconsize.layer", 16)), 145 146 /** Toolbar button icon size 146 147 * @since 9253 … … 150 151 * @since 9253 151 152 */ 152 SIDEBUTTON( Main.pref.getInt("iconsize.sidebutton", 20)),153 SIDEBUTTON(Config.getPref().getInt("iconsize.sidebutton", 20)), 153 154 /** Settings tab icon size 154 155 * @since 9253 155 156 */ 156 SETTINGS_TAB( Main.pref.getInt("iconsize.settingstab", 48)),157 SETTINGS_TAB(Config.getPref().getInt("iconsize.settingstab", 48)), 157 158 /** 158 159 * The default image size 159 160 * @since 9705 160 161 */ 161 DEFAULT( Main.pref.getInt("iconsize.default", 24)),162 DEFAULT(Config.getPref().getInt("iconsize.default", 24)), 162 163 /** 163 164 * Splash dialog logo size … … 1018 1019 "https://wiki.openstreetmap.org/wiki/File:" 1019 1020 ); 1020 final Collection<String> baseUrls = Main.pref.getList("image-provider.wiki.urls", defaultBaseUrls);1021 final Collection<String> baseUrls = Config.getPref().getList("image-provider.wiki.urls", defaultBaseUrls); 1021 1022 1022 1023 final String fn = name.substring(name.lastIndexOf('/') + 1); -
trunk/src/org/openstreetmap/josm/tools/PlatformHook.java
r12788 r12846 19 19 import java.util.List; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.projection.datum.NTV2Proj4DirGridShiftFileSource; 23 22 import org.openstreetmap.josm.io.CertificateAmendment.CertAmend; 23 import org.openstreetmap.josm.spi.preferences.Config; 24 24 import org.openstreetmap.josm.tools.date.DateUtils; 25 25 … … 314 314 String version = Utils.getJavaLatestVersion(); 315 315 callback.askUpdateJava(version != null ? version : "latest", 316 Main.pref.get("java.update.url", "https://www.java.com/download"),316 Config.getPref().get("java.update.url", "https://www.java.com/download"), 317 317 DateUtils.getDateFormat(DateFormat.MEDIUM).format(expiration), false); 318 318 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r12841 r12846 27 27 import org.openstreetmap.josm.Main; 28 28 import org.openstreetmap.josm.io.CertificateAmendment.CertAmend; 29 import org.openstreetmap.josm.spi.preferences.Config; 29 30 30 31 /** … … 51 52 @Override 52 53 public void openUrl(String url) throws IOException { 53 for (String program : Main.pref.getList("browser.unix",54 for (String program : Config.getPref().getList("browser.unix", 54 55 Arrays.asList("xdg-open", "#DESKTOP#", "$BROWSER", "gnome-open", "kfmclient openURL", "firefox"))) { 55 56 try { -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r12776 r12846 69 69 import org.openstreetmap.josm.data.Preferences; 70 70 import org.openstreetmap.josm.io.CertificateAmendment.CertAmend; 71 import org.openstreetmap.josm.spi.preferences.Config; 71 72 72 73 /** … … 501 502 */ 502 503 protected void extendFontconfig(String templateFileName) { 503 String customFontconfigFile = Main.pref.get("fontconfig.properties", null);504 String customFontconfigFile = Config.getPref().get("fontconfig.properties", null); 504 505 if (customFontconfigFile != null) { 505 506 Utils.updateSystemProperty("sun.awt.fontconfig", customFontconfigFile); 506 507 return; 507 508 } 508 if (! Main.pref.getBoolean("font.extended-unicode", true))509 if (!Config.getPref().getBoolean("font.extended-unicode", true)) 509 510 return; 510 511 -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r12841 r12846 23 23 24 24 import org.openstreetmap.josm.Main; 25 import org.openstreetmap.josm.spi.preferences.Config; 25 26 26 27 /** … … 170 171 // create a shortcut object from an string as saved in the preferences 171 172 private Shortcut(String prefString) { 172 List<String> s = new ArrayList<>( Main.pref.getList(prefString));173 List<String> s = new ArrayList<>(Config.getPref().getList(prefString)); 173 174 this.shortText = prefString.substring(15); 174 175 this.longText = s.get(0); … … 182 183 183 184 private void saveDefault() { 184 Main.pref.getList("shortcut.entry."+shortText, Arrays.asList(longText,185 Config.getPref().getList("shortcut.entry."+shortText, Arrays.asList(longText, 185 186 String.valueOf(requestedKey), String.valueOf(requestedGroup), String.valueOf(requestedKey), 186 187 String.valueOf(getGroupModifier(requestedGroup)), String.valueOf(true), String.valueOf(false))); … … 190 191 private boolean save() { 191 192 if (isAutomatic() || isReset() || !isAssignedUser()) { 192 return Main.pref.putList("shortcut.entry."+shortText, null);193 return Config.getPref().putList("shortcut.entry."+shortText, null); 193 194 } else { 194 return Main.pref.putList("shortcut.entry."+shortText, Arrays.asList(longText,195 return Config.getPref().putList("shortcut.entry."+shortText, Arrays.asList(longText, 195 196 String.valueOf(requestedKey), String.valueOf(requestedGroup), String.valueOf(assignedKey), 196 197 String.valueOf(assignedModifier), String.valueOf(assignedDefault), String.valueOf(assignedUser))); -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r12841 r12846 12 12 import java.util.regex.Pattern; 13 13 14 import org.openstreetmap.josm. Main;14 import org.openstreetmap.josm.spi.preferences.Config; 15 15 16 16 /** … … 20 20 21 21 // properties need JOSM restart to apply, modified rarely enough 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 private static final String KEY_PATTERN = Main.pref.get("tags.paste.tag-pattern", "[0-9a-zA-Z:_]*");22 private static final int MAX_KEY_LENGTH = Config.getPref().getInt("tags.paste.max-key-length", 50); 23 private static final int MAX_KEY_COUNT = Config.getPref().getInt("tags.paste.max-key-count", 30); 24 private static final String KEY_PATTERN = Config.getPref().get("tags.paste.tag-pattern", "[0-9a-zA-Z:_]*"); 25 25 private static final int MAX_VALUE_LENGTH = 255; 26 26 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r12841 r12846 70 70 71 71 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; 72 import org.openstreetmap.josm.Main;73 72 import org.openstreetmap.josm.io.Compression; 73 import org.openstreetmap.josm.spi.preferences.Config; 74 74 import org.w3c.dom.Document; 75 75 import org.xml.sax.InputSource; … … 1246 1246 */ 1247 1247 public static ForkJoinPool newForkJoinPool(String pref, final String nameFormat, final int threadPriority) { 1248 int noThreads = Main.pref.getInt(pref, Runtime.getRuntime().availableProcessors());1248 int noThreads = Config.getPref().getInt(pref, Runtime.getRuntime().availableProcessors()); 1249 1249 return new ForkJoinPool(noThreads, new ForkJoinPool.ForkJoinWorkerThreadFactory() { 1250 1250 final AtomicLong count = new AtomicLong(0); … … 1686 1686 public static String getJavaLatestVersion() { 1687 1687 try { 1688 return HttpClient.create( 1689 new URL(Main.pref.get("java.baseline.version.url", "http://javadl-esd-secure.oracle.com/update/baseline.version"))) 1688 return HttpClient.create(new URL(Config.getPref().get("java.baseline.version.url", "http://javadl-esd-secure.oracle.com/update/baseline.version"))) 1690 1689 .connect().fetchContent().split("\n")[0]; 1691 1690 } catch (IOException e) { -
trunk/src/org/openstreetmap/josm/tools/WikiReader.java
r9168 r12846 7 7 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.spi.preferences.Config; 9 10 import org.openstreetmap.josm.tools.LanguageInfo.LocaleType; 10 11 … … 30 31 */ 31 32 public WikiReader() { 32 this( Main.pref.get("help.baseurl", Main.getJOSMWebsite()));33 this(Config.getPref().get("help.baseurl", Main.getJOSMWebsite())); 33 34 } 34 35
Note:
See TracChangeset
for help on using the changeset viewer.