Index: src/org/openstreetmap/josm/Main.java
===================================================================
--- src/org/openstreetmap/josm/Main.java	(revision 300)
+++ src/org/openstreetmap/josm/Main.java	(revision 301)
@@ -40,4 +40,5 @@
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.Preferences;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.projection.Epsg4326;
@@ -47,5 +48,4 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.PleaseWaitDialog;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
 import org.openstreetmap.josm.gui.download.BoundingBoxSelection;
 import org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask;
@@ -111,8 +111,12 @@
 
 
+	public UndoRedoHandler undoRedo = new UndoRedoHandler();
+
 	/**
 	 * The main menu bar at top of screen.
 	 */
 	public final MainMenu menu;
+
+
 
 
@@ -125,24 +129,7 @@
 		panel.setVisible(false);
 		panel.removeAll();
-		if (map != null) {
+		if (map != null)
 			map.fillPanel(panel);
-			map.mapView.addLayerChangeListener(new LayerChangeListener(){
-				public void activeLayerChange(final Layer oldLayer, final Layer newLayer) {
-					setLayerMenu(newLayer.getMenuEntries());
-				}
-				public void layerAdded(final Layer newLayer) {
-					if (newLayer instanceof OsmDataLayer)
-						Main.main.editLayer().listenerCommands.add(redoUndoListener);
-				}
-				public void layerRemoved(final Layer oldLayer) {
-					if (oldLayer instanceof OsmDataLayer)
-						Main.main.editLayer().listenerCommands.add(redoUndoListener);
-					if (map.mapView.getAllLayers().isEmpty())
-						setLayerMenu(null);
-				}
-			});
-			if (map.mapView.editLayer != null)
-				map.mapView.editLayer.listenerCommands.add(redoUndoListener);
-		} else {
+		else {
 			old.destroy();
 			panel.add(new GettingStarted(), BorderLayout.CENTER);
@@ -187,4 +174,6 @@
 		menu = new MainMenu();
 
+		undoRedo.listenerCommands.add(redoUndoListener);
+		
 		// creating toolbar
 		contentPane.add(toolbar.control, BorderLayout.NORTH);
@@ -305,5 +294,4 @@
 		}
 	};
-
 	/**
 	 * Should be called before the main constructor to setup some parameter stuff
Index: src/org/openstreetmap/josm/actions/AlignInCircleAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/AlignInCircleAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/AlignInCircleAction.java	(revision 301)
@@ -68,5 +68,5 @@
 		}
 
-		Main.main.editLayer().add(new SequenceCommand(tr("Align Nodes in Circle"), cmds));
+		Main.main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds));
 		Main.map.repaint();
 	}
Index: src/org/openstreetmap/josm/actions/AlignInLineAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 301)
@@ -110,5 +110,5 @@
 
 		// Do it!
-		Main.main.editLayer().add(new SequenceCommand(tr("Align Nodes in Line"), cmds));
+		Main.main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Line"), cmds));
 		Main.map.repaint();
 	}
Index: src/org/openstreetmap/josm/actions/CombineWayAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 301)
@@ -99,5 +99,5 @@
 		cmds.add(new DeleteCommand(selectedWays));
 		cmds.add(new ChangeCommand(oldWay, newWay));
-		Main.main.editLayer().add(new SequenceCommand(tr("Combine {0} ways", selectedWays.size()), cmds));
+		Main.main.undoRedo.add(new SequenceCommand(tr("Combine {0} ways", selectedWays.size()), cmds));
 		Main.ds.setSelected(oldWay);
 	}
Index: src/org/openstreetmap/josm/actions/RedoAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/RedoAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/RedoAction.java	(revision 301)
@@ -30,5 +30,5 @@
 			return;
 		Main.map.repaint();
-		Main.main.editLayer().redo();
+		Main.main.undoRedo.redo();
 	}
 }
Index: src/org/openstreetmap/josm/actions/ReorderAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/ReorderAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/ReorderAction.java	(revision 301)
@@ -59,5 +59,5 @@
 
 				if( c != null )
-					Main.main.editLayer().add( c );
+					Main.main.undoRedo.add(c);
 			}
 		}
Index: src/org/openstreetmap/josm/actions/ReverseSegmentAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/ReverseSegmentAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/ReverseSegmentAction.java	(revision 301)
@@ -54,5 +54,5 @@
     		c.add(new ChangeCommand(s, snew));
     	}
-    	Main.main.editLayer().add(new SequenceCommand(tr("Reverse Segments"), c));
+    	Main.main.undoRedo.add(new SequenceCommand(tr("Reverse Segments"), c));
     	Main.map.repaint();
     }
Index: src/org/openstreetmap/josm/actions/SplitWayAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/SplitWayAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/SplitWayAction.java	(revision 301)
@@ -455,5 +455,5 @@
 		NameVisitor v = new NameVisitor();
 		v.visit(selectedWay);
-		Main.main.editLayer().add(new SequenceCommand(tr("Split way {0} into {1} parts",v.name, segmentSets.size()), commandList));
+		Main.main.undoRedo.add(new SequenceCommand(tr("Split way {0} into {1} parts",v.name, segmentSets.size()), commandList));
 		Main.ds.setSelected(newSelection);
 	}
Index: src/org/openstreetmap/josm/actions/UndoAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/UndoAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/UndoAction.java	(revision 301)
@@ -30,5 +30,5 @@
 			return;
 		Main.map.repaint();
-		Main.main.editLayer().undo();
+		Main.main.undoRedo.undo();
 	}
 }
Index: src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java	(revision 301)
@@ -170,5 +170,5 @@
 		}		
 	
-		Main.main.editLayer().add(c);
+		Main.main.undoRedo.add(c);
 		Main.ds.setSelected(n);
 		Main.map.mapView.repaint();
Index: src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java	(revision 301)
@@ -146,5 +146,5 @@
 
 			Segment ls = new Segment(start, end);
-			Main.main.editLayer().add(new AddCommand(ls));
+			Main.main.undoRedo.add(new AddCommand(ls));
 			Collection<OsmPrimitive> sel = Main.ds.getSelected();
 			sel.add(ls);
Index: src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java	(revision 301)
@@ -107,13 +107,13 @@
 			copy.segments.remove(s);
 			if (copy.segments.isEmpty()) {
-				Main.main.editLayer().add(new DeleteCommand(Arrays.asList(new OsmPrimitive[]{way})));
+				Main.main.undoRedo.add(new DeleteCommand(Arrays.asList(new OsmPrimitive[]{way})));
 				way = null;
 			} else
-				Main.main.editLayer().add(new ChangeCommand(way, copy));
+				Main.main.undoRedo.add(new ChangeCommand(way, copy));
 		} else {
 			if (way == null) {
 				way = new Way();
 				way.segments.add(s);
-				Main.main.editLayer().add(new AddCommand(way));
+				Main.main.undoRedo.add(new AddCommand(way));
 			} else {
 				Way copy = new Way(way);
@@ -123,5 +123,5 @@
 						break;
 				copy.segments.add(i, s);
-				Main.main.editLayer().add(new ChangeCommand(way, copy));
+				Main.main.undoRedo.add(new ChangeCommand(way, copy));
 			}
 		}
@@ -198,5 +198,5 @@
 				w.segments.clear();
 			w.segments.addAll(sortedSegments);
-			Main.main.editLayer().add(new ChangeCommand(wayToAdd, w));
+			Main.main.undoRedo.add(new ChangeCommand(wayToAdd, w));
 			return wayToAdd;
 		}
@@ -207,5 +207,5 @@
 		Way w = new Way();
 		w.segments.addAll(sortedSegments);
-		Main.main.editLayer().add(new AddCommand(w));
+		Main.main.undoRedo.add(new AddCommand(w));
 		return w;
 	}
Index: src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 301)
@@ -126,5 +126,5 @@
 		v.data.addAll(selection);
 		if (!v.data.isEmpty())
-			Main.main.editLayer().add(new DeleteCommand(v.data));
+			Main.main.undoRedo.add(new DeleteCommand(v.data));
 	}
 
@@ -164,5 +164,5 @@
 		}
 		if (!del.isEmpty())
-			Main.main.editLayer().add(new DeleteCommand(del));
+			Main.main.undoRedo.add(new DeleteCommand(del));
 	}
 
@@ -213,5 +213,5 @@
 		cmds.add(new ChangeCommand(seg1, s));
 		cmds.add(new DeleteCommand(Arrays.asList(new OsmPrimitive[]{n, seg2})));
-		Main.main.editLayer().add(new SequenceCommand(tr("Delete Node"), cmds));
+		Main.main.undoRedo.add(new SequenceCommand(tr("Delete Node"), cmds));
 		return null;
     }
Index: src/org/openstreetmap/josm/actions/mapmode/MoveAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/mapmode/MoveAction.java	(revision 300)
+++ src/org/openstreetmap/josm/actions/mapmode/MoveAction.java	(revision 301)
@@ -106,9 +106,9 @@
 		}
 
-		Command c = !Main.main.editLayer().commands.isEmpty() ? Main.main.editLayer().commands.getLast() : null;
+		Command c = !Main.main.undoRedo.commands.isEmpty() ? Main.main.undoRedo.commands.getLast() : null;
 		if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand)c).objects))
 			((MoveCommand)c).moveAgain(dx,dy);
 		else
-			Main.main.editLayer().add(new MoveCommand(selection, dx, dy));
+			Main.main.undoRedo.add(new MoveCommand(selection, dx, dy));
 
 		Main.map.mapView.repaint();
Index: src/org/openstreetmap/josm/command/AddCommand.java
===================================================================
--- src/org/openstreetmap/josm/command/AddCommand.java	(revision 300)
+++ src/org/openstreetmap/josm/command/AddCommand.java	(revision 301)
@@ -11,4 +11,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.visitor.AddVisitor;
@@ -28,4 +29,6 @@
 	 */
 	private final OsmPrimitive osm;
+	
+	private DataSet ds;
 
 	/**
@@ -34,12 +37,13 @@
 	public AddCommand(OsmPrimitive osm) {
 		this.osm = osm;
+		this.ds = Main.ds;
 	}
 
 	@Override public void executeCommand() {
-		osm.visit(new AddVisitor(Main.ds));
+		osm.visit(new AddVisitor(ds));
 	}
 
 	@Override public void undoCommand() {
-		osm.visit(new DeleteVisitor(Main.ds));
+		osm.visit(new DeleteVisitor(ds));
 	}
 
Index: src/org/openstreetmap/josm/data/UndoRedoHandler.java
===================================================================
--- src/org/openstreetmap/josm/data/UndoRedoHandler.java	(revision 301)
+++ src/org/openstreetmap/josm/data/UndoRedoHandler.java	(revision 301)
@@ -0,0 +1,84 @@
+// License: GPL. Copyright 2007 by Immanuel Scholz and others
+package org.openstreetmap.josm.data;
+
+import java.util.LinkedList;
+import java.util.Stack;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
+
+public class UndoRedoHandler {
+
+	/**
+	 * All commands that were made on the dataset. Don't write from outside!
+	 */
+	public final LinkedList<Command> commands = new LinkedList<Command>();
+	/**
+	 * The stack for redoing commands
+	 */
+	private final Stack<Command> redoCommands = new Stack<Command>();
+
+	public final LinkedList<CommandQueueListener> listenerCommands = new LinkedList<CommandQueueListener>();
+
+
+	/**
+	 * Execute the command and add it to the intern command queue.
+	 */
+	public void add(final Command c) {
+		c.executeCommand();
+		commands.add(c);
+		redoCommands.clear();
+		if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
+			OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer();
+			data.setModified(true);
+		}
+		fireCommandsChanged();
+	}
+	
+	/**
+	 * Undoes the last added command.
+	 */
+	public void undo() {
+		if (commands.isEmpty())
+			return;
+		final Command c = commands.removeLast();
+		c.undoCommand();
+		redoCommands.push(c);
+		if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
+			OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer();
+			data.setModified(data.uploadedModified || !commands.isEmpty());
+			fireCommandsChanged();
+		}		
+		Main.ds.setSelected();
+	}
+
+	/**
+	 * Redoes the last undoed command.
+	 * TODO: This has to be moved to a central place in order to support multiple layers.
+	 */
+	public void redo() {
+		if (redoCommands.isEmpty())
+			return;
+		final Command c = redoCommands.pop();
+		c.executeCommand();
+		commands.add(c);
+		if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
+			OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer();
+			data.setModified(true);
+			fireCommandsChanged();
+		}
+	}
+
+	public void fireCommandsChanged() {
+		for (final CommandQueueListener l : listenerCommands)
+			l.commandChanged(commands.size(), redoCommands.size());
+	}
+
+	public void clean() {
+		redoCommands.clear();
+		commands.clear();
+		fireCommandsChanged();
+    }
+}
Index: src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 300)
+++ src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 301)
@@ -19,7 +19,4 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.gui.MapFrame;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
-import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
 
@@ -31,17 +28,5 @@
 	public CommandStackDialog(final MapFrame mapFrame) {
 		super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), KeyEvent.VK_O, 100);
-		mapFrame.mapView.addLayerChangeListener(new LayerChangeListener(){
-			public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
-			public void layerAdded(Layer newLayer) {
-				if (newLayer instanceof OsmDataLayer)
-					Main.main.editLayer().listenerCommands.add(CommandStackDialog.this);
-			}
-			public void layerRemoved(Layer oldLayer) {
-				if (oldLayer instanceof OsmDataLayer)
-					Main.main.editLayer().listenerCommands.remove(CommandStackDialog.this);
-			}
-		});
-		if (mapFrame.mapView.editLayer != null)
-			mapFrame.mapView.editLayer.listenerCommands.add(this);
+		Main.main.undoRedo.listenerCommands.add(this);
 			
 		tree.setRootVisible(false);
@@ -75,5 +60,5 @@
 		if (Main.map == null || Main.map.mapView == null || Main.map.mapView.editLayer == null)
 			return;
-		Collection<Command> commands = Main.main.editLayer().commands;
+		Collection<Command> commands = Main.main.undoRedo.commands;
 		DefaultMutableTreeNode root = new DefaultMutableTreeNode();
 		for (Command c : commands)
Index: src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java	(revision 300)
+++ src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java	(revision 301)
@@ -120,5 +120,5 @@
 		if (answer != JOptionPane.OK_OPTION)
 			return;
-		Main.main.editLayer().add(new ConflictResolveCommand(resolver.conflicts, sel));
+		Main.main.undoRedo.add(new ConflictResolveCommand(resolver.conflicts, sel));
 		Main.map.mapView.repaint();
 	}
Index: src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(revision 300)
+++ src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(revision 301)
@@ -157,7 +157,7 @@
 		}
 		if (key.equals(newkey) || value == null)
-			Main.main.editLayer().add(new ChangePropertyCommand(sel, newkey, value));
+			Main.main.undoRedo.add(new ChangePropertyCommand(sel, newkey, value));
 		else {
-			Main.main.editLayer().add(new SequenceCommand(trn("Change properties of {0} object", "Change properties of {0} objects", sel.size(), sel.size()),
+			Main.main.undoRedo.add(new SequenceCommand(trn("Change properties of {0} object", "Change properties of {0} objects", sel.size(), sel.size()),
 					new ChangePropertyCommand(sel, key, null),
 					new ChangePropertyCommand(sel, newkey, value)));
@@ -239,5 +239,5 @@
 		if (value.equals(""))
 			return;
-		Main.main.editLayer().add(new ChangePropertyCommand(sel, key, value));
+		Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, value));
 		selectionChanged(sel); // update table
 		Main.parent.repaint(); // repaint all - drawing could have been changed
@@ -251,5 +251,5 @@
 		String key = data.getValueAt(row, 0).toString();
 		Collection<OsmPrimitive> sel = Main.ds.getSelected();
-		Main.main.editLayer().add(new ChangePropertyCommand(sel, key, null));
+		Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, null));
 		selectionChanged(sel); // update table
 	}
Index: src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 300)
+++ src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 301)
@@ -17,5 +17,4 @@
 import java.util.LinkedList;
 import java.util.Set;
-import java.util.Stack;
 
 import javax.swing.Icon;
@@ -31,5 +30,4 @@
 import org.openstreetmap.josm.actions.SaveAction;
 import org.openstreetmap.josm.actions.SaveAsAction;
-import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -107,15 +105,6 @@
 	 */
 	private boolean fromDisk = false;
-	/**
-	 * All commands that were made on the dataset. Don't write from outside!
-	 */
-	public final LinkedList<Command> commands = new LinkedList<Command>();
-	/**
-	 * The stack for redoing commands
-	 */
-	private final Stack<Command> redoCommands = new Stack<Command>();
 
 	public final LinkedList<ModifiedChangedListener> listenerModified = new LinkedList<ModifiedChangedListener>();
-	public final LinkedList<CommandQueueListener> listenerCommands = new LinkedList<CommandQueueListener>();
 
 	private SimplePaintVisitor mapPainter = new SimplePaintVisitor();
@@ -209,44 +198,4 @@
 
 	/**
-	 * Execute the command and add it to the intern command queue. Also mark all
-	 * primitives in the command as modified.
-	 */
-	public void add(final Command c) {
-		c.executeCommand();
-		commands.add(c);
-		redoCommands.clear();
-		setModified(true);
-		fireCommandsChanged();
-	}
-
-	/**
-	 * Undoes the last added command.
-	 * TODO: This has to be moved to a central place in order to support multiple layers.
-	 */
-	public void undo() {
-		if (commands.isEmpty())
-			return;
-		final Command c = commands.removeLast();
-		c.undoCommand();
-		redoCommands.push(c);
-		setModified(uploadedModified || !commands.isEmpty());
-		Main.ds.setSelected();
-		fireCommandsChanged();
-	}
-	/**
-	 * Redoes the last undoed command.
-	 * TODO: This has to be moved to a central place in order to support multiple layers.
-	 */
-	public void redo() {
-		if (redoCommands.isEmpty())
-			return;
-		final Command c = redoCommands.pop();
-		c.executeCommand();
-		commands.add(c);
-		setModified(true);
-		fireCommandsChanged();
-	}
-
-	/**
 	 * Clean out the data behind the layer. This means clearing the redo/undo lists,
 	 * really deleting all deleted objects and reset the modified flags. This is done
@@ -264,6 +213,5 @@
 			return;
 		
-		redoCommands.clear();
-		commands.clear();
+		Main.main.undoRedo.clean();
 
 		// if uploaded, clean the modified flags as well
@@ -285,10 +233,4 @@
 		uploadedModified = fromDisk && processed != null && dataAdded;
 		setModified(uploadedModified);
-		fireCommandsChanged();
-	}
-
-	public void fireCommandsChanged() {
-		for (final CommandQueueListener l : listenerCommands)
-			l.commandChanged(commands.size(), redoCommands.size());
 	}
 
Index: src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 300)
+++ src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 301)
@@ -285,5 +285,5 @@
 			Command cmd = createCommand(Main.ds.getSelected());
 			if (cmd != null)
-				Main.main.editLayer().add(cmd);
+				Main.main.undoRedo.add(cmd);
 		}
 		Main.ds.setSelected(Main.ds.getSelected()); // force update
Index: src/org/openstreetmap/josm/io/IncompleteDownloader.java
===================================================================
--- src/org/openstreetmap/josm/io/IncompleteDownloader.java	(revision 300)
+++ src/org/openstreetmap/josm/io/IncompleteDownloader.java	(revision 301)
@@ -77,5 +77,5 @@
 		}
 		if (cmds.size() > 0)
-			Main.main.editLayer().add(new SequenceCommand(tr("Fix data errors"), cmds));
+			Main.main.undoRedo.add(new SequenceCommand(tr("Fix data errors"), cmds));
 	}
 
