Changeset 14122 in josm
- Timestamp:
- 2018-08-11T18:18:58+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r14119 r14122 693 693 } 694 694 695 /** 696 * Gets a map of all settings that are currently stored 697 * @return The settings 698 */ 695 @Override 699 696 public Map<String, Setting<?>> getAllSettings() { 700 697 return new TreeMap<>(settingsMap); -
trunk/src/org/openstreetmap/josm/spi/preferences/AbstractPreferences.java
r12881 r14122 124 124 125 125 /** 126 * Gets a map of all settings that are currently stored 127 * @return The settings 128 */ 129 public abstract Map<String, Setting<?>> getAllSettings(); 130 131 /** 126 132 * Set a value for a certain setting. The changed setting is saved to the preference file immediately. 127 133 * Due to caching mechanisms on modern operating systems and hardware, this shouldn't be a performance problem. -
trunk/src/org/openstreetmap/josm/spi/preferences/MemoryPreferences.java
r12987 r14122 7 7 import java.util.Objects; 8 8 import java.util.Set; 9 import java.util.TreeMap; 9 10 10 11 /** … … 22 23 @Override 23 24 public boolean putSetting(String key, Setting<?> setting) { 24 Setting current = settings.get(key); 25 Setting<?> current = settings.get(key); 25 26 if (setting == null) { 26 27 settings.remove(key); … … 33 34 @Override 34 35 public <T extends Setting<?>> T getSetting(String key, T def, Class<T> klass) { 35 Setting current = settings.get(key); 36 Setting<?> current = settings.get(key); 36 37 if (current != null && klass.isInstance(current)) { 37 38 @SuppressWarnings("unchecked") … … 45 46 public Set<String> getKeySet() { 46 47 return Collections.unmodifiableSet(settings.keySet()); 48 } 49 50 @Override 51 public Map<String, Setting<?>> getAllSettings() { 52 return new TreeMap<>(settings); 47 53 } 48 54 … … 66 72 // do nothing 67 73 } 68 69 74 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java
r14120 r14122 40 40 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 41 41 import org.openstreetmap.josm.gui.util.GuiHelper; 42 import org.openstreetmap.josm.spi.preferences.Config; 42 43 import org.openstreetmap.josm.testutils.ImagePatternMatching; 43 44 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 225 226 @Test 226 227 public void testSourcePrefObeyed() throws Exception { 227 Main.pref.put("slippy_map_chooser.mapstyle", "Green Tiles");228 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 228 229 229 230 this.setUpMiniMap(); … … 252 253 @Test 253 254 public void testSourcePrefInvalid() throws Exception { 254 Main.pref.put("slippy_map_chooser.mapstyle", "Hooloovoo Tiles");255 Config.getPref().put("slippy_map_chooser.mapstyle", "Hooloovoo Tiles"); 255 256 256 257 this.setUpMiniMap(); … … 277 278 MainApplication.getLayerManager().addLayer(new TestLayer()); 278 279 279 Main.pref.put("slippy_map_chooser.mapstyle", "White Tiles");280 Config.getPref().put("slippy_map_chooser.mapstyle", "White Tiles"); 280 281 // ensure projection matches JMapViewer's 281 282 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); … … 415 416 @Test 416 417 public void testShowDownloadedArea() throws Exception { 417 Main.pref.put("slippy_map_chooser.mapstyle", "Green Tiles");418 Main.pref.putBoolean("slippy_map_chooser.show_downloaded_area", false);418 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 419 Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", false); 419 420 420 421 DataSet dataSet = new DataSet(); … … 574 575 @Test 575 576 public void testShowDownloadedAreaLayerSwitching() throws Exception { 576 Main.pref.put("slippy_map_chooser.mapstyle", "Green Tiles");577 Main.pref.putBoolean("slippy_map_chooser.show_downloaded_area", true);577 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 578 Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", true); 578 579 579 580 DataSet dataSetA = new DataSet();
Note:
See TracChangeset
for help on using the changeset viewer.