Ticket #19138: 19138.patch
| File 19138.patch, 2.4 KB (added by , 6 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 23 import org.openstreetmap.josm.data.osm.Relation; 24 24 import org.openstreetmap.josm.data.osm.WaySegment; 25 import org.openstreetmap.josm.gui.ExtendedDialog; 25 26 import org.openstreetmap.josm.gui.MainApplication; 26 27 import org.openstreetmap.josm.gui.MapFrame; 27 28 import org.openstreetmap.josm.gui.MapView; … … 150 151 } 151 152 152 153 updateKeyModifiers(e); 153 154 154 Command c; 155 155 if (ctrl) { 156 156 c = DeleteCommand.deleteWithReferences(lm.getEditDataSet().getSelected()); … … 160 160 // if c is null, an error occurred or the user aborted. Don't do anything in that case. 161 161 if (c != null) { 162 162 UndoRedoHandler.getInstance().add(c); 163 if (changesHiddenWay(c)) { 164 final ConfirmDeleteDialog ed = new ConfirmDeleteDialog(); 165 ed.setContent(tr("Are you sure that you want to delete elements with attached ways that are hidden by filters?")); 166 ed.toggleEnable("deletedHiddenElements"); 167 if (ed.showDialog().getValue() != 1) { 168 UndoRedoHandler.getInstance().undo(1); 169 return; 170 } 171 } 172 163 173 //FIXME: This should not be required, DeleteCommand should update the selection, otherwise undo/redo won't work. 164 174 lm.getEditDataSet().setSelected(); 165 175 } … … 425 435 // We don't have a mouse event, so we pass the old mouse event but the new modifiers. 426 436 giveUserFeedback(oldEvent, modifiers); 427 437 } 438 439 private boolean changesHiddenWay(Command c) { 440 return c.getParticipatingPrimitives().stream().anyMatch(OsmPrimitive::isDisabledAndHidden); 441 } 442 443 static class ConfirmDeleteDialog extends ExtendedDialog { 444 ConfirmDeleteDialog() { 445 super(MainApplication.getMainFrame(), 446 tr("Delete elements"), 447 tr("Delete them"), tr("Undo delete")); 448 setButtonIcons("dialogs/delete", "cancel"); 449 setCancelButton(2); 450 } 451 } 452 428 453 }
