Changeset 9472 in josm for trunk/src/org
- Timestamp:
- 2016-01-15T22:00:20+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r9230 r9472 9 9 import java.awt.event.KeyEvent; 10 10 import java.awt.event.MouseEvent; 11 import java.util.Collection; 11 12 import java.util.Collections; 12 13 import java.util.HashSet; … … 318 319 * 319 320 * @param layer the layer in whose context the relation is deleted. Must not be null. 320 * @param toDelete the relation to be deleted. Must 321 * @param toDelete the relation to be deleted. Must not be null. 321 322 * @throws IllegalArgumentException if layer is null 322 * @throws IllegalArgumentException if toDelete is nul 323 * @throws IllegalArgumentException if toDelete is null 323 324 */ 324 325 public static void deleteRelation(OsmDataLayer layer, Relation toDelete) { 326 deleteRelations(layer, Collections.singleton(toDelete)); 327 } 328 329 /** 330 * Deletes the relations in the context of the given layer. 331 * 332 * @param layer the layer in whose context the relations are deleted. Must not be null. 333 * @param toDelete the relations to be deleted. Must not be null. 334 * @throws IllegalArgumentException if layer is null 335 * @throws IllegalArgumentException if toDelete is null 336 */ 337 public static void deleteRelations(OsmDataLayer layer, Collection<Relation> toDelete) { 325 338 CheckParameterUtil.ensureParameterNotNull(layer, "layer"); 326 339 CheckParameterUtil.ensureParameterNotNull(toDelete, "toDelete"); 327 340 328 Command cmd = DeleteCommand.delete(layer, Collections.singleton(toDelete));341 final Command cmd = DeleteCommand.delete(layer, toDelete); 329 342 if (cmd != null) { 330 343 // cmd can be null if the user cancels dialogs DialogCommand displays 331 344 Main.main.undoRedo.add(cmd); 332 if (getCurrentDataSet().getSelectedRelations().contains(toDelete)) { 333 getCurrentDataSet().toggleSelected(toDelete); 345 for (Relation relation : toDelete) { 346 if (getCurrentDataSet().getSelectedRelations().contains(relation)) { 347 getCurrentDataSet().toggleSelected(relation); 348 } 349 RelationDialogManager.getRelationDialogManager().close(layer, relation); 334 350 } 335 RelationDialogManager.getRelationDialogManager().close(layer, toDelete);336 351 } 337 352 } -
trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java
r8510 r9472 5 5 6 6 import java.awt.event.ActionEvent; 7 import java.util.Collection; 7 8 8 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.actions.mapmode.DeleteAction; 9 11 import org.openstreetmap.josm.data.osm.Relation; 10 12 import org.openstreetmap.josm.tools.ImageProvider; … … 15 17 */ 16 18 public class DeleteRelationsAction extends AbstractRelationAction { 17 static class AbortException extends Exception {}18 19 19 20 /** … … 26 27 } 27 28 28 protected void deleteRelation( RelationtoDelete) {29 protected void deleteRelation(Collection<Relation> toDelete) { 29 30 if (toDelete == null) 30 31 return; 31 org.openstreetmap.josm.actions.mapmode.DeleteAction 32 .deleteRelation(Main.main.getEditLayer(), toDelete); 32 DeleteAction.deleteRelations(Main.main.getEditLayer(), toDelete); 33 33 // clear selection after deletion 34 34 if (Main.map.relationListDialog != null) … … 40 40 if (!isEnabled() || !Main.main.hasEditLayer()) 41 41 return; 42 for (Relation r : relations) { 43 deleteRelation(r); 44 } 42 deleteRelation(relations); 45 43 } 46 44 } 47
Note:
See TracChangeset
for help on using the changeset viewer.