Index: trunk/src/org/openstreetmap/josm/command/Command.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/Command.java	(revision 10448)
+++ trunk/src/org/openstreetmap/josm/command/Command.java	(revision 10452)
@@ -148,5 +148,8 @@
      * Executes the command on the dataset. This implementation will remember all
      * primitives returned by fillModifiedData for restoring them on undo.
+     * <p>
+     * The layer should be invalidated after execution so that it can be re-painted.
      * @return true
+     * @see #invalidateAffectedLayers()
      */
     public boolean executeCommand() {
@@ -300,3 +303,14 @@
                 Objects.equals(layer, command.layer);
     }
+
+    /**
+     * Invalidate all layers that were affected by this command.
+     * @see Layer#invalidate()
+     */
+    public void invalidateAffectedLayers() {
+        OsmDataLayer layer = getLayer();
+        if (layer != null) {
+            layer.invalidate();
+        }
+    }
 }
Index: trunk/src/org/openstreetmap/josm/command/SequenceCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/SequenceCommand.java	(revision 10448)
+++ trunk/src/org/openstreetmap/josm/command/SequenceCommand.java	(revision 10452)
@@ -126,4 +126,12 @@
 
     @Override
+    public void invalidateAffectedLayers() {
+        super.invalidateAffectedLayers();
+        for (Command c : sequence) {
+            c.invalidateAffectedLayers();
+        }
+    }
+
+    @Override
     public int hashCode() {
         return Objects.hash(super.hashCode(), Arrays.hashCode(sequence), sequenceComplete, name, continueOnError);
Index: trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java	(revision 10448)
+++ trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java	(revision 10452)
@@ -15,7 +15,13 @@
 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
+/**
+ * This is the global undo/redo handler for all {@link OsmDataLayer}s.
+ * <p>
+ * If you want to change a data layer, you can use {@link #add(Command)} to execute a command on it and make that command undoable.
+ */
 public class UndoRedoHandler implements LayerChangeListener {
 
@@ -45,4 +51,5 @@
         CheckParameterUtil.ensureParameterNotNull(c, "c");
         c.executeCommand();
+        c.invalidateAffectedLayers();
         commands.add(c);
         // Limit the number of commands in the undo list.
@@ -55,12 +62,9 @@
     }
 
+    /**
+     * Fires a commands change event after adding a command.
+     */
     public void afterAdd() {
         fireCommandsChanged();
-
-        // the command may have changed the selection so tell the listeners about the current situation
-        DataSet ds = Main.getLayerManager().getEditDataSet();
-        if (ds != null) {
-            ds.fireSelectionChanged();
-        }
     }
 
@@ -70,6 +74,11 @@
      */
     public synchronized void add(final Command c) {
+        DataSet ds = Main.getLayerManager().getEditDataSet();
+        Collection<? extends OsmPrimitive> oldSelection = ds.getSelected();
         addNoRedraw(c);
         afterAdd();
+
+        // the command may have changed the selection so tell the listeners about the current situation
+        fireIfSelectionChanged(ds, oldSelection);
     }
 
@@ -88,10 +97,12 @@
         if (commands.isEmpty())
             return;
-        Collection<? extends OsmPrimitive> oldSelection = Main.getLayerManager().getEditDataSet().getSelected();
-        Main.getLayerManager().getEditDataSet().beginUpdate();
+        DataSet ds = Main.getLayerManager().getEditDataSet();
+        Collection<? extends OsmPrimitive> oldSelection = ds.getSelected();
+        ds.beginUpdate();
         try {
             for (int i = 1; i <= num; ++i) {
                 final Command c = commands.removeLast();
                 c.undoCommand();
+                c.invalidateAffectedLayers();
                 redoCommands.addFirst(c);
                 if (commands.isEmpty()) {
@@ -100,11 +111,8 @@
             }
         } finally {
-            Main.getLayerManager().getEditDataSet().endUpdate();
-        }
-        fireCommandsChanged();
-        Collection<? extends OsmPrimitive> newSelection = Main.getLayerManager().getEditDataSet().getSelected();
-        if (!oldSelection.equals(newSelection)) {
-            Main.getLayerManager().getEditDataSet().fireSelectionChanged();
-        }
+            ds.endUpdate();
+        }
+        fireCommandsChanged();
+        fireIfSelectionChanged(ds, oldSelection);
     }
 
@@ -123,8 +131,10 @@
         if (redoCommands.isEmpty())
             return;
-        Collection<? extends OsmPrimitive> oldSelection = Main.getLayerManager().getEditDataSet().getSelected();
+        DataSet ds = Main.getLayerManager().getEditDataSet();
+        Collection<? extends OsmPrimitive> oldSelection = ds.getSelected();
         for (int i = 0; i < num; ++i) {
             final Command c = redoCommands.removeFirst();
             c.executeCommand();
+            c.invalidateAffectedLayers();
             commands.add(c);
             if (redoCommands.isEmpty()) {
@@ -133,11 +143,18 @@
         }
         fireCommandsChanged();
-        Collection<? extends OsmPrimitive> newSelection = Main.getLayerManager().getEditDataSet().getSelected();
+        fireIfSelectionChanged(ds, oldSelection);
+    }
+
+    private static void fireIfSelectionChanged(DataSet ds, Collection<? extends OsmPrimitive> oldSelection) {
+        Collection<? extends OsmPrimitive> newSelection = ds.getSelected();
         if (!oldSelection.equals(newSelection)) {
-            Main.getLayerManager().getEditDataSet().fireSelectionChanged();
-        }
-    }
-
-    public void fireCommandsChanged() {
+            ds.fireSelectionChanged();
+        }
+    }
+
+    /**
+     * Fires a command change to all listeners.
+     */
+    private void fireCommandsChanged() {
         for (final CommandQueueListener l : listenerCommands) {
             l.commandChanged(commands.size(), redoCommands.size());
@@ -145,4 +162,7 @@
     }
 
+    /**
+     * Resets the undo/redo list.
+     */
     public void clean() {
         redoCommands.clear();
@@ -151,4 +171,8 @@
     }
 
+    /**
+     * Resets all commands that affect the given layer.
+     * @param layer The layer that was affected.
+     */
     public void clean(Layer layer) {
         if (layer == null)
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java	(revision 10448)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java	(revision 10452)
@@ -608,14 +608,14 @@
 
         @Override
-        protected void realRun() throws SAXException, IOException,
-        OsmTransferException {
+        protected void realRun() throws SAXException, IOException, OsmTransferException {
             ProgressMonitor monitor = getProgressMonitor();
             try {
                 monitor.setTicksCount(testErrors.size());
+                final DataSet ds = Main.getLayerManager().getEditDataSet();
                 int i = 0;
                 SwingUtilities.invokeAndWait(new Runnable() {
                     @Override
                     public void run() {
-                        Main.getLayerManager().getEditDataSet().beginUpdate();
+                        ds.beginUpdate();
                     }
                 });
@@ -633,5 +633,5 @@
                         @Override
                         public void run() {
-                            Main.getLayerManager().getEditDataSet().endUpdate();
+                            ds.endUpdate();
                         }
                     });
@@ -644,5 +644,5 @@
                         Main.map.repaint();
                         tree.resetErrors();
-                        Main.getLayerManager().getEditDataSet().fireSelectionChanged();
+                        ds.fireSelectionChanged();
                     }
                 });
