Changeset 9472 in josm for trunk/src/org/openstreetmap/josm/actions/mapmode
- Timestamp:
- 2016-01-15T22:00:20+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified 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 }
Note:
See TracChangeset
for help on using the changeset viewer.