Changeset 21280 in osm for applications/editors/josm
- Timestamp:
- 2010-05-15T14:41:06+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/tagging-preset-tester
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/tagging-preset-tester/build.xml
r19481 r21280 29 29 30 30 <property name="commit.message" value="Changed the constructor signature of the plugin main class" /> 31 <property name="plugin.main.version" value=" 2830" />31 <property name="plugin.main.version" value="3250" /> 32 32 33 33 -
applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTester.java
r19481 r21280 12 12 import java.io.BufferedReader; 13 13 import java.net.URL; 14 import java.util.Arrays; 14 15 import java.util.Collection; 15 16 import java.util.Collections; … … 27 28 import org.openstreetmap.josm.data.osm.OsmPrimitive; 28 29 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 29 import org.openstreetmap.josm.plugins.PluginInformation;30 30 import org.xml.sax.SAXException; 31 31 … … 38 38 39 39 public void reload() { 40 Vector<TaggingPreset> allPresets = new Vector<TaggingPreset>(); 41 for (String source : args) { 42 InputStream in = null; 43 try { 44 if (source.startsWith("http") || source.startsWith("ftp") || source.startsWith("file")) 45 in = new URL(source).openStream(); 46 else 47 in = new FileInputStream(source); 48 allPresets.addAll(TaggingPreset.readAll(new BufferedReader(new InputStreamReader(in)))); 49 } catch (IOException e) { 50 e.printStackTrace(); 51 JOptionPane.showMessageDialog(null, tr("Could not read tagging preset source: {0}",source)); 52 } catch (SAXException e) { 53 e.printStackTrace(); 54 JOptionPane.showMessageDialog(null, tr("Error parsing {0}: {1}",source,e.getMessage())); 55 } 56 57 try { 58 if (in != null) 59 in.close(); 60 } catch (IOException e) { 61 } 62 } 40 Vector<TaggingPreset> allPresets = new Vector<TaggingPreset>(TaggingPreset.readAll(Arrays.asList(args))); 63 41 taggingPresets.setModel(new DefaultComboBoxModel(allPresets)); 64 42 } … … 78 56 } 79 57 80 public TaggingPresetTester(PluginInformation info) {81 this(new String[]{});82 }83 84 58 public TaggingPresetTester(String[] args) { 85 59 super(tr("Tagging Preset Tester")); -
applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTesterAction.java
r13497 r21280 5 5 import java.awt.event.ActionEvent; 6 6 import java.awt.event.KeyEvent; 7 import java.util.Collection; 8 import java.util.Collections; 7 9 8 10 import javax.swing.JOptionPane; … … 11 13 import org.openstreetmap.josm.actions.JosmAction; 12 14 import org.openstreetmap.josm.gui.MainMenu; 15 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 16 import org.openstreetmap.josm.plugins.PluginInformation; 13 17 import org.openstreetmap.josm.tools.Shortcut; 14 18 … … 29 33 } 30 34 35 public TaggingPresetTesterAction(PluginInformation info) { 36 this(); 37 } 38 31 39 public void actionPerformed(ActionEvent e) { 32 String taggingPresetSources = Main.pref.get("taggingpreset.sources"); 33 if (taggingPresetSources.equals("")) { 40 Collection<String> coll = TaggingPreset.getPresetSources(); 41 42 if (coll.size() == 0) { 34 43 JOptionPane.showMessageDialog(Main.parent, tr("You have to specify tagging preset sources in the preferences first.")); 35 44 return; 36 45 } 37 String[] args = taggingPresetSources.split(";"); 38 new TaggingPresetTester(args); 46 47 String[] taggingPresetSources = new String [coll.size()]; 48 coll.toArray(taggingPresetSources); 49 new TaggingPresetTester(taggingPresetSources); 39 50 } 40 51 }
Note:
See TracChangeset
for help on using the changeset viewer.