diff --git a/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java b/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
index ecece99..80d722e 100644
a
|
b
|
private static Command getLastCommand() {
|
807 | 807 | } |
808 | 808 | |
809 | 809 | /** |
810 | | * Present warning in case of large and possibly unwanted movements and undo |
811 | | * unwanted movements. |
| 810 | * Present warning in the follwing cases and undo unwanted movements: <ul> |
| 811 | * <li>large and possibly unwanted movements</li> |
| 812 | * <li>movement of node with attached ways that are hidden by filters</li> |
812 | 813 | * |
813 | 814 | * @param e the mouse event causing the action (mouse released) |
814 | 815 | */ |
815 | 816 | private void confirmOrUndoMovement(MouseEvent e) { |
| 817 | boolean movesHiddenPrimitive = false; |
| 818 | for (OsmPrimitive osm : getCurrentDataSet().getSelected()) { |
| 819 | for (Way ref : OsmPrimitive.getFilteredList(osm.getReferrers(), Way.class)) { |
| 820 | if (ref.isDisabledAndHidden()) { |
| 821 | movesHiddenPrimitive = true; |
| 822 | break; |
| 823 | } |
| 824 | } |
| 825 | } |
| 826 | if (movesHiddenPrimitive) { |
| 827 | ExtendedDialog ed = new ConfirmMoveDialog(); |
| 828 | ed.setContent(tr("Are you sure that you want to move node with attached ways that are hidden by filters?")); |
| 829 | ed.showDialog(); |
| 830 | if (ed.getValue() != 1) { |
| 831 | Main.main.undoRedo.undo(); |
| 832 | } |
| 833 | } |
816 | 834 | int max = Main.pref.getInteger("warn.move.maxelements", 20), limit = max; |
817 | 835 | for (OsmPrimitive osm : getCurrentDataSet().getSelected()) { |
818 | 836 | if (osm instanceof Way) { |
… |
… |
private void confirmOrUndoMovement(MouseEvent e) {
|
823 | 841 | } |
824 | 842 | } |
825 | 843 | if (limit < 0) { |
826 | | ExtendedDialog ed = new ExtendedDialog( |
827 | | Main.parent, |
828 | | tr("Move elements"), |
829 | | new String[]{tr("Move them"), tr("Undo move")}); |
830 | | ed.setButtonIcons(new String[]{"reorder", "cancel"}); |
| 844 | ExtendedDialog ed = new ConfirmMoveDialog(); |
831 | 845 | ed.setContent( |
832 | 846 | /* for correct i18n of plural forms - see #9110 */ |
833 | 847 | trn("You moved more than {0} element. " + "Moving a large number of elements is often an error.\n" + "Really move them?", |
834 | 848 | "You moved more than {0} elements. " + "Moving a large number of elements is often an error.\n" + "Really move them?", |
835 | 849 | max, max)); |
836 | | ed.setCancelButton(2); |
837 | | ed.toggleEnable("movedManyElements"); |
838 | 850 | ed.showDialog(); |
839 | 851 | |
840 | 852 | if (ed.getValue() != 1) { |
… |
… |
private void confirmOrUndoMovement(MouseEvent e) {
|
848 | 860 | getCurrentDataSet().fireSelectionChanged(); |
849 | 861 | } |
850 | 862 | |
| 863 | static class ConfirmMoveDialog extends ExtendedDialog { |
| 864 | public ConfirmMoveDialog() { |
| 865 | super(Main.parent, |
| 866 | tr("Move elements"), |
| 867 | new String[]{tr("Move them"), tr("Undo move")}); |
| 868 | setButtonIcons(new String[]{"reorder", "cancel"}); |
| 869 | setCancelButton(2); |
| 870 | toggleEnable("movedManyElements"); |
| 871 | } |
| 872 | } |
| 873 | |
851 | 874 | /** |
852 | 875 | * Merges the selected nodes to the one closest to the given mouse position if the control |
853 | 876 | * key is pressed. If there is no such node, no action will be done and no error will be |