Index: org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
===================================================================
--- org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 4057)
+++ org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(working copy)
@@ -199,6 +199,8 @@
         SelectionEventManager.getInstance().addSelectionListener(model, FireMode.IN_EDT_CONSOLIDATED);
         DatasetEventManager.getInstance().addDatasetListener(model, FireMode.IN_EDT);
         MapView.addEditLayerChangeListener(actSearch);
+        // editLayerChanged also gets the selection history of the level
+        model.editLayerChanged(null, Main.map.mapView.getEditLayer());
         if (Main.map.mapView.getEditLayer() != null) {
             model.setJOSMSelection(Main.map.mapView.getEditLayer().data.getSelected());
         }
@@ -221,9 +223,6 @@
         return arrowButton;
     }
 
-    public void clearSelectionHistory() {
-        model.clearSelectionHistory();
-    }
 
     /**
      * Responds to double clicks on the list of selected objects
@@ -481,7 +480,8 @@
 
         private static final int SELECTION_HISTORY_SIZE = 10;
 
-        private final LinkedList<Collection<? extends OsmPrimitive>> history = new LinkedList<Collection<? extends OsmPrimitive>>();
+        // Variable to store history from currentDataSet()
+        private LinkedList<Collection<? extends OsmPrimitive>> history;
         private final List<OsmPrimitive> selection = new ArrayList<OsmPrimitive>();
         private DefaultListSelectionModel selectionModel;
 
@@ -521,6 +521,7 @@
         public void remember(Collection<? extends OsmPrimitive> selection) {
             if (selection == null)return;
             if (selection.isEmpty())return;
+            if (history == null) return;
             if (history.isEmpty()) {
                 history.add(selection);
                 return;
@@ -548,10 +549,6 @@
             return history;
         }
 
-        public void clearSelectionHistory() {
-            history.clear();
-        }
-
         public Object getElementAt(int index) {
             return selection.get(index);
         }
@@ -689,7 +686,9 @@
         public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
             if (newLayer == null) {
                 setJOSMSelection(null);
+                history = null;
             } else {
+                history = newLayer.data.getSelectionHistory();
                 setJOSMSelection(newLayer.data.getSelected());
             }
         }
Index: org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- org/openstreetmap/josm/data/osm/DataSet.java	(revision 4057)
+++ org/openstreetmap/josm/data/osm/DataSet.java	(working copy)
@@ -133,6 +133,27 @@
     }
 
     /**
+     * History of selections - shared by plugins and SelectionListDialog
+     */
+    private final LinkedList<Collection<? extends OsmPrimitive>> selectionHistory = new LinkedList<Collection<? extends OsmPrimitive>>();
+
+    /**
+     * Replies the history of JOSM selections
+     *
+     * @return
+     */
+    public LinkedList<Collection<? extends OsmPrimitive>> getSelectionHistory() {
+        return selectionHistory;
+    } 
+
+    /**
+     * Clears selection history list
+     */
+    public void clearSelectionHistory() {
+            selectionHistory.clear();
+        }
+
+    /**
      * Maintain a list of used tags for autocompletion
      */
     private AutoCompletionManager autocomplete;
Index: org/openstreetmap/josm/actions/PurgeAction.java
===================================================================
--- org/openstreetmap/josm/actions/PurgeAction.java	(revision 4057)
+++ org/openstreetmap/josm/actions/PurgeAction.java	(working copy)
@@ -207,7 +207,7 @@
 
         if (cbClearUndoRedo.isSelected()) {
             Main.main.undoRedo.clean();
-            Main.map.selectionListDialog.clearSelectionHistory();
+            getCurrentDataSet().clearSelectionHistory();
         }
     }
 
