Changeset 32333 in osm for applications/editors/josm/plugins/utilsplugin2
- Timestamp:
- 2016-06-20T00:50:21+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/build.xml
r31926 r32333 5 5 <property name="commit.message" value="[josm_utilsplugin2]: select boundary by double-click; multitagger table highlights"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value=" 8919"/>7 <property name="plugin.main.version" value="10420"/> 8 8 9 9 <property name="plugin.author" value="Kalle Lampila, Upliner, Zverik, akks, joshdoe and others"/> -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AddIntersectionsAction.java
r30737 r32333 28 28 29 29 public class AddIntersectionsAction extends JosmAction { 30 31 /** 32 * Constructs a new {@code AddIntersectionsAction}. 33 */ 30 34 public AddIntersectionsAction() { 31 35 super(tr("Add nodes at intersections"), "addintersect", tr("Add missing nodes at intersections of selected ways."), … … 38 42 if (!isEnabled()) 39 43 return; 40 List<Way> ways = OsmPrimitive.getFilteredList(get CurrentDataSet().getSelected(), Way.class);44 List<Way> ways = OsmPrimitive.getFilteredList(getLayerManager().getEditDataSet().getSelected(), Way.class); 41 45 if (ways.isEmpty()) { 42 46 new Notification( … … 56 60 Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives(); 57 61 for ( OsmPrimitive p : pp) { // find all affected nodes 58 if (p instanceof Node && p.isNew()) nodes.add((Node)p); 62 if (p instanceof Node && p.isNew()) 63 nodes.add((Node)p); 59 64 } 60 65 if (!nodes.isEmpty()) { 61 getCurrentDataSet().setSelected(nodes); 62 } 66 getLayerManager().getEditDataSet().setSelected(nodes); 63 67 } 68 } 64 69 } 65 70 } … … 67 72 @Override 68 73 protected void updateEnabledState() { 69 if (getCurrentDataSet() == null) { 70 setEnabled(false); 71 } else { 72 updateEnabledState(getCurrentDataSet().getSelected()); 73 } 74 updateEnabledStateOnCurrentSelection(); 74 75 } 75 76 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AlignWayNodesAction.java
r30737 r32333 22 22 private static final double MOVE_THRESHOLD = 1e-9; 23 23 24 /** 25 * Constructs a new {@code AlignWayNodesAction}. 26 */ 24 27 public AlignWayNodesAction() { 25 28 super(TITLE, "dumbutils/alignwaynodes", tr("Align nodes in a way"), … … 29 32 30 33 public void actionPerformed( ActionEvent e ) { 31 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();34 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 32 35 Set<Node> selectedNodes = filterNodes(selection); 33 36 int selectedNodesCount = selectedNodes.size(); … … 116 119 @Override 117 120 protected void updateEnabledState() { 118 if( getCurrentDataSet() == null ) { 119 setEnabled(false); 120 } else 121 updateEnabledState(getCurrentDataSet().getSelected()); 121 updateEnabledStateOnCurrentSelection(); 122 122 } 123 123 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java
r32099 r32333 45 45 public void actionPerformed(ActionEvent e) { 46 46 if (isEmptySelection()) return; 47 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();48 copy(get EditLayer(), selection);47 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 48 copy(getLayerManager().getEditLayer(), selection); 49 49 } 50 50 … … 67 67 @Override 68 68 protected void updateEnabledState() { 69 if (getCurrentDataSet() == null) { 70 setEnabled(false); 71 } else { 72 updateEnabledState(getCurrentDataSet().getSelected()); 73 } 69 updateEnabledStateOnCurrentSelection(); 74 70 } 75 71 … … 79 75 } 80 76 81 private staticboolean isEmptySelection() {82 Collection<OsmPrimitive> sel = get CurrentDataSet().getSelected();77 private boolean isEmptySelection() { 78 Collection<OsmPrimitive> sel = getLayerManager().getEditDataSet().getSelected(); 83 79 if (sel.isEmpty()) { 84 80 JOptionPane.showMessageDialog( -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java
r30737 r32333 25 25 26 26 /** 27 * Unselects all nodes27 * Extracts node from its ways. 28 28 */ 29 29 public class ExtractPointAction extends JosmAction { 30 30 31 31 /** 32 * Constructs a new {@code ExtractPointAction}. 33 */ 32 34 public ExtractPointAction() { 33 35 super(tr("Extract node"), "extnode", … … 40 42 @Override 41 43 public void actionPerformed(ActionEvent e) { 42 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();44 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 43 45 List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class); 44 46 if (selectedNodes.size()!=1) { … … 50 52 Node ndCopy = new Node(nd.getCoor()); 51 53 List<Command> cmds = new LinkedList<>(); 52 54 53 55 Point p = Main.map.mapView.getMousePosition(); 54 if (p!=null) cmds.add(new MoveCommand(nd,Main.map.mapView.getLatLon(p.x, p.y))); 56 if (p != null) 57 cmds.add(new MoveCommand(nd,Main.map.mapView.getLatLon(p.x, p.y))); 55 58 List<OsmPrimitive> refs = nd.getReferrers(); 56 59 cmds.add(new AddCommand(ndCopy)); … … 70 73 @Override 71 74 protected void updateEnabledState() { 72 if (getCurrentDataSet() == null) { 73 setEnabled(false); 74 } else { 75 updateEnabledState(getCurrentDataSet().getSelected()); 76 } 75 updateEnabledStateOnCurrentSelection(); 77 76 } 78 77 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
r31040 r32333 37 37 @Override 38 38 public void actionPerformed( ActionEvent e ) { 39 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();39 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 40 40 if( selection.isEmpty() ) 41 41 return; … … 43 43 Map<Relation, String> relations = new HashMap<>(); 44 44 for( PrimitiveData pdata : Main.pasteBuffer.getDirectlyAdded() ) { 45 OsmPrimitive p = get CurrentDataSet().getPrimitiveById(pdata.getUniqueId(), pdata.getType());45 OsmPrimitive p = getLayerManager().getEditDataSet().getPrimitiveById(pdata.getUniqueId(), pdata.getType()); 46 46 if (p != null) { 47 47 for( Relation r : OsmPrimitive.getFilteredList(p.getReferrers(), Relation.class)) { … … 91 91 @Override 92 92 protected void updateEnabledState() { 93 if( getCurrentDataSet() == null ) { 94 setEnabled(false); 95 } else 96 updateEnabledState(getCurrentDataSet().getSelected()); 93 updateEnabledStateOnCurrentSelection(); 97 94 } 98 95 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java
r30737 r32333 38 38 * immediately. 39 39 */ 40 41 40 public class SplitObjectAction extends JosmAction { 42 41 /** … … 59 58 @Override 60 59 public void actionPerformed(ActionEvent e) { 61 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();60 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 62 61 63 62 List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class); … … 68 67 return; 69 68 } 70 71 69 72 70 Way selectedWay = null; … … 190 188 191 189 List<List<Node>> wayChunks = SplitWayAction.buildSplitChunks(selectedWay, selectedNodes); 192 // List<List<Node>> wayChunks = buildSplitChunks(selectedWay, selectedNodes);193 190 if (wayChunks != null) { 194 191 // close the chunks … … 213 210 } 214 211 } 215 SplitWayAction.SplitWayResult result = SplitWayAction.splitWay( getEditLayer(), selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList());216 // SplitObjectResult result = splitObject(getEditLayer(),selectedWay, wayChunks);212 SplitWayAction.SplitWayResult result = SplitWayAction.splitWay( 213 getLayerManager().getEditLayer(), selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList()); 217 214 Main.main.undoRedo.add(result.getCommand()); 218 215 if (splitWay != null) 219 216 Main.main.undoRedo.add(new DeleteCommand(splitWay)); 220 get CurrentDataSet().setSelected(result.getNewSelection());217 getLayerManager().getEditDataSet().setSelected(result.getNewSelection()); 221 218 } 222 219 } … … 245 242 @Override 246 243 protected void updateEnabledState() { 247 if (getCurrentDataSet() == null) { 248 setEnabled(false); 249 } else { 250 updateEnabledState(getCurrentDataSet().getSelected()); 251 } 244 updateEnabledStateOnCurrentSelection(); 252 245 } 253 246 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java
r30737 r32333 34 34 public void actionPerformed( ActionEvent e ) { 35 35 List<Command> list = new ArrayList<>(); 36 List<Way> selectedWays = OsmPrimitive.getFilteredList(get CurrentDataSet().getSelected(), Way.class);36 List<Way> selectedWays = OsmPrimitive.getFilteredList(getLayerManager().getEditDataSet().getSelected(), Way.class); 37 37 Map<Way, List<Node>> splitWays = new HashMap<>(); 38 38 … … 79 79 List<OsmPrimitive> sel = new ArrayList<>(selectedWays.size()); 80 80 sel.addAll(selectedWays); 81 SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(get EditLayer(), splitWay, wayChunks, sel);81 SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(getLayerManager().getEditLayer(), splitWay, wayChunks, sel); 82 82 list.add(result.getCommand()); 83 83 } … … 86 86 if( !list.isEmpty() ) { 87 87 Main.main.undoRedo.add(list.size() == 1 ? list.get(0) : new SequenceCommand(TITLE, list)); 88 get CurrentDataSet().clearSelection();88 getLayerManager().getEditDataSet().clearSelection(); 89 89 } 90 90 } … … 92 92 @Override 93 93 protected void updateEnabledState() { 94 if( getCurrentDataSet() == null ) { 95 setEnabled(false); 96 } else 97 updateEnabledState(getCurrentDataSet().getSelected()); 94 updateEnabledStateOnCurrentSelection(); 98 95 } 99 96 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java
r30737 r32333 35 35 public final class SymmetryAction extends JosmAction { 36 36 37 /** 38 * Constructs a new {@code SymmetryAction}. 39 */ 37 40 public SymmetryAction() { 38 41 super(tr("Symmetry"), "symmetry", tr("Mirror selected nodes and ways."), … … 44 47 @Override 45 48 public void actionPerformed(ActionEvent e) { 46 Collection<OsmPrimitive> sel = get CurrentDataSet().getSelected();49 Collection<OsmPrimitive> sel = getLayerManager().getEditDataSet().getSelected(); 47 50 HashSet<Node> nodes = new HashSet<>(); 48 51 EastNorth p1=null,p2=null; … … 89 92 @Override 90 93 protected void updateEnabledState() { 91 if (getCurrentDataSet() == null) { 92 setEnabled(false); 93 } else { 94 updateEnabledState(getCurrentDataSet().getSelected()); 95 } 94 updateEnabledStateOnCurrentSelection(); 96 95 } 97 96 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java
r31653 r32333 30 30 private Set<OsmPrimitive> selectionBuf = new HashSet<>(); 31 31 32 /** 33 * Constructs a new {@code TagBufferAction}. 34 */ 32 35 public TagBufferAction() { 33 36 super(TITLE, "dumbutils/tagbuffer", tr("Pastes tags of previously selected object(s)"), … … 40 43 @Override 41 44 public void actionPerformed( ActionEvent e ) { 42 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();45 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 43 46 if( selection.isEmpty() ) 44 47 return; … … 64 67 @Override 65 68 protected void updateEnabledState() { 66 if( get CurrentDataSet() == null ) {69 if( getLayerManager().getEditDataSet() == null ) { 67 70 setEnabled(false); 68 71 if( selectionBuf != null ) 69 72 selectionBuf.clear(); 70 73 } else 71 updateEnabledState(get CurrentDataSet().getSelected());74 updateEnabledState(getLayerManager().getEditDataSet().getSelected()); 72 75 } 73 76 … … 94 97 tags.putAll(currentTags); 95 98 } 96 if( get CurrentDataSet() != null)99 if( getLayerManager().getEditDataSet() != null) 97 100 rememberSelectionTags(); 98 101 … … 102 105 private void rememberSelectionTags() { 103 106 // Fix #8350 - only care about tagged objects 104 final Collection<OsmPrimitive> selectedTaggedObjects = Utils.filter(get CurrentDataSet().getSelected(), IS_TAGGED_PREDICATE);107 final Collection<OsmPrimitive> selectedTaggedObjects = Utils.filter(getLayerManager().getEditDataSet().getSelected(), IS_TAGGED_PREDICATE); 105 108 if( !selectedTaggedObjects.isEmpty() ) { 106 109 currentTags.clear(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java
r31026 r32333 33 33 @Override 34 34 public void actionPerformed( ActionEvent e ) { 35 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();35 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 36 36 if( selection.isEmpty() || source == null || source.length() == 0 ) 37 37 return; … … 42 42 @Override 43 43 protected void updateEnabledState() { 44 if( get CurrentDataSet() == null ) {44 if( getLayerManager().getEditDataSet() == null ) { 45 45 setEnabled(false); 46 46 if( selectionBuf != null ) 47 47 selectionBuf.clear(); 48 48 } else 49 updateEnabledState(get CurrentDataSet().getSelected());49 updateEnabledState(getLayerManager().getEditDataSet().getSelected()); 50 50 } 51 51 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java
r30737 r32333 51 51 LinkedList<Command> cmds = new LinkedList<>(); 52 52 List<OsmPrimitive> newPrimitives = new LinkedList<>(); 53 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();53 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 54 54 55 55 for (OsmPrimitive p : selection) { … … 83 83 //Set selection all primiteves (new and old) 84 84 newPrimitives.addAll(selection); 85 get CurrentDataSet().setSelected(newPrimitives);85 getLayerManager().getEditDataSet().setSelected(newPrimitives); 86 86 Main.map.mapView.repaint(); 87 87 } … … 90 90 @Override 91 91 protected void updateEnabledState() { 92 if (getCurrentDataSet() == null) { 93 setEnabled(false); 94 } else { 95 updateEnabledState(getCurrentDataSet().getSelected()); 96 } 92 updateEnabledStateOnCurrentSelection(); 97 93 } 98 94 … … 101 97 setEnabled(selection != null && !selection.isEmpty()); 102 98 } 103 104 99 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java
r30737 r32333 53 53 updatePreferences(); 54 54 55 List<Node> selectedNodes = new ArrayList<>(get CurrentDataSet().getSelectedNodes());56 List<Way> selectedWays = new ArrayList<>(get CurrentDataSet().getSelectedWays());55 List<Node> selectedNodes = new ArrayList<>(getLayerManager().getEditDataSet().getSelectedNodes()); 56 List<Way> selectedWays = new ArrayList<>(getLayerManager().getEditDataSet().getSelectedWays()); 57 57 58 // Collection<Command> cmds = doSpline(selectedNodes, selectedWays);59 58 Collection<Command> cmds = CircleArcMaker.doCircleArc(selectedNodes, selectedWays, angleSeparation); 60 59 if (cmds != null) … … 64 63 @Override 65 64 protected void updateEnabledState() { 66 if (getCurrentDataSet() == null) { 67 setEnabled(false); 68 } else { 69 updateEnabledState(getCurrentDataSet().getSelected()); 70 } 65 updateEnabledStateOnCurrentSelection(); 71 66 } 72 67 … … 75 70 setEnabled(selection != null && !selection.isEmpty()); 76 71 } 77 78 public static void main(String[] args) {79 }80 81 72 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java
r30532 r32333 21 21 22 22 public ChooseURLAction() { 23 23 super(tr("Select custom URL"), "selecturl", tr("Select custom URL"),null,true,true); 24 24 } 25 25 26 26 @Override 27 27 public void actionPerformed(ActionEvent e) { 28 showConfigDialog(false);28 showConfigDialog(false); 29 29 } 30 30 31 31 @Override 32 32 protected void updateEnabledState() { 33 if (getCurrentDataSet() == null) { 34 setEnabled(false); 35 } else { 36 setEnabled(true); 37 } 33 setEnabled(getLayerManager().getEditDataSet() != null); 38 34 } 39 35 40 36 public static void showConfigDialog(final boolean fast) { 41 JPanel all = new JPanel(); 42 GridBagLayout layout = new GridBagLayout(); 43 all.setLayout(layout); 37 JPanel all = new JPanel(new GridBagLayout()); 44 38 45 39 List<String> items = URLList.getURLList(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java
r31652 r32333 43 43 @Override 44 44 public void actionPerformed(ActionEvent e) { 45 Collection<OsmPrimitive> sel = get CurrentDataSet().getSelected();45 Collection<OsmPrimitive> sel = getLayerManager().getEditDataSet().getSelected(); 46 46 OsmPrimitive p=null; 47 47 if (sel.size()>=1) { … … 88 88 } 89 89 } catch (UnsupportedEncodingException ex) { 90 System.err.println("Encoding error");90 Main.error(ex, "Encoding error"); 91 91 return; 92 92 } … … 97 97 OpenBrowser.displayUrl(addr); 98 98 } catch (Exception ex) { 99 System.err.println("Can not open URL"+addr);99 Main.error(ex, "Can not open URL " + addr); 100 100 } 101 101 //Collection<Command> cmds = new LinkedList<Command>(); 102 102 103 //cmds.add(new MoveCommand(n, -2*ne*pr, -2*nn*pr ));103 //cmds.add(new MoveCommand(n, -2*ne*pr, -2*nn*pr )); 104 104 //Main.main.undoRedo.add(new SequenceCommand(tr("Symmetry"), cmds)); 105 105 } … … 107 107 @Override 108 108 protected void updateEnabledState() { 109 if (getCurrentDataSet() == null) { 110 setEnabled(false); 111 } else { 112 setEnabled(true); 113 } 109 setEnabled(getLayerManager().getEditDataSet() != null); 114 110 } 115 116 117 111 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java
r30737 r32333 89 89 @Override 90 90 protected void updateEnabledState() { 91 setEnabled(get EditLayer() != null);91 setEnabled(getLayerManager().getEditLayer() != null); 92 92 } 93 93 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagAction.java
r30993 r32333 16 16 MultiTagDialog dlg; 17 17 18 /** 19 * Constructs a new {@code MultiTagAction}. 20 */ 18 21 public MultiTagAction() { 19 22 super(tr("Tag multiple objects [alpha]"), (String)null, tr("Edit tags of object list in table"), … … 28 31 return; 29 32 dlg = new MultiTagDialog(); 30 dlg.selectionChanged(get CurrentDataSet().getSelected());33 dlg.selectionChanged(getLayerManager().getEditDataSet().getSelected()); 31 34 dlg.showDialog(); 32 35 } 33 36 34 35 37 @Override 36 38 protected void updateEnabledState() { 37 setEnabled(get EditLayer()!=null);39 setEnabled(getLayerManager().getEditLayer()!=null); 38 40 } 39 41 40 42 @Override 41 43 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 42 setEnabled(get EditLayer()!=null);44 setEnabled(getLayerManager().getEditLayer()!=null); 43 45 if (dlg!=null && dlg.isVisible()) { 44 46 dlg.selectionChanged(selection); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
r31890 r32333 136 136 public void actionPerformed(ActionEvent e) { 137 137 if (jt.isSelected()) tableModel.shownTypes.add(type); else tableModel.shownTypes.remove(type); 138 tableModel.updateData(Main. main.getCurrentDataSet().getSelected());139 } ;138 tableModel.updateData(Main.getLayerManager().getEditDataSet().getSelected()); 139 } 140 140 }); 141 141 ImageProvider.get(type); … … 208 208 209 209 private void initAutocompletion() { 210 OsmDataLayer l = Main. main.getEditLayer();210 OsmDataLayer l = Main.getLayerManager().getEditLayer(); 211 211 AutoCompletionManager autocomplete = l.data.getAutoCompletionManager(); 212 212 for (int i=0; i<tableModel.mainTags.length; i++) { … … 233 233 @Override 234 234 public void actionPerformed(ActionEvent e) { 235 Main. main.getCurrentDataSet().setSelected(getSelectedPrimitives());235 Main.getLayerManager().getEditDataSet().setSelected(getSelectedPrimitives()); 236 236 } 237 237 }); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java
r30737 r32333 54 54 public void setWatchSelection(boolean watchSelection) { 55 55 this.watchSelection = watchSelection; 56 if (watchSelection && Main.main.hasEditLayer()) selectionChanged(Main.main.getCurrentDataSet().getSelected()); 57 } 58 56 if (watchSelection && Main.getLayerManager().getEditLayer() != null) 57 selectionChanged(Main.getLayerManager().getEditDataSet().getSelected()); 58 } 59 59 60 @Override 60 61 public Object getValueAt(int rowIndex, int columnIndex) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryAction.java
r30737 r32333 30 30 @Override 31 31 public void actionPerformed(ActionEvent e) { 32 if (get CurrentDataSet() == null) {32 if (getLayerManager().getEditDataSet() == null) { 33 33 return; 34 34 } 35 35 36 36 // There must be two ways selected: one with id > 0 and one new. 37 List<OsmPrimitive> selection = new ArrayList<>(get CurrentDataSet().getSelected());37 List<OsmPrimitive> selection = new ArrayList<>(getLayerManager().getEditDataSet().getSelected()); 38 38 if (selection.size() != 2) { 39 39 new Notification( … … 68 68 @Override 69 69 protected void updateEnabledState() { 70 if( getCurrentDataSet() == null ) { 71 setEnabled(false); 72 } else 73 updateEnabledState(getCurrentDataSet().getSelected()); 70 updateEnabledStateOnCurrentSelection(); 74 71 } 75 72 … … 79 76 } 80 77 } 81 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java
r31655 r32333 117 117 // FIXME: handle different layers 118 118 List<Command> commands = new ArrayList<>(); 119 Command c = MergeNodesAction.mergeNodes(Main. main.getEditLayer(), Arrays.asList(subjectNode, referenceNode), referenceNode);119 Command c = MergeNodesAction.mergeNodes(Main.getLayerManager().getEditLayer(), Arrays.asList(subjectNode, referenceNode), referenceNode); 120 120 if (c == null) { 121 121 // User canceled … … 204 204 } 205 205 206 Main. main.getCurrentDataSet().setSelected(referenceObject);206 Main.getLayerManager().getEditDataSet().setSelected(referenceObject); 207 207 208 208 return new ReplaceGeometryCommand( … … 243 243 public static ReplaceGeometryCommand buildReplaceWayCommand(Way subjectWay, Way referenceWay) { 244 244 245 Area a = Main. main.getCurrentDataSet().getDataSourceArea();245 Area a = Main.getLayerManager().getEditDataSet().getDataSourceArea(); 246 246 if (!isInArea(subjectWay, a) || !isInArea(referenceWay, a)) { 247 247 throw new ReplaceGeometryException(tr("The ways must be entirely within the downloaded area.")); … … 260 260 } catch (UserCancelException e) { 261 261 // user canceled tag merge dialog 262 Main.trace(e); 262 263 return null; 263 264 } … … 358 359 359 360 // Remove geometry way from selection 360 Main. main.getCurrentDataSet().clearSelection(referenceWay);361 Main.getLayerManager().getEditDataSet().clearSelection(referenceWay); 361 362 362 363 // And delete old geometry way -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceMembershipAction.java
r32099 r32333 37 37 @Override 38 38 public void actionPerformed(ActionEvent e) { 39 final Iterator<OsmPrimitive> selection = get CurrentDataSet().getSelected().iterator();39 final Iterator<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected().iterator(); 40 40 final OsmPrimitive firstObject = selection.next(); 41 41 final OsmPrimitive secondObject = selection.next(); … … 56 56 )).setIcon(JOptionPane.WARNING_MESSAGE).show(); 57 57 } 58 59 58 } 60 59 … … 80 79 @Override 81 80 protected void updateEnabledState() { 82 updateEnabledState (getCurrentDataSet() == null ? null : getCurrentDataSet().getSelected());81 updateEnabledStateOnCurrentSelection(); 83 82 } 84 83 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java
r30737 r32333 32 32 Set<Node> matchedNodes = new HashSet<>(); 33 33 // find all ways that match the expression 34 Collection<Way> allWays = Main. main.getCurrentDataSet().getWays();34 Collection<Way> allWays = Main.getLayerManager().getEditDataSet().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 = Main. main.getCurrentDataSet().getNodes();41 Collection<Node> allNodes = Main.getLayerManager().getEditDataSet().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
r30737 r32333 32 32 Collection<OsmPrimitive> matchedAreas = new HashSet<>(); 33 33 // find all ways that match the expression 34 Collection<Way> ways = Main. main.getCurrentDataSet().getWays();34 Collection<Way> ways = Main.getLayerManager().getEditDataSet().getWays(); 35 35 for (Way way : ways) { 36 36 if (match.match(way)) { … … 39 39 } 40 40 // find all relations that match the expression 41 Collection<Relation> rels = Main. main.getCurrentDataSet().getRelations();41 Collection<Relation> rels = Main.getLayerManager().getEditDataSet().getRelations(); 42 42 for (Relation rel : rels) { 43 43 if (match.match(rel)) { … … 45 45 } 46 46 } 47 inside = NodeWayUtils.selectAllInside(matchedAreas, Main. main.getCurrentDataSet(), false);47 inside = NodeWayUtils.selectAllInside(matchedAreas, Main.getLayerManager().getEditDataSet(), false); 48 48 } 49 49 … … 55 55 return inside.contains(osm); 56 56 } 57 58 57 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java
r30737 r32333 30 30 Collection<Way> matchedWays = new HashSet<>(); 31 31 // find all ways that match the expression 32 Collection<Way> allWays = Main. main.getCurrentDataSet().getWays();32 Collection<Way> allWays = Main.getLayerManager().getEditDataSet().getWays(); 33 33 for (Way way : allWays) { 34 34 if (match.match(way)) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentNodesAction.java
r30737 r32333 33 33 @Override 34 34 public void actionPerformed(ActionEvent e) { 35 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 35 DataSet ds = getLayerManager().getEditDataSet(); 36 Collection<OsmPrimitive> selection = ds.getSelected(); 36 37 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 37 38 38 Set<Way> selectedWays = OsmPrimitive.getFilteredSet( getCurrentDataSet().getSelected(), Way.class);39 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(ds.getSelected(), Way.class); 39 40 40 41 // if no nodes and no ways are selected, do nothing … … 61 62 NodeWayUtils.addNodesConnectedToWays(selectedWays, newNodes); 62 63 activeWays.clear(); 63 getCurrentDataSet().setSelected(newNodes);64 ds.setSelected(newNodes); 64 65 return; 65 66 } 66 67 67 68 if (activeWays.isEmpty()) { 68 69 NodeWayUtils.addWaysConnectedToNodes(selectedNodes, activeWays); 69 70 } 70 71 … … 88 89 } 89 90 90 getCurrentDataSet().addSelected(newNodes); 91 newNodes = null; 92 91 ds.addSelected(newNodes); 93 92 } 94 93 95 94 @Override 96 95 protected void updateEnabledState() { 97 if (getCurrentDataSet() == null) { 98 setEnabled(false); 99 } else { 100 updateEnabledState(getCurrentDataSet().getSelected()); 101 } 96 updateEnabledStateOnCurrentSelection(); 102 97 } 103 98 … … 110 105 setEnabled(!selection.isEmpty()); 111 106 } 112 113 114 115 107 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentWaysAction.java
r30737 r32333 32 32 @Override 33 33 public void actionPerformed(ActionEvent e) { 34 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 34 DataSet ds = getLayerManager().getEditDataSet(); 35 Collection<OsmPrimitive> selection = ds.getSelected(); 35 36 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 36 37 37 Set<Way> selectedWays = OsmPrimitive.getFilteredSet( getCurrentDataSet().getSelected(), Way.class);38 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(ds.getSelected(), Way.class); 38 39 39 40 // select ways attached to already selected ways … … 48 49 49 50 // System.out.printf("%d ways added to selection\n",newWays.size()-selectedWays.size()); 50 getCurrentDataSet().setSelected(newWays);51 ds.setSelected(newWays); 51 52 } 52 53 53 54 @Override 54 55 protected void updateEnabledState() { 55 if (getCurrentDataSet() == null) { 56 setEnabled(false); 57 } else { 58 updateEnabledState(getCurrentDataSet().getSelected()); 59 } 56 updateEnabledStateOnCurrentSelection(); 60 57 } 61 58 … … 68 65 setEnabled(!selection.isEmpty()); 69 66 } 70 71 72 73 67 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/ConnectedWaysAction.java
r30737 r32333 29 29 @Override 30 30 public void actionPerformed(ActionEvent e) { 31 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 31 DataSet ds = getLayerManager().getEditDataSet(); 32 Collection<OsmPrimitive> selection = ds.getSelected(); 32 33 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 33 Set<Way> selectedWays = OsmPrimitive.getFilteredSet( getCurrentDataSet().getSelected(), Way.class);34 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(ds.getSelected(), Way.class); 34 35 35 36 Set<Way> newWays = new HashSet<>(); … … 45 46 46 47 // System.out.printf("%d ways added to selection\n",newWays.size()-selectedWays.size()); 47 getCurrentDataSet().setSelected(newWays); 48 48 ds.setSelected(newWays); 49 49 } 50 50 51 51 @Override 52 52 protected void updateEnabledState() { 53 if (getCurrentDataSet() == null) { 54 setEnabled(false); 55 } else { 56 updateEnabledState(getCurrentDataSet().getSelected()); 57 } 53 updateEnabledStateOnCurrentSelection(); 58 54 } 59 55 … … 66 62 setEnabled(!selection.isEmpty()); 67 63 } 68 69 70 64 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysAction.java
r30737 r32333 14 14 15 15 import org.openstreetmap.josm.actions.JosmAction; 16 import org.openstreetmap.josm.data.osm.DataSet; 16 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 18 import org.openstreetmap.josm.data.osm.Way; … … 33 34 @Override 34 35 public void actionPerformed(ActionEvent e) { 35 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class); 36 DataSet ds = getLayerManager().getEditDataSet(); 37 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(ds.getSelected(), Way.class); 36 38 37 39 // select ways attached to already selected ways … … 39 41 Set<Way> newWays = new HashSet<>(); 40 42 NodeWayUtils.addWaysIntersectingWays( 41 getCurrentDataSet().getWays(),43 ds.getWays(), 42 44 selectedWays, newWays); 43 getCurrentDataSet().addSelected(newWays);45 ds.addSelected(newWays); 44 46 return; 45 47 } else { … … 48 50 ).setIcon(JOptionPane.WARNING_MESSAGE).show(); 49 51 } 50 51 52 } 52 53 53 54 @Override 54 55 protected void updateEnabledState() { 55 if (getCurrentDataSet() == null) { 56 setEnabled(false); 57 } else { 58 updateEnabledState(getCurrentDataSet().getSelected()); 59 } 56 updateEnabledStateOnCurrentSelection(); 60 57 } 61 58 … … 68 65 setEnabled(!selection.isEmpty()); 69 66 } 70 71 72 67 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysRecursiveAction.java
r30737 r32333 14 14 15 15 import org.openstreetmap.josm.actions.JosmAction; 16 import org.openstreetmap.josm.data.osm.DataSet; 16 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 18 import org.openstreetmap.josm.data.osm.Way; … … 34 35 @Override 35 36 public void actionPerformed(ActionEvent e) { 36 37 Set<Way> selectedWays = OsmPrimitive.getFilteredSet( getCurrentDataSet().getSelected(), Way.class);37 DataSet ds = getLayerManager().getEditDataSet(); 38 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(ds.getSelected(), Way.class); 38 39 39 40 if (!selectedWays.isEmpty()) { 40 41 Set<Way> newWays = new HashSet<>(); 41 42 NodeWayUtils.addWaysIntersectingWaysRecursively( 42 getCurrentDataSet().getWays(),43 ds.getWays(), 43 44 selectedWays, newWays); 44 getCurrentDataSet().addSelected(newWays);45 ds.addSelected(newWays); 45 46 } else { 46 47 new Notification( … … 48 49 ).setIcon(JOptionPane.WARNING_MESSAGE).show(); 49 50 } 50 51 51 } 52 53 52 54 53 @Override 55 54 protected void updateEnabledState() { 56 if (getCurrentDataSet() == null) { 57 setEnabled(false); 58 } else { 59 updateEnabledState(getCurrentDataSet().getSelected()); 60 } 55 updateEnabledStateOnCurrentSelection(); 61 56 } 62 57 … … 69 64 setEnabled(!selection.isEmpty()); 70 65 } 71 72 73 66 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/MiddleNodesAction.java
r30737 r32333 35 35 @Override 36 36 public void actionPerformed(ActionEvent e) { 37 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();37 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 38 38 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 39 39 … … 51 51 // select only newly found nodes 52 52 newNodes.removeAll(selectedNodes); 53 getCurrentDataSet().addSelected(newNodes); 54 newNodes = null; 55 53 getLayerManager().getEditDataSet().addSelected(newNodes); 56 54 } 57 55 58 56 @Override 59 57 protected void updateEnabledState() { 60 if (getCurrentDataSet() == null) { 61 setEnabled(false); 62 } else { 63 updateEnabledState(getCurrentDataSet().getSelected()); 64 } 58 updateEnabledStateOnCurrentSelection(); 65 59 } 66 60 … … 73 67 setEnabled(!selection.isEmpty()); 74 68 } 75 76 77 78 69 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectAllInsideAction.java
r30701 r32333 12 12 13 13 import org.openstreetmap.josm.actions.JosmAction; 14 import org.openstreetmap.josm.data.osm.DataSet; 14 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 16 import org.openstreetmap.josm.gui.Notification; … … 30 31 @Override 31 32 public void actionPerformed(ActionEvent e) { 32 Collection<OsmPrimitive> insideSelected = NodeWayUtils.selectAllInside(getCurrentDataSet().getSelected(), getCurrentDataSet(), true); 33 DataSet ds = getLayerManager().getEditDataSet(); 34 Collection<OsmPrimitive> insideSelected = NodeWayUtils.selectAllInside(ds.getSelected(), ds, true); 33 35 34 36 if (!insideSelected.isEmpty()) { 35 getCurrentDataSet().addSelected(insideSelected);37 ds.addSelected(insideSelected); 36 38 } else{ 37 39 new Notification( … … 44 46 @Override 45 47 protected void updateEnabledState() { 46 if (getCurrentDataSet() == null) { 47 setEnabled(false); 48 } else { 49 updateEnabledState(getCurrentDataSet().getSelected()); 50 } 48 updateEnabledStateOnCurrentSelection(); 51 49 } 52 50 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectBoundaryAction.java
r30459 r32333 40 40 @Override 41 41 public void actionPerformed(ActionEvent e) { 42 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(get CurrentDataSet().getSelected(), Way.class);43 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(get CurrentDataSet().getSelected(), Node.class);42 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getLayerManager().getEditDataSet().getSelected(), Way.class); 43 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(getLayerManager().getEditDataSet().getSelected(), Node.class); 44 44 45 45 Set<Way> newWays = new HashSet<>(); … … 76 76 newWays.add(w); 77 77 lastUsedStartingWay = w; 78 79 78 80 79 // try going left at each turn … … 84 83 85 84 if (!newWays.isEmpty() ) { 86 get CurrentDataSet().setSelected(newWays);85 getLayerManager().getEditDataSet().setSelected(newWays); 87 86 } else{ 88 new Notification( 89 tr("Nothing found. Please select way that is a part of some polygon formed by connected ways") 90 ).setIcon(JOptionPane.WARNING_MESSAGE).show(); 91 } 87 new Notification(tr("Nothing found. Please select way that is a part of some polygon formed by connected ways")) 88 .setIcon(JOptionPane.WARNING_MESSAGE).show(); 89 } 92 90 } 93 91 94 92 @Override 95 93 protected void updateEnabledState() { 96 if (getCurrentDataSet() == null) { 97 setEnabled(false); 98 } else { 99 setEnabled(true); 100 // updateEnabledState(getCurrentDataSet().getSelected()); 101 } 94 setEnabled(getLayerManager().getEditDataSet() != null); 102 95 } 103 96 … … 105 98 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 106 99 if (selection == null) { 107 // setEnabled(false);108 100 return; 109 101 } 110 102 setEnabled(true); 111 //setEnabled(!selection.isEmpty());112 103 } 113 104 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectHighwayAction.java
r30737 r32333 18 18 19 19 import org.openstreetmap.josm.actions.JosmAction; 20 import org.openstreetmap.josm.data.osm.DataSet; 20 21 import org.openstreetmap.josm.data.osm.Node; 21 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 40 41 @Override 41 42 public void actionPerformed(ActionEvent e) { 42 List<Way> selectedWays = OsmPrimitive.getFilteredList(getCurrentDataSet().getSelected(), Way.class); 43 DataSet ds = getLayerManager().getEditDataSet(); 44 List<Way> selectedWays = OsmPrimitive.getFilteredList(ds.getSelected(), Way.class); 43 45 44 46 if( selectedWays.size() == 1 ) { 45 getCurrentDataSet().setSelected(selectNamedRoad(selectedWays.get(0)));47 ds.setSelected(selectNamedRoad(selectedWays.get(0))); 46 48 } else if( selectedWays.size() == 2 ) { 47 getCurrentDataSet().setSelected(selectHighwayBetween(selectedWays.get(0), selectedWays.get(1)));49 ds.setSelected(selectHighwayBetween(selectedWays.get(0), selectedWays.get(1))); 48 50 } else { 49 51 new Notification( … … 112 114 @Override 113 115 protected void updateEnabledState() { 114 if (getCurrentDataSet() == null) 115 setEnabled(false); 116 else 117 updateEnabledState(getCurrentDataSet().getSelected()); 116 updateEnabledStateOnCurrentSelection(); 118 117 } 119 118 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java
r30737 r32333 34 34 @Override 35 35 public void actionPerformed(ActionEvent e) { 36 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 36 DataSet ds = getLayerManager().getEditDataSet(); 37 Collection<OsmPrimitive> selection = ds.getSelected(); 37 38 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 38 getCurrentDataSet().clearSelection(selectedNodes);39 ds.clearSelection(selectedNodes); 39 40 Command cmd =null; 40 41 … … 62 63 } 63 64 if (!nodes.isEmpty()) { 64 getCurrentDataSet().setSelected(nodes);65 ds.setSelected(nodes); 65 66 lastCmd = cmd; // remember last used command and last selection 66 lastHash = getCurrentDataSet().getSelected().hashCode();67 lastHash = ds.getSelected().hashCode(); 67 68 return; 68 69 } … … 75 76 @Override 76 77 protected void updateEnabledState() { 77 if (getCurrentDataSet() == null) { 78 setEnabled(false); 79 } else { 80 updateEnabledState(getCurrentDataSet().getSelected()); 81 } 78 updateEnabledStateOnCurrentSelection(); 82 79 } 83 80 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java
r30737 r32333 10 10 import org.openstreetmap.josm.actions.JosmAction; 11 11 import org.openstreetmap.josm.command.Command; 12 import org.openstreetmap.josm.data.osm.DataSet; 12 13 import org.openstreetmap.josm.data.osm.Node; 13 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 34 35 @Override 35 36 public void actionPerformed(ActionEvent e) { 36 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 37 DataSet ds = getLayerManager().getEditDataSet(); 38 Collection<OsmPrimitive> selection = ds.getSelected(); 37 39 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 38 getCurrentDataSet().clearSelection(selectedNodes);39 Command cmd =null;40 ds.clearSelection(selectedNodes); 41 Command cmd; 40 42 41 43 if (Main.main.undoRedo.commands == null) return; … … 61 63 if (p instanceof Way && !p.isDeleted()) ways.add((Way)p); 62 64 } 63 if (!ways.isEmpty() && ! getCurrentDataSet().getSelected().containsAll(ways)) {64 getCurrentDataSet().setSelected(ways);65 if (!ways.isEmpty() && !ds.getSelected().containsAll(ways)) { 66 ds.setSelected(ways); 65 67 lastCmd = cmd; // remember last used command and last selection 66 lastHash = getCurrentDataSet().getSelected().hashCode();68 lastHash = ds.getSelected().hashCode(); 67 69 return; 68 70 } … … 74 76 @Override 75 77 protected void updateEnabledState() { 76 if (getCurrentDataSet() == null) { 77 setEnabled(false); 78 } else { 79 updateEnabledState(getCurrentDataSet().getSelected()); 80 } 78 updateEnabledStateOnCurrentSelection(); 81 79 } 82 80 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectWayNodesAction.java
r30737 r32333 41 41 @Override 42 42 public void actionPerformed(ActionEvent e) { 43 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();43 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 44 44 45 45 for (OsmPrimitive p : selection) { … … 60 60 } 61 61 62 get CurrentDataSet().setSelected(selectedNodes);62 getLayerManager().getEditDataSet().setSelected(selectedNodes); 63 63 selectedNodes = null; 64 64 } … … 76 76 @Override 77 77 protected void updateEnabledState() { 78 if (getCurrentDataSet() == null) { 79 setEnabled(false); 80 } else { 81 updateEnabledState(getCurrentDataSet().getSelected()); 82 } 78 updateEnabledStateOnCurrentSelection(); 83 79 } 84 80 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UndoSelectionAction.java
r30737 r32333 34 34 @Override 35 35 public void actionPerformed(ActionEvent e) { 36 LinkedList<Collection<? extends OsmPrimitive>> history37 = getCurrentDataSet().getSelectionHistory();36 DataSet ds = getLayerManager().getEditDataSet(); 37 LinkedList<Collection<? extends OsmPrimitive>> history = ds.getSelectionHistory(); 38 38 if (history==null || history.isEmpty()) return; // empty history 39 39 int num=history.size(); 40 40 41 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 42 41 Collection<OsmPrimitive> selection = ds.getSelected(); 43 42 44 43 if (selection!= null && selection.hashCode() != myAutomaticSelectionHash) { … … 55 54 newsel.clear(); 56 55 newsel.addAll(histsel); 57 newsel.retainAll( getCurrentDataSet().allNonDeletedPrimitives());56 newsel.retainAll(ds.allNonDeletedPrimitives()); 58 57 if (newsel.size() > 0 ) break; 59 58 k++; 60 59 } while ( k < num ); 61 60 62 getCurrentDataSet().setSelected(newsel);63 lastSel = getCurrentDataSet().getSelected();61 ds.setSelected(newsel); 62 lastSel = ds.getSelected(); 64 63 myAutomaticSelectionHash = lastSel.hashCode(); 65 64 // remeber last automatic selection … … 68 67 @Override 69 68 protected void updateEnabledState() { 70 if (getCurrentDataSet() == null) { 71 setEnabled(false); 72 } else { 73 updateEnabledState(getCurrentDataSet().getSelected()); 74 } 69 updateEnabledStateOnCurrentSelection(); 75 70 } 76 71 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UnselectNodesAction.java
r29769 r32333 15 15 16 16 /** 17 * 17 * Unselects all nodes 18 18 */ 19 19 public class UnselectNodesAction extends JosmAction { 20 20 21 21 /** 22 * Constructs a new {@code UnselectNodesAction}. 23 */ 22 24 public UnselectNodesAction() { 23 25 super(tr("Unselect nodes"), "unsnodes", … … 30 32 @Override 31 33 public void actionPerformed(ActionEvent e) { 32 Collection<OsmPrimitive> selection = get CurrentDataSet().getSelected();34 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 33 35 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 34 get CurrentDataSet().clearSelection(selectedNodes);36 getLayerManager().getEditDataSet().clearSelection(selectedNodes); 35 37 } 36 38 37 39 @Override 38 40 protected void updateEnabledState() { 39 if (getCurrentDataSet() == null) { 40 setEnabled(false); 41 } else { 42 updateEnabledState(getCurrentDataSet().getSelected()); 43 } 41 updateEnabledStateOnCurrentSelection(); 44 42 } 45 43
Note:
See TracChangeset
for help on using the changeset viewer.