Changeset 34553 in osm for applications
- Timestamp:
- 2018-08-18T20:11:52+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/roadsigns
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/roadsigns/build.xml
r33798 r34553 4 4 <property name="commit.message" value=""/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 3007"/>6 <property name="plugin.main.version" value="14153"/> 7 7 8 8 <!-- -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignInputDialog.java
r34095 r34553 62 62 import javax.swing.table.AbstractTableModel; 63 63 64 import org.openstreetmap.josm.Main;65 64 import org.openstreetmap.josm.command.ChangePropertyCommand; 66 65 import org.openstreetmap.josm.command.Command; 67 66 import org.openstreetmap.josm.command.SequenceCommand; 67 import org.openstreetmap.josm.data.UndoRedoHandler; 68 68 import org.openstreetmap.josm.data.osm.OsmPrimitive; 69 69 import org.openstreetmap.josm.gui.ExtendedDialog; … … 78 78 import org.openstreetmap.josm.plugins.roadsigns.Sign.SignParameter; 79 79 import org.openstreetmap.josm.plugins.roadsigns.Sign.Tag; 80 import org.openstreetmap.josm.spi.preferences.Config; 80 81 import org.openstreetmap.josm.tools.GBC; 81 82 import org.openstreetmap.josm.tools.Logging; … … 112 113 113 114 RoadSignInputDialog() { 114 super(Main .parent, tr("Road Sign Plugin"), new String[] {tr("OK"), tr("Cancel")}, false /* modal */);115 super(MainApplication.getMainFrame(), tr("Road Sign Plugin"), new String[] {tr("OK"), tr("Cancel")}, false /* modal */); 115 116 setRememberWindowGeometry(getClass().getName() + ".geometry", 116 WindowGeometry.centerInWindow(Main .parent, new Dimension(750, 550)));117 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(750, 550))); 117 118 118 119 this.signs = RoadSignsPlugin.signs; … … 138 139 Collection<OsmPrimitive> selPrim = MainApplication.getLayerManager().getEditDataSet().getSelected(); 139 140 if (!selPrim.isEmpty()) { 140 Main.pref.putBoolean("plugin.roadsigns.addTrafficSignTag", addTrafficSignTag.isSelected());141 Config.getPref().putBoolean("plugin.roadsigns.addTrafficSignTag", addTrafficSignTag.isSelected()); 141 142 142 143 Command cmd = createCommand(selPrim); 143 144 if (cmd != null) { 144 MainApplication.undoRedo.add(cmd);145 UndoRedoHandler.getInstance().add(cmd); 145 146 } 146 147 } … … 592 593 593 594 addTrafficSignTag = new JCheckBox(tr("{0} tag", "traffic_sign")); 594 addTrafficSignTag.setSelected( Main.pref.getBoolean("plugin.roadsigns.addTrafficSignTag"));595 addTrafficSignTag.setSelected(Config.getPref().getBoolean("plugin.roadsigns.addTrafficSignTag")); 595 596 addTrafficSignTag.addActionListener(new ActionListener() { 596 597 @Override … … 816 817 817 818 if (sign.wiki != null || sign.loc_wiki != null) { 818 String wikiPrefix = Main.pref.get("plugin.roadsigns.wikiprefix", "https://wiki.openstreetmap.org/wiki/");819 String wikiPrefix = Config.getPref().get("plugin.roadsigns.wikiprefix", "https://wiki.openstreetmap.org/wiki/"); 819 820 txt.append("<p>"); 820 821 if (sign.loc_wiki != null) { … … 907 908 908 909 selectionBox = new JComboBox<>(presetsData.toArray(new PresetMetaData[0])); 909 String code = Main.pref.get("plugin.roadsigns.preset.selection", null);910 String code = Config.getPref().get("plugin.roadsigns.preset.selection", null); 910 911 if (code != null) { 911 912 for (PresetMetaData data : presetsData) { … … 927 928 grp.add(rbUseful); 928 929 929 String filterPref = Main.pref.get("plugin.roadsigns.preset.filter");930 String filterPref = Config.getPref().get("plugin.roadsigns.preset.filter"); 930 931 if (filterPref.equals("useful")) { 931 932 rbUseful.setSelected(true); … … 967 968 } 968 969 if (filter != null) { 969 Main.pref.put("plugin.roadsigns.preset.filter", filter);970 Config.getPref().put("plugin.roadsigns.preset.filter", filter); 970 971 } 971 972 RoadSignsPlugin.setSelectedPreset(presetsData.get(selectionBox.getSelectedIndex())); -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsPlugin.java
r33798 r34553 24 24 import javax.swing.JOptionPane; 25 25 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.actions.JosmAction; 28 27 import org.openstreetmap.josm.data.StructUtils; 29 28 import org.openstreetmap.josm.data.StructUtils.StructEntry; 30 29 import org.openstreetmap.josm.gui.ExtendedDialog; 30 import org.openstreetmap.josm.gui.MainApplication; 31 31 import org.openstreetmap.josm.gui.dialogs.properties.PropertiesDialog; 32 32 import org.openstreetmap.josm.io.CachedFile; … … 34 34 import org.openstreetmap.josm.plugins.PluginInformation; 35 35 import org.openstreetmap.josm.plugins.roadsigns.RoadSignInputDialog.SettingsPanel; 36 import org.openstreetmap.josm.spi.preferences.Config; 36 37 import org.openstreetmap.josm.tools.Shortcut; 37 38 import org.openstreetmap.josm.tools.Utils; … … 90 91 @Override 91 92 public void actionPerformed(ActionEvent e) { 92 String code = Main.pref.get("plugin.roadsigns.preset.selection", null);93 String code = Config.getPref().get("plugin.roadsigns.preset.selection", null); 93 94 if (code == null) { 94 ExtendedDialog ed = new ExtendedDialog(Main .parent, tr("Settings"), new String[] {tr("Ok"), tr("Cancel")});95 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Settings"), new String[] {tr("Ok"), tr("Cancel")}); 95 96 ed.setButtonIcons(new String[] {"ok", "cancel"}); 96 97 SettingsPanel settings = new SettingsPanel(true, null); … … 138 139 139 140 public static void setSelectedPreset(PresetMetaData preset) throws IOException { 140 Main.pref.put("plugin.roadsigns.preset.selection", preset.code);141 Config.getPref().put("plugin.roadsigns.preset.selection", preset.code); 141 142 loadSignPreset(); 142 143 } … … 145 146 146 147 List<PresetMetaData> presetsData = StructUtils.getListOfStructs( 147 Main.pref, "plugin.roadsigns.presets", DEFAULT_PRESETS, PresetMetaData.class);148 149 String customFile = Main.pref.get("plugin.roadsigns.sources", null);148 Config.getPref(), "plugin.roadsigns.presets", DEFAULT_PRESETS, PresetMetaData.class); 149 150 String customFile = Config.getPref().get("plugin.roadsigns.sources", null); 150 151 if (customFile == null) { 151 152 // for legacy reasons, try both string and collection preference type 152 List<String> customFiles = Main.pref.getList("plugin.roadsigns.sources", null);153 List<String> customFiles = Config.getPref().getList("plugin.roadsigns.sources", null); 153 154 if (customFiles != null && !customFiles.isEmpty()) { 154 155 customFile = customFiles.iterator().next(); … … 159 160 // first check, if custom file preference has changed. If yes, 160 161 // change the current preset selection to custom directly 161 String lastCustomFile = Main.pref.get("plugin.roadsigns.sources.last", null);162 String lastCustomFile = Config.getPref().get("plugin.roadsigns.sources.last", null); 162 163 if (!Objects.equals(customFile, lastCustomFile)) { 163 Main.pref.put("plugin.roadsigns.sources.last", customFile);164 Main.pref.put("plugin.roadsigns.preset.selection", "custom");165 } 166 167 String customIconDirsStr = Main.pref.get("plugin.roadsigns.icon.sources", null);164 Config.getPref().put("plugin.roadsigns.sources.last", customFile); 165 Config.getPref().put("plugin.roadsigns.preset.selection", "custom"); 166 } 167 168 String customIconDirsStr = Config.getPref().get("plugin.roadsigns.icon.sources", null); 168 169 List<String> customIconDirs = null; 169 170 if (customIconDirsStr != null) { 170 171 customIconDirs = new ArrayList<>(Arrays.asList(customIconDirsStr.split(","))); 171 172 } else { 172 customIconDirs = Main.pref.getList("plugin.roadsigns.icon.sources", null);173 customIconDirs = Config.getPref().getList("plugin.roadsigns.icon.sources", null); 173 174 } 174 175 if (customIconDirs != null) { … … 191 192 } 192 193 } 193 if ( Main.pref.getBoolean("plugin.roadsigns.use_default_icon_source", true)) {194 if (Config.getPref().getBoolean("plugin.roadsigns.use_default_icon_source", true)) { 194 195 customIconDirs.add("resource://images/"); 195 196 } … … 197 198 presetsData.add(custom); 198 199 } else { 199 Main.pref.put("plugin.roadsigns.sources.last", null);200 Config.getPref().put("plugin.roadsigns.sources.last", null); 200 201 } 201 202 … … 205 206 protected static void loadSignPreset() throws IOException { 206 207 List<PresetMetaData> presetsData = getAvailablePresetsMetaData(); 207 String code = Main.pref.get("plugin.roadsigns.preset.selection", null);208 String code = Config.getPref().get("plugin.roadsigns.preset.selection", null); 208 209 209 210 for (PresetMetaData data : presetsData) { … … 231 232 ex.printStackTrace(); 232 233 JOptionPane.showMessageDialog( 233 Main .parent,234 MainApplication.getMainFrame(), 234 235 tr("Could not read tagging preset source: ''{0}''", source), 235 236 tr("Error"), … … 240 241 ex.printStackTrace(); 241 242 JOptionPane.showMessageDialog( 242 Main .parent,243 MainApplication.getMainFrame(), 243 244 tr("Error parsing tagging preset from ''{0}'':\n", source)+ex.getMessage(), 244 245 tr("Error"), -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsReader.java
r32673 r34553 15 15 import javax.xml.parsers.SAXParserFactory; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.plugins.roadsigns.Sign.SignParameter; 19 18 import org.openstreetmap.josm.plugins.roadsigns.Sign.Tag; 20 19 import org.openstreetmap.josm.plugins.roadsigns.javacc.ParseException; 21 20 import org.openstreetmap.josm.plugins.roadsigns.javacc.TokenMgrError; 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 import org.openstreetmap.josm.tools.LanguageInfo; 23 23 import org.openstreetmap.josm.tools.XmlParsingException; … … 316 316 factory.newSAXParser().parse(inputSource, parser); 317 317 parser.wireSupplements(); 318 String filterPref = Main.pref.get("plugin.roadsigns.preset.filter");318 String filterPref = Config.getPref().get("plugin.roadsigns.preset.filter"); 319 319 if (filterPref.equals("useful")) { 320 320 List<Sign> filtered = new ArrayList<>();
Note:
See TracChangeset
for help on using the changeset viewer.