Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 16176)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 16177)
@@ -593,4 +593,5 @@
 
         if (mode == Mode.MOVE && e.getButton() == MouseEvent.BUTTON1) {
+            DataSet ds = getLayerManager().getEditDataSet();
             if (!didMouseDrag) {
                 // only built in move mode
@@ -603,5 +604,5 @@
 
                     // If the user double-clicked a node, change to draw mode
-                    Collection<OsmPrimitive> c = getLayerManager().getEditDataSet().getSelected();
+                    Collection<OsmPrimitive> c = ds.getSelected();
                     if (e.getClickCount() >= 2 && c.size() == 1 && c.iterator().next() instanceof Node) {
                         // We need to do it like this as otherwise drawAction will see a double
@@ -700,6 +701,5 @@
         Collection<OsmPrimitive> selection = ds.getSelectedNodesAndWays();
         if (selection.isEmpty()) { // if nothing was selected to drag, just select nearest node/way to the cursor
-            OsmPrimitive nearestPrimitive = mv.getNearestNodeOrWay(mv.getPoint(startEN), mv.isSelectablePredicate, true);
-            ds.setSelected(nearestPrimitive);
+            ds.setSelected(mv.getNearestNodeOrWay(mv.getPoint(startEN), mv.isSelectablePredicate, true));
         }
 
@@ -829,11 +829,8 @@
     private void confirmOrUndoMovement(MouseEvent e) {
         if (movesHiddenWay()) {
-            final ExtendedDialog ed = new ConfirmMoveDialog();
+            final ConfirmMoveDialog ed = new ConfirmMoveDialog();
             ed.setContent(tr("Are you sure that you want to move elements with attached ways that are hidden by filters?"));
             ed.toggleEnable("movedHiddenElements");
-            ed.showDialog();
-            if (ed.getValue() != 1) {
-                UndoRedoHandler.getInstance().undo();
-            }
+            showConfirmMoveDialog(ed);
         }
         Set<Node> nodes = new HashSet<>();
@@ -850,5 +847,5 @@
         }
         if (nodes.size() > max) {
-            final ExtendedDialog ed = new ConfirmMoveDialog();
+            final ConfirmMoveDialog ed = new ConfirmMoveDialog();
             ed.setContent(
                     /* for correct i18n of plural forms - see #9110 */
@@ -857,13 +854,15 @@
                         max, max));
             ed.toggleEnable("movedManyElements");
-            ed.showDialog();
-
-            if (ed.getValue() != 1) {
-                UndoRedoHandler.getInstance().undo();
-            }
+            showConfirmMoveDialog(ed);
         } else {
             // if small number of elements were moved,
             updateKeyModifiers(e);
             if (ctrl) mergePrims(e.getPoint());
+        }
+    }
+
+    private void showConfirmMoveDialog(ConfirmMoveDialog ed) {
+        if (ed.showDialog().getValue() != 1) {
+            UndoRedoHandler.getInstance().undo();
         }
     }
