Changeset 10409 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2016-06-17T02:58:36+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r10382 r10409 13 13 14 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.data.osm.DataSet;16 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 26 25 public final class CopyAction extends JosmAction { 27 26 28 / / regular expression that matches text clipboard contents after copying27 /** regular expression that matches text clipboard contents after copying */ 29 28 public static final String CLIPBOARD_REGEXP = "((node|way|relation)\\s\\d+,)*(node|way|relation)\\s\\d+"; 30 29 … … 57 56 */ 58 57 public static void copy(OsmDataLayer source, Collection<OsmPrimitive> primitives) { 59 / * copy ids to the clipboard */58 // copy ids to the clipboard 60 59 String ids = getCopyString(primitives); 61 60 Utils.copyToClipboard(ids); … … 75 74 @Override 76 75 protected void updateEnabledState() { 77 DataSet ds = getLayerManager().getEditDataSet(); 78 if (ds == null) { 79 setEnabled(false); 80 } else { 81 updateEnabledState(ds.getSelected()); 82 } 76 updateEnabledStateOnCurrentSelection(); 83 77 } 84 78 -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r10382 r10409 25 25 import org.openstreetmap.josm.data.coor.EastNorth; 26 26 import org.openstreetmap.josm.data.coor.LatLon; 27 import org.openstreetmap.josm.data.osm.DataSet;28 27 import org.openstreetmap.josm.data.osm.Node; 29 28 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 290 289 @Override 291 290 protected void updateEnabledState() { 292 DataSet ds = getLayerManager().getEditDataSet(); 293 if (ds == null) { 294 setEnabled(false); 295 } else { 296 updateEnabledState(ds.getSelected()); 297 } 291 updateEnabledStateOnCurrentSelection(); 298 292 } 299 293 -
trunk/src/org/openstreetmap/josm/actions/DeleteAction.java
r10382 r10409 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.data.osm.DataSet;13 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 13 import org.openstreetmap.josm.tools.Shortcut; … … 38 37 @Override 39 38 protected void updateEnabledState() { 40 DataSet ds = getLayerManager().getEditDataSet(); 41 if (ds == null) { 42 setEnabled(false); 43 } else { 44 updateEnabledState(ds.getSelected()); 45 } 39 updateEnabledStateOnCurrentSelection(); 46 40 } 47 41 -
trunk/src/org/openstreetmap/josm/actions/DistributeAction.java
r10382 r10409 20 20 import org.openstreetmap.josm.command.MoveCommand; 21 21 import org.openstreetmap.josm.command.SequenceCommand; 22 import org.openstreetmap.josm.data.osm.DataSet;23 22 import org.openstreetmap.josm.data.osm.Node; 24 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 301 300 @Override 302 301 protected void updateEnabledState() { 303 DataSet ds = getLayerManager().getEditDataSet(); 304 if (ds == null) { 305 setEnabled(false); 306 } else { 307 updateEnabledState(ds.getSelected()); 308 } 302 updateEnabledStateOnCurrentSelection(); 309 303 } 310 304 -
trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
r10382 r10409 11 11 import org.openstreetmap.josm.Main; 12 12 import org.openstreetmap.josm.actions.downloadtasks.DownloadReferrersTask; 13 import org.openstreetmap.josm.data.osm.DataSet;14 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 14 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 62 61 @Override 63 62 protected void updateEnabledState() { 64 DataSet ds = getLayerManager().getEditDataSet(); 65 if (ds == null) { 66 setEnabled(false); 67 } else { 68 updateEnabledState(ds.getSelected()); 69 } 63 updateEnabledStateOnCurrentSelection(); 70 64 } 71 65 -
trunk/src/org/openstreetmap/josm/actions/DuplicateAction.java
r10382 r10409 11 11 12 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.data.osm.DataSet;14 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 14 import org.openstreetmap.josm.data.osm.PrimitiveDeepCopy; … … 36 35 @Override 37 36 protected void updateEnabledState() { 38 DataSet ds = getLayerManager().getEditDataSet(); 39 if (ds == null) { 40 setEnabled(false); 41 } else { 42 updateEnabledState(ds.getSelected()); 43 } 37 updateEnabledStateOnCurrentSelection(); 44 38 } 45 39 -
trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java
r10382 r10409 16 16 import org.openstreetmap.josm.command.SelectCommand; 17 17 import org.openstreetmap.josm.command.SequenceCommand; 18 import org.openstreetmap.josm.data.osm.DataSet;19 18 import org.openstreetmap.josm.data.osm.Node; 20 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 36 35 public class FollowLineAction extends JosmAction { 37 36 37 /** 38 * Constructs a new {@code FollowLineAction}. 39 */ 38 40 public FollowLineAction() { 39 41 super( … … 48 50 @Override 49 51 protected void updateEnabledState() { 50 DataSet ds = getLayerManager().getEditDataSet(); 51 if (ds == null) { 52 setEnabled(false); 53 } else { 54 updateEnabledState(ds.getSelected()); 55 } 52 updateEnabledStateOnCurrentSelection(); 56 53 } 57 54 -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r10382 r10409 1548 1548 @Override 1549 1549 protected void updateEnabledState() { 1550 DataSet ds = getLayerManager().getEditDataSet(); 1551 if (ds == null) { 1552 setEnabled(false); 1553 } else { 1554 updateEnabledState(ds.getSelected()); 1555 } 1550 updateEnabledStateOnCurrentSelection(); 1556 1551 } 1557 1552 -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r10382 r10409 25 25 import org.openstreetmap.josm.command.SequenceCommand; 26 26 import org.openstreetmap.josm.data.coor.EastNorth; 27 import org.openstreetmap.josm.data.osm.DataSet;28 27 import org.openstreetmap.josm.data.osm.Node; 29 28 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 209 208 @Override 210 209 protected void updateEnabledState() { 211 DataSet ds = getLayerManager().getEditDataSet(); 212 if (ds == null) { 213 setEnabled(false); 214 } else { 215 updateEnabledState(ds.getSelected()); 216 } 210 updateEnabledStateOnCurrentSelection(); 217 211 } 218 212 -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r10369 r10409 171 171 } 172 172 } 173 173 174 174 /** 175 175 * Installs the listeners to this action. … … 351 351 352 352 /** 353 * Updates enabled state according to primitives currently selected in edit data set, if any. 354 * Can be called in {@link #updateEnabledState()} implementations. 355 * @since 10409 356 */ 357 protected final void updateEnabledStateOnCurrentSelection() { 358 DataSet ds = getLayerManager().getEditDataSet(); 359 if (ds == null) { 360 setEnabled(false); 361 } else { 362 updateEnabledState(ds.getSelected()); 363 } 364 } 365 366 /** 353 367 * Adapter for layer change events. Runs updateEnabledState() whenever the active layer changed. 354 368 */ -
trunk/src/org/openstreetmap/josm/actions/MirrorAction.java
r10382 r10409 18 18 import org.openstreetmap.josm.command.MoveCommand; 19 19 import org.openstreetmap.josm.command.SequenceCommand; 20 import org.openstreetmap.josm.data.osm.DataSet;21 20 import org.openstreetmap.josm.data.osm.Node; 22 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 87 86 @Override 88 87 protected void updateEnabledState() { 89 DataSet ds = getLayerManager().getEditDataSet(); 90 if (ds == null) { 91 setEnabled(false); 92 } else { 93 updateEnabledState(ds.getSelected()); 94 } 88 updateEnabledStateOnCurrentSelection(); 95 89 } 96 90 -
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r10382 r10409 152 152 @Override 153 153 protected void updateEnabledState() { 154 DataSet ds = getLayerManager().getEditDataSet(); 155 if (ds == null) { 156 setEnabled(false); 157 } else { 158 updateEnabledState(ds.getSelected()); 159 } 154 updateEnabledStateOnCurrentSelection(); 160 155 } 161 156 -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r10382 r10409 276 276 @Override 277 277 protected void updateEnabledState() { 278 DataSet ds = getLayerManager().getEditDataSet(); 279 if (ds == null) { 280 setEnabled(false); 281 } else { 282 updateEnabledState(ds.getSelected()); 283 } 278 updateEnabledStateOnCurrentSelection(); 284 279 } 285 280 -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r10382 r10409 32 32 import org.openstreetmap.josm.command.Command; 33 33 import org.openstreetmap.josm.command.SequenceCommand; 34 import org.openstreetmap.josm.data.osm.DataSet;35 34 import org.openstreetmap.josm.data.osm.Node; 36 35 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 658 657 @Override 659 658 protected void updateEnabledState() { 660 DataSet ds = getLayerManager().getEditDataSet(); 661 if (ds == null) { 662 setEnabled(false); 663 } else { 664 updateEnabledState(ds.getSelected()); 665 } 659 updateEnabledStateOnCurrentSelection(); 666 660 } 667 661 -
trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
r10382 r10409 18 18 import org.openstreetmap.josm.Main; 19 19 import org.openstreetmap.josm.command.RemoveNodesCommand; 20 import org.openstreetmap.josm.data.osm.DataSet;21 20 import org.openstreetmap.josm.data.osm.Node; 22 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 187 186 @Override 188 187 protected void updateEnabledState() { 189 DataSet ds = getLayerManager().getEditDataSet(); 190 if (ds == null) { 191 setEnabled(false); 192 } else { 193 updateEnabledState(ds.getSelected()); 194 } 188 updateEnabledStateOnCurrentSelection(); 195 189 } 196 190 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r10378 r10409 253 253 } 254 254 255 protected OsmDataLayer addNewLayerIfRequired(String newLayerName , Bounds bounds) {255 protected OsmDataLayer addNewLayerIfRequired(String newLayerName) { 256 256 int numDataLayers = getNumDataLayers(); 257 257 if (newLayer || numDataLayers == 0 || (numDataLayers > 1 && getEditLayer() == null)) { … … 268 268 269 269 protected void loadData(String newLayerName, Bounds bounds) { 270 OsmDataLayer layer = addNewLayerIfRequired(newLayerName , bounds);270 OsmDataLayer layer = addNewLayerIfRequired(newLayerName); 271 271 if (layer == null) { 272 272 layer = getEditLayer(); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r10383 r10409 690 690 if (selectedWay != null) { 691 691 int posn0 = selectedWay.getNodes().indexOf(currentNode); 692 // CHECKSTYLE.OFF: SingleSpaceSeparator 692 693 if (posn0 != -1 && // n0 is part of way 693 // CHECKSTYLE.OFF: SingleSpaceSeparator 694 (posn0 >= 1 && targetNode.equals(selectedWay.getNode(posn0-1))) || // previous node 695 (posn0 < selectedWay.getNodesCount()-1) && targetNode.equals(selectedWay.getNode(posn0+1))) { // next node 696 // CHECKSTYLE.ON: SingleSpaceSeparator 694 (posn0 >= 1 && targetNode.equals(selectedWay.getNode(posn0-1))) || // previous node 695 (posn0 < selectedWay.getNodesCount()-1) && targetNode.equals(selectedWay.getNode(posn0+1))) { // next node 697 696 getLayerManager().getEditDataSet().setSelected(targetNode); 698 697 lastUsedNode = targetNode; 699 698 return true; 700 699 } 700 // CHECKSTYLE.ON: SingleSpaceSeparator 701 701 } 702 702
Note:
See TracChangeset
for help on using the changeset viewer.