Changeset 28194 in osm for applications/editors/josm/plugins/wikipedia/src/org
- Timestamp:
- 2012-04-05T14:25:07+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaToggleDialog.java
r28187 r28194 17 17 import javax.swing.DefaultListModel; 18 18 import javax.swing.JList; 19 import javax.swing.JOptionPane; 19 20 import javax.xml.parsers.DocumentBuilderFactory; 20 21 import javax.xml.xpath.XPathConstants; … … 24 25 import org.openstreetmap.josm.data.coor.LatLon; 25 26 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 27 import org.openstreetmap.josm.data.preferences.StringProperty; 26 28 import org.openstreetmap.josm.gui.SideButton; 27 29 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; … … 38 40 createLayout(list, true, Arrays.asList( 39 41 new SideButton(new WikipediaDownloadAction()), 40 new SideButton(new OpenWikipediaArticleAction()))); 42 new SideButton(new OpenWikipediaArticleAction()), 43 new SideButton(new WikipediaSettingsAction(), false))); 41 44 } 45 final StringProperty wikipediaLang = new StringProperty("wikipedia.lang", LanguageInfo.getWikiLanguagePrefix()); 42 46 final DefaultListModel<WikipediaEntry> model = new DefaultListModel<WikipediaEntry>(); 43 47 final JList<WikipediaEntry> list = new JList<WikipediaEntry>(model) { … … 106 110 // construct url 107 111 final String url = "http://toolserver.org/~kolossos/geoworld/marks.php?" 108 + "bbox=" + bbox + "& lang=" + LanguageInfo.getWikiLanguagePrefix();112 + "bbox=" + bbox + "&LANG=" + wikipediaLang.get(); 109 113 System.out.println("Wikipedia: GET " + url); 110 114 // parse XML document … … 159 163 } 160 164 } 165 166 class WikipediaSettingsAction extends AbstractAction { 167 168 public WikipediaSettingsAction() { 169 super(tr("Language"), ImageProvider.get("dialogs/settings")); 170 putValue(SHORT_DESCRIPTION, tr("Sets the default language for the Wikipedia articles")); 171 } 172 173 @Override 174 public void actionPerformed(ActionEvent e) { 175 String lang = JOptionPane.showInputDialog( 176 WikipediaToggleDialog.this, 177 tr("Enter the Wikipedia language"), 178 wikipediaLang.get()); 179 if (lang != null) { 180 wikipediaLang.put(lang); 181 } 182 } 183 } 161 184 }
Note:
See TracChangeset
for help on using the changeset viewer.