Changeset 32424 in osm for applications/editors/josm/plugins/wikipedia/src
- Timestamp:
- 2016-06-28T23:13:26+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/wikipedia/src/org/wikipedia
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/FetchWikidataAction.java
r32058 r32424 20 20 import org.openstreetmap.josm.command.Command; 21 21 import org.openstreetmap.josm.command.SequenceCommand; 22 import org.openstreetmap.josm.data.osm.DataSet; 22 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 24 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; … … 37 38 @Override 38 39 public void actionPerformed(ActionEvent e) { 39 if (getCurrentDataSet() == null) { 40 DataSet ds = getLayerManager().getEditDataSet(); 41 if (ds == null) { 40 42 return; 41 43 } 42 Main.worker.submit(new Fetcher( getCurrentDataSet().getSelected()));44 Main.worker.submit(new Fetcher(ds.getSelected())); 43 45 } 44 46 … … 156 158 @Override 157 159 protected void updateEnabledState() { 158 if (getCurrentDataSet() == null) { 160 DataSet ds = getLayerManager().getEditDataSet(); 161 if (ds == null) { 159 162 setEnabled(false); 160 163 } else { 161 updateEnabledState( getCurrentDataSet().getSelected());164 updateEnabledState(ds.getSelected()); 162 165 } 163 166 } -
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikidataTagCellRenderer.java
r32001 r32424 19 19 20 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.tools.LanguageInfo;22 21 import org.openstreetmap.josm.tools.Predicates; 23 22 import org.openstreetmap.josm.tools.Utils; -
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaAddNamesAction.java
r30737 r32424 13 13 import org.openstreetmap.josm.Main; 14 14 import org.openstreetmap.josm.actions.JosmAction; 15 import org.openstreetmap.josm.data.osm.DataSet; 15 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 17 import org.openstreetmap.josm.data.preferences.StringProperty; … … 40 41 Main.debug(tags.toString()); 41 42 } 42 AddTagsDialog.addTags(tags.toArray(new String[tags.size()][]), "Wikipedia", Main.main.getCurrentDataSet().getSelected());43 AddTagsDialog.addTags(tags.toArray(new String[tags.size()][]), "Wikipedia", getLayerManager().getEditDataSet().getSelected()); 43 44 } 44 45 … … 47 48 || Arrays.asList(Locale.getISOLanguages()).contains(i.lang)) 48 49 && (!Main.pref.getBoolean("wikipedia.filter-same-names", true) 49 || !i.article.equals(get CurrentDataSet().getSelected().iterator().next().get("name")));50 || !i.article.equals(getLayerManager().getEditDataSet().getSelected().iterator().next().get("name"))); 50 51 } 51 52 52 53 protected String getWikipediaValue() { 53 if (getCurrentDataSet() == null || getCurrentDataSet().getSelected() == null || getCurrentDataSet().getSelected().size() != 1) { 54 DataSet ds = getLayerManager().getEditDataSet(); 55 if (ds == null || ds.getSelected() == null || ds.getSelected().size() != 1) { 54 56 return null; 55 57 } else { 56 return getCurrentDataSet().getSelected().iterator().next().get("wikipedia");58 return ds.getSelected().iterator().next().get("wikipedia"); 57 59 } 58 60 } -
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaCopyTemplate.java
r29854 r32424 14 14 import org.openstreetmap.josm.data.Preferences; 15 15 import org.openstreetmap.josm.data.Preferences.pref; 16 import org.openstreetmap.josm.data.osm.DataSet; 16 17 import org.openstreetmap.josm.data.osm.Node; 17 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 98 99 99 100 protected Node getSelectedNode() { 100 if (getCurrentDataSet() == null || getCurrentDataSet().getSelected() == null) { 101 DataSet ds = getLayerManager().getEditDataSet(); 102 if (ds == null || ds.getSelected() == null) { 101 103 return null; 102 104 } else { 103 Collection<Node> nodes = Utils.filteredCollection( getCurrentDataSet().getSelected(), Node.class);105 Collection<Node> nodes = Utils.filteredCollection(ds.getSelected(), Node.class); 104 106 return nodes.isEmpty() ? null : nodes.iterator().next(); 105 107 } -
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaToggleDialog.java
r32387 r32424 39 39 import org.openstreetmap.josm.gui.SideButton; 40 40 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 41 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 42 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 41 43 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 42 44 import org.openstreetmap.josm.tools.ImageProvider; … … 45 47 import org.wikipedia.WikipediaApp.WikipediaEntry; 46 48 47 public class WikipediaToggleDialog extends ToggleDialog implements MapView.EditLayerChangeListener, DataSetListenerAdapter.Listener {49 public class WikipediaToggleDialog extends ToggleDialog implements ActiveLayerChangeListener, DataSetListenerAdapter.Listener { 48 50 49 51 public WikipediaToggleDialog() { … … 279 281 Tag tag = ((WikipediaEntry) list.getSelectedValue()).createWikipediaTag(); 280 282 if (tag != null) { 281 final Collection<OsmPrimitive> selected = Main. main.getCurrentDataSet().getSelected();283 final Collection<OsmPrimitive> selected = Main.getLayerManager().getEditDataSet().getSelected(); 282 284 if (!GuiUtils.confirmOverwrite(tag.getKey(), tag.getValue(), selected)) { 283 285 return; … … 317 319 protected void updateWikipediaArticles() { 318 320 articles.clear(); 319 if (Main.main != null && Main. main.getCurrentDataSet() != null) {320 for (final OsmPrimitive p : Main. main.getCurrentDataSet().allPrimitives()) {321 if (Main.main != null && Main.getLayerManager().getEditDataSet() != null) { 322 for (final OsmPrimitive p : Main.getLayerManager().getEditDataSet().allPrimitives()) { 321 323 articles.addAll(WikipediaApp.getWikipediaArticles(wikipediaLang.get(), p)); 322 324 } … … 329 331 public void showNotify() { 330 332 DatasetEventManager.getInstance().addDatasetListener(dataChangedAdapter, FireMode.IN_EDT_CONSOLIDATED); 331 Ma pView.addEditLayerChangeListener(this);333 Main.getLayerManager().addActiveLayerChangeListener(this); 332 334 updateWikipediaArticles(); 333 335 } … … 336 338 public void hideNotify() { 337 339 DatasetEventManager.getInstance().removeDatasetListener(dataChangedAdapter); 338 Ma pView.removeEditLayerChangeListener(this);340 Main.getLayerManager().removeActiveLayerChangeListener(this); 339 341 articles.clear(); 340 342 } 341 343 342 344 @Override 343 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {345 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 344 346 updateWikipediaArticles(); 345 347 list.repaint();
Note:
See TracChangeset
for help on using the changeset viewer.