Changeset 12348 in josm for trunk/src/org
- Timestamp:
- 2017-06-08T23:41:02+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/command
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/Command.java
r11243 r12348 338 338 } 339 339 340 /** 341 * Ensures that all primitives that are participating in this command belong to the affected data set. 342 * 343 * Commands may use this in their update methods to check the consitency of the primitives they operate on. 344 * @throws AssertionError if no {@link DataSet} is set or if any primitive does not belong to that dataset. 345 */ 346 protected void ensurePrimitivesAreInDataset() { 347 for (OsmPrimitive primitive : this.getParticipatingPrimitives()) { 348 if (primitive.getDataSet() != this.getAffectedDataSet()) { 349 throw new AssertionError("Primitive is of wrong data set for this command: " + primitive); 350 } 351 } 352 } 353 340 354 @Override 341 355 public int hashCode() { -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r11590 r12348 168 168 @Override 169 169 public boolean executeCommand() { 170 ensurePrimitivesAreInDataset(); 170 171 // Make copy and remove all references (to prevent inconsistent dataset (delete referenced) while command is executed) 171 172 for (OsmPrimitive osm: toDelete) { … … 190 191 @Override 191 192 public void undoCommand() { 193 ensurePrimitivesAreInDataset(); 194 192 195 for (OsmPrimitive osm: toDelete) { 193 196 osm.setDeleted(false); -
trunk/src/org/openstreetmap/josm/command/MoveCommand.java
r11070 r12348 207 207 @Override 208 208 public boolean executeCommand() { 209 ensurePrimitivesAreInDataset(); 210 209 211 for (Node n : nodes) { 210 212 // in case #3892 happens again … … 222 224 @Override 223 225 public void undoCommand() { 226 ensurePrimitivesAreInDataset(); 227 224 228 Iterator<OldNodeState> it = oldState.iterator(); 225 229 for (Node n : nodes) {
Note:
See TracChangeset
for help on using the changeset viewer.