Changeset 35476 in osm for applications/editors/josm/plugins/utilsplugin2
- Timestamp:
- 2020-05-29T11:26:52+02:00 (4 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java
r34454 r35476 8 8 import java.awt.event.KeyEvent; 9 9 import java.util.Collection; 10 import java.util.Map.Entry;11 10 import java.util.Set; 12 11 import java.util.TreeSet; 12 import java.util.stream.Collectors; 13 13 14 14 import javax.swing.JOptionPane; … … 21 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 22 22 import org.openstreetmap.josm.tools.Shortcut; 23 import org.openstreetmap.josm.tools.Utils;24 23 25 24 /** … … 46 45 public void actionPerformed(ActionEvent e) { 47 46 if (isEmptySelection()) return; 48 Collection<OsmPrimitive> selection = getLayerManager().get EditDataSet().getSelected();47 Collection<OsmPrimitive> selection = getLayerManager().getActiveDataSet().getSelected(); 49 48 copy(getLayerManager().getEditLayer(), selection); 50 49 } … … 59 58 Set<String> values = new TreeSet<>(); 60 59 for (OsmPrimitive p : primitives) { 61 for (Entry<String, String> kv : p.getKeys().entrySet()) { 62 values.add(new Tag(kv.getKey(), kv.getValue()).toString()); 63 } 60 p.getKeys().entrySet().forEach(kv -> values.add(new Tag(kv.getKey(), kv.getValue()).toString())); 64 61 } 65 if (!values.isEmpty()) 66 ClipboardUtils.copyString(Utils.join("\n", values)); 62 if (!values.isEmpty()) { 63 ClipboardUtils.copyString(values.stream().collect(Collectors.joining("\n"))); 64 } 67 65 } 68 66 … … 78 76 79 77 private boolean isEmptySelection() { 80 Collection<OsmPrimitive> sel = getLayerManager().get EditDataSet().getSelected();78 Collection<OsmPrimitive> sel = getLayerManager().getActiveDataSet().getSelected(); 81 79 if (sel.isEmpty()) { 82 80 JOptionPane.showMessageDialog( -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
r34822 r35476 14 14 import java.util.List; 15 15 import java.util.Map; 16 import java.util.Map.Entry;17 16 18 17 import org.openstreetmap.josm.actions.JosmAction; … … 80 79 81 80 List<Command> commands = new ArrayList<>(); 82 for ( Entry<Relation, String> entry : relations.entrySet()) {81 for (Map.Entry<Relation, String> entry : relations.entrySet()) { 83 82 Relation rel = entry.getKey(); 84 83 Relation r = new Relation(rel); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java
r35366 r35476 15 15 import java.util.List; 16 16 import java.util.Map; 17 import java.util.Map.Entry;18 17 19 18 import javax.swing.JOptionPane; … … 121 120 } 122 121 123 for ( Entry<Way, Integer> entry : wayOccurenceCounter.entrySet()) {122 for (Map.Entry<Way, Integer> entry : wayOccurenceCounter.entrySet()) { 124 123 if (entry.getValue().equals(selectedNodes.size())) { 125 124 if (selectedWay != null) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java
r34816 r35476 12 12 import java.util.List; 13 13 import java.util.Map; 14 import java.util.Map.Entry;15 14 16 15 import javax.swing.JOptionPane; … … 92 91 } 93 92 94 for ( Entry<Way, List<Node>> entry : splitWays.entrySet()) {93 for (Map.Entry<Way, List<Node>> entry : splitWays.entrySet()) { 95 94 SplitWayCommand split = SplitWayCommand.split(entry.getKey(), entry.getValue(), selectedWays); 96 95 if (split != null) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java
r35440 r35476 266 266 PolarCoor pcLast = new PolarCoor(last.getEastNorth(), center); 267 267 double delta = pcLast.angle - pcFirst.angle; 268 if (( !clockwise && delta < 0 || clockwise && delta > 0)268 if (((!clockwise && delta < 0) || (clockwise && delta > 0)) 269 269 && Math.signum(pcFirst.angle) == Math.signum(pcLast.angle)) { 270 270 // cannot project node onto circle arc, ignore that it is fixed … … 300 300 if (!oldNodes.isEmpty()) { 301 301 PolarCoor pc2 = new PolarCoor(oldNodes.get(0).getEastNorth(), center); 302 if ( pc2.angle < ref.angle && ref.angle < 0 && step > 0303 || pc2.angle > ref.angle && ref.angle > 0 && step < 0) {302 if ((pc2.angle < ref.angle && ref.angle < 0 && step > 0) 303 || (pc2.angle > ref.angle && ref.angle > 0 && step < 0)) { 304 304 // projected node would produce a loop 305 305 pc2 = ref; // -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java
r35472 r35476 44 44 @Override 45 45 protected void updateEnabledState() { 46 setEnabled(getLayerManager().get EditDataSet() != null);46 setEnabled(getLayerManager().getActiveDataSet() != null); 47 47 } 48 48 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java
r35472 r35476 43 43 @Override 44 44 public void actionPerformed(ActionEvent e) { 45 Collection<OsmPrimitive> sel = getLayerManager().get EditDataSet().getSelected();45 Collection<OsmPrimitive> sel = getLayerManager().getActiveDataSet().getSelected(); 46 46 OsmPrimitive p = null; 47 if ( sel.size() >= 1) {47 if (!sel.isEmpty()) { 48 48 p = sel.iterator().next(); 49 49 } … … 65 65 while (m.find()) { 66 66 key = m.group(1); val = null; 67 if ( key.equals("#id")) {67 if ("#id".equals(key)) { 68 68 if (p != null) { 69 69 val = Long.toString(p.getId()); … … 72 72 return; 73 73 } 74 } else if ( key.equals("#type")) {74 } else if ("#type".equals(key)) { 75 75 if (p != null) val = OsmPrimitiveType.from(p).getAPIName(); 76 } else if ( key.equals("#lat")) {76 } else if ("#lat".equals(key)) { 77 77 val = Double.toString(center.lat()); 78 } else if ( key.equals("#lon")) {78 } else if ("#lon".equals(key)) { 79 79 val = Double.toString(center.lon()); 80 } else if ( key.equals("#zoom")) {80 } else if ("#zoom".equals(key)) { 81 81 val = Integer.toString(OsmUrlToBounds.getZoom(MainApplication.getMap().mapView.getRealBounds())); 82 82 } else { … … 115 115 @Override 116 116 protected void updateEnabledState() { 117 setEnabled(getLayerManager().get EditDataSet() != null);117 setEnabled(getLayerManager().getActiveDataSet() != null); 118 118 } 119 119 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java
r35238 r35476 27 27 import javax.swing.JTextArea; 28 28 import javax.swing.UIManager; 29 import javax.swing.event.ChangeEvent;30 import javax.swing.event.ChangeListener;31 29 import javax.swing.event.DocumentEvent; 32 30 import javax.swing.event.DocumentListener; … … 50 48 public JTabbedPane tabs; 51 49 private JTextArea taLatLon; 52 private JScrollPane spScroll;53 50 private JRadioButton rbNodes; 54 51 private JRadioButton rbWay; … … 91 88 taLatLon = new JTextArea(5, 24); 92 89 taLatLon.getDocument().addDocumentListener(new CoordinateListener()); 93 spScroll = new JScrollPane(taLatLon);90 JScrollPane spScroll = new JScrollPane(taLatLon); 94 91 pnl.add(spScroll, GBC.eol().insets(0, 10, 0, 0).fill().weight(2.0, 2.0)); 95 92 … … 161 158 tabs = new JTabbedPane(); 162 159 tabs.addTab(tr("Lat/Lon"), buildLatLon()); 163 tabs.getModel().addChangeListener(new ChangeListener() { 164 @Override 165 public void stateChanged(ChangeEvent e) { 166 switch (tabs.getModel().getSelectedIndex()) { 167 case 0: parseLatLonUserInput(); break; 168 default: throw new AssertionError(); 169 } 160 tabs.getModel().addChangeListener(e -> { 161 if (tabs.getModel().getSelectedIndex() == 0) { 162 parseLatLonUserInput(); 163 } else { 164 throw new AssertionError(); 170 165 } 171 166 }); … … 174 169 175 170 public LatLonDialog(Component parent, String title, String help) { 176 super(MainApplication.getMainFrame(), tr("Add Node..."), new String[] {tr("Ok"), tr("Cancel")});177 setButtonIcons( new String[] {"ok", "cancel"});171 super(MainApplication.getMainFrame(), tr("Add Node..."), tr("Ok"), tr("Cancel")); 172 setButtonIcons("ok", "cancel"); 178 173 configureContextsensitiveHelp("/Action/AddNode", true); 179 174 … … 230 225 // 231 226 NumberFormat f = NumberFormat.getNumberInstance(); 232 Number n = null;233 227 ParsePosition pp = new ParsePosition(0); 234 n = f.parse(input, pp);228 Number n = f.parse(input, pp); 235 229 if (pp.getErrorIndex() >= 0 || pp.getIndex() < input.length()) { 236 230 // fall back - try to parse with the english locale … … 249 243 try { 250 244 latLons = parseLatLons(taLatLon.getText()); 251 Boolean working = true;245 boolean working = true; 252 246 int i = 0; 253 247 while (working && i < latLons.length) { … … 273 267 274 268 private void setOkEnabled(boolean b) { 275 if (buttons != null && buttons.size() > 0) {269 if (buttons != null && !buttons.isEmpty()) { 276 270 buttons.get(0).setEnabled(b); 277 271 } … … 354 348 sb.append("x"); // cardinal direction 355 349 String c = m.group(7).toUpperCase(); 356 if ( c.equals("N") || c.equals("S") || c.equals("E") || c.equals("W")) {350 if ("N".equals(c) || "S".equals(c) || "E".equals(c) || "W".equals(c)) { 357 351 list.add(c); 358 352 } else { … … 441 435 442 436 double coord = (coordDeg < 0 ? -1 : 1) * (Math.abs(coordDeg) + coordMin / 60 + coordSec / 3600); 443 coord = card.equals("N") || card.equals("E") ? coord : -coord;444 if ( card.equals("N") || card.equals("S")) {437 coord = "N".equals(card) || "E".equals(card) ? coord : -coord; 438 if ("N".equals(card) || "S".equals(card)) { 445 439 latLon.lat = coord; 446 440 } else { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
r35436 r35476 10 10 import java.awt.GridBagLayout; 11 11 import java.awt.event.ActionEvent; 12 import java.awt.event.ActionListener;13 12 import java.awt.event.ItemEvent; 14 13 import java.awt.event.ItemListener; … … 97 96 final JToggleButton jt = new JToggleButton("", ImageProvider.get("restart"), true); 98 97 jt.setToolTipText(tr("Sync with JOSM selection")); 99 jt.addActionListener(new ActionListener() { 100 @Override public void actionPerformed(ActionEvent e) { 101 tableModel.setWatchSelection(jt.isSelected()); 102 } 103 }); 98 jt.addActionListener(e -> tableModel.setWatchSelection(jt.isSelected())); 104 99 pnl.add(jt, GBC.eol()); 105 100 … … 136 131 for (final OsmPrimitiveType type: OsmPrimitiveType.values()) { 137 132 final JToggleButton jt = new JToggleButton("", ImageProvider.get(type), true); 138 jt.addActionListener( new ActionListener(){139 @Override140 public void actionPerformed(ActionEvent e) {141 if (jt.isSelected()) tableModel.shownTypes.add(type); else tableModel.shownTypes.remove(type);142 tableModel. updateData(MainApplication.getLayerManager().getEditDataSet().getSelected());143 }133 jt.addActionListener(e -> { 134 if (jt.isSelected()) 135 tableModel.shownTypes.add(type); 136 else 137 tableModel.shownTypes.remove(type); 138 tableModel.updateData(MainApplication.getLayerManager().getEditDataSet().getSelected()); 144 139 }); 145 140 ImageProvider.get(type); … … 193 188 194 189 }; 190 195 191 private final ListSelectionListener selectionListener = new ListSelectionListener() { 196 192 @Override -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java
r35436 r35476 32 32 Set<Node> matchedNodes = new HashSet<>(); 33 33 // find all ways that match the expression 34 Collection<Way> allWays = MainApplication.getLayerManager().get EditDataSet().getWays();34 Collection<Way> allWays = MainApplication.getLayerManager().getActiveDataSet().getWays(); 35 35 for (Way way : allWays) { 36 36 if (match.match(way)) { … … 39 39 } 40 40 // find all nodes that match the expression 41 Collection<Node> allNodes = MainApplication.getLayerManager().get EditDataSet().getNodes();41 Collection<Node> allNodes = MainApplication.getLayerManager().getActiveDataSet().getNodes(); 42 42 for (Node node : allNodes) { 43 43 if (match.match(node)) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/InsideMatch.java
r35436 r35476 29 29 Collection<OsmPrimitive> matchedAreas = new HashSet<>(); 30 30 // find all ways that match the expression 31 Collection<Way> ways = MainApplication.getLayerManager().get EditDataSet().getWays();31 Collection<Way> ways = MainApplication.getLayerManager().getActiveDataSet().getWays(); 32 32 for (Way way : ways) { 33 33 if (match.match(way)) { … … 36 36 } 37 37 // find all relations that match the expression 38 Collection<Relation> rels = MainApplication.getLayerManager().get EditDataSet().getRelations();38 Collection<Relation> rels = MainApplication.getLayerManager().getActiveDataSet().getRelations(); 39 39 for (Relation rel : rels) { 40 40 if (match.match(rel)) { … … 42 42 } 43 43 } 44 inside = NodeWayUtils.selectAllInside(matchedAreas, MainApplication.getLayerManager().get EditDataSet(), false);44 inside = NodeWayUtils.selectAllInside(matchedAreas, MainApplication.getLayerManager().getActiveDataSet(), false); 45 45 } 46 46 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java
r34822 r35476 31 31 Collection<Way> matchedWays = new HashSet<>(); 32 32 // find all ways that match the expression 33 Collection<Way> allWays = MainApplication.getLayerManager().get EditDataSet().getWays();33 Collection<Way> allWays = MainApplication.getLayerManager().getActiveDataSet().getWays(); 34 34 for (Way way : allWays) { 35 35 if (match.match(way)) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentNodesAction.java
r35470 r35476 37 37 @Override 38 38 public void actionPerformed(ActionEvent e) { 39 DataSet ds = getLayerManager().get EditDataSet();39 DataSet ds = getLayerManager().getActiveDataSet(); 40 40 Collection<Node> selectedNodes = ds.getSelectedNodes(); 41 41 Set<Way> selectedWays = new LinkedHashSet<>(ds.getSelectedWays()); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentWaysAction.java
r34812 r35476 35 35 @Override 36 36 public void actionPerformed(ActionEvent e) { 37 DataSet ds = getLayerManager().get EditDataSet();37 DataSet ds = getLayerManager().getActiveDataSet(); 38 38 Collection<Node> selectedNodes = ds.getSelectedNodes(); 39 39 Collection<Way> selectedWays = ds.getSelectedWays(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/ConnectedWaysAction.java
r34812 r35476 32 32 @Override 33 33 public void actionPerformed(ActionEvent e) { 34 DataSet ds = getLayerManager().get EditDataSet();34 DataSet ds = getLayerManager().getActiveDataSet(); 35 35 Collection<Node> selectedNodes = ds.getSelectedNodes(); 36 36 Collection<Way> selectedWays = ds.getSelectedWays(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysAction.java
r34812 r35476 34 34 @Override 35 35 public void actionPerformed(ActionEvent e) { 36 DataSet ds = getLayerManager().get EditDataSet();36 DataSet ds = getLayerManager().getActiveDataSet(); 37 37 Collection<Way> selectedWays = ds.getSelectedWays(); 38 38 … … 44 44 selectedWays, newWays); 45 45 ds.addSelected(newWays); 46 return;47 46 } else { 48 47 new Notification( -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysRecursiveAction.java
r34812 r35476 35 35 @Override 36 36 public void actionPerformed(ActionEvent e) { 37 DataSet ds = getLayerManager().get EditDataSet();37 DataSet ds = getLayerManager().getActiveDataSet(); 38 38 Collection<Way> selectedWays = ds.getSelectedWays(); 39 39 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/MiddleNodesAction.java
r35468 r35476 35 35 @Override 36 36 public void actionPerformed(ActionEvent e) { 37 Set<Node> selectedNodes = new HashSet<>(getLayerManager().get EditDataSet().getSelectedNodes());37 Set<Node> selectedNodes = new HashSet<>(getLayerManager().getActiveDataSet().getSelectedNodes()); 38 38 39 39 // if no 2 nodes and no ways are selected, do nothing … … 49 49 50 50 // make sure that selected nodes are in the wanted order (see #josm17258) 51 getLayerManager().get EditDataSet().clearSelection(newSelectedNodes);52 getLayerManager().get EditDataSet().addSelected(newSelectedNodes);51 getLayerManager().getActiveDataSet().clearSelection(newSelectedNodes); 52 getLayerManager().getActiveDataSet().addSelected(newSelectedNodes); 53 53 } 54 54 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectAllInsideAction.java
r33212 r35476 32 32 @Override 33 33 public void actionPerformed(ActionEvent e) { 34 DataSet ds = getLayerManager().get EditDataSet();34 DataSet ds = getLayerManager().getActiveDataSet(); 35 35 Collection<OsmPrimitive> insideSelected = NodeWayUtils.selectAllInside(ds.getSelected(), ds, true); 36 36 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectBoundaryAction.java
r35174 r35476 41 41 @Override 42 42 public void actionPerformed(ActionEvent e) { 43 DataSet ds = getLayerManager().get EditDataSet();43 DataSet ds = getLayerManager().getActiveDataSet(); 44 44 if (ds != null) { 45 45 Collection<Way> selectedWays = ds.getSelectedWays(); … … 97 97 @Override 98 98 protected void updateEnabledState() { 99 setEnabled(getLayerManager().get EditDataSet() != null);99 setEnabled(getLayerManager().getActiveDataSet() != null); 100 100 } 101 101 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectHighwayAction.java
r34932 r35476 41 41 @Override 42 42 public void actionPerformed(ActionEvent e) { 43 DataSet ds = getLayerManager().get EditDataSet();43 DataSet ds = getLayerManager().getActiveDataSet(); 44 44 List<Way> selectedWays = new ArrayList<>(ds.getSelectedWays()); 45 45 … … 55 55 } 56 56 57 private Set<Way> selectNamedRoad(Way firstWay) {57 private static Set<Way> selectNamedRoad(Way firstWay) { 58 58 Set<Way> newWays = new HashSet<>(); 59 59 String key = firstWay.hasKey("name") ? "name" : "ref"; … … 75 75 } 76 76 77 private Set<Way> selectHighwayBetween(Way firstWay, Way lastWay) {77 private static Set<Way> selectHighwayBetween(Way firstWay, Way lastWay) { 78 78 int minRank = Math.min(getHighwayRank(firstWay), getHighwayRank(lastWay)); 79 79 HighwayTree firstTree = new HighwayTree(firstWay, minRank); … … 95 95 return 0; 96 96 String highway = way.get("highway"); 97 if ( highway.equals("path") || highway.equals("footway") || highway.equals("cycleway"))97 if ("path".equals(highway) || "footway".equals(highway) || "cycleway".equals(highway)) 98 98 return 1; 99 else if ( highway.equals("track") || highway.equals("service"))99 else if ("track".equals(highway) || "service".equals(highway)) 100 100 return 2; 101 else if ( highway.equals("unclassified") || highway.equals("residential"))101 else if ("unclassified".equals(highway) || "residential".equals(highway)) 102 102 return 3; 103 else if ( highway.equals("tertiary") || highway.equals("tertiary_link"))103 else if ("tertiary".equals(highway) || "tertiary_link".equals(highway)) 104 104 return 4; 105 else if ( highway.equals("secondary") || highway.equals("secondary_link"))105 else if ("secondary".equals(highway) || "secondary_link".equals(highway)) 106 106 return 5; 107 else if ( highway.equals("primary") || highway.equals("primary_link"))107 else if ("primary".equals(highway) || "primary_link".equals(highway)) 108 108 return 6; 109 else if ( highway.equals("trunk") || highway.equals("trunk_link") || highway.equals("motorway") || highway.equals("motorway_link"))109 else if ("trunk".equals(highway) || "trunk_link".equals(highway) || "motorway".equals(highway) || "motorway_link".equals(highway)) 110 110 return 7; 111 111 return 0; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectWayNodesAction.java
r35468 r35476 41 41 Set<Node> selectedNodes = new LinkedHashSet<>(); 42 42 43 for (OsmPrimitive p : getLayerManager().get EditDataSet().getSelected()) {43 for (OsmPrimitive p : getLayerManager().getActiveDataSet().getSelected()) { 44 44 if (p instanceof Way) { 45 45 Way w = (Way) p; … … 56 56 } 57 57 58 getLayerManager().get EditDataSet().setSelected(selectedNodes);58 getLayerManager().getActiveDataSet().setSelected(selectedNodes); 59 59 } 60 60 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UndoSelectionAction.java
r34932 r35476 30 30 } 31 31 32 private Collection<OsmPrimitive> lastSel;32 private transient Collection<OsmPrimitive> lastSel; 33 33 private int index; 34 34 35 35 @Override 36 36 public void actionPerformed(ActionEvent e) { 37 DataSet ds = getLayerManager().get EditDataSet();37 DataSet ds = getLayerManager().getActiveDataSet(); 38 38 if (ds != null) { 39 39 LinkedList<Collection<? extends OsmPrimitive>> history = ds.getSelectionHistory(); … … 78 78 @Override 79 79 protected void updateEnabledState() { 80 DataSet ds = getLayerManager().getEditDataSet();81 80 lastSel = null; 82 81 index = -1; 83 setEnabled(ds != null && ds.getSelectionHistory().isEmpty()); 82 setEnabled(getLayerManager().getActiveDataSet() != null); 83 } 84 85 @Override 86 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 87 setEnabled(getLayerManager().getActiveDataSet() != null); 84 88 } 85 89 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UnselectNodesAction.java
r34812 r35476 31 31 @Override 32 32 public void actionPerformed(ActionEvent e) { 33 getLayerManager().get EditDataSet().clearSelection(getLayerManager().getEditDataSet().getSelectedNodes());33 getLayerManager().getActiveDataSet().clearSelection(getLayerManager().getActiveDataSet().getSelectedNodes()); 34 34 } 35 35
Note:
See TracChangeset
for help on using the changeset viewer.