Index: trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- trunk/src/org/openstreetmap/josm/Main.java	(revision 2484)
+++ trunk/src/org/openstreetmap/josm/Main.java	(revision 2485)
@@ -70,5 +70,5 @@
 
 abstract public class Main {
-    
+
     /**
      * Replies true if JOSM currently displays a map view. False, if it doesn't, i.e. if
@@ -165,5 +165,4 @@
     public final void setMapFrame(final MapFrame map) {
         MapFrame old = Main.map;
-        Main.map = map;
         panel.setVisible(false);
         panel.removeAll();
@@ -176,4 +175,6 @@
         panel.setVisible(true);
         redoUndoListener.commandChanged(0,0);
+
+        Main.map = map;
 
         PluginHandler.setMapFrame(old, map);
@@ -414,7 +415,7 @@
             dialog.setVisible(true);
             switch(dialog.getUserAction()) {
-                case CANCEL: return false;
-                case PROCEED: return true;
-                default: return false;
+            case CANCEL: return false;
+            case PROCEED: return true;
+            default: return false;
             }
         }
@@ -481,7 +482,7 @@
         if (st.countTokens() == 4) {
             Bounds b = new Bounds(
-                   new LatLon(Double.parseDouble(st.nextToken()),Double.parseDouble(st.nextToken())),
-                   new LatLon(Double.parseDouble(st.nextToken()),Double.parseDouble(st.nextToken()))
-                   );
+                    new LatLon(Double.parseDouble(st.nextToken()),Double.parseDouble(st.nextToken())),
+                    new LatLon(Double.parseDouble(st.nextToken()),Double.parseDouble(st.nextToken()))
+            );
             try {
                 DownloadTask task = rawGps ? new DownloadGpsTask() : new DownloadOsmTask();
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2484)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2485)
@@ -654,8 +654,10 @@
         } else if (keys == null || keys.length == 0){
             keys = new String[] {key, value};
+            keysChangedImpl();
         } else {
             for (int i=0; i<keys.length;i+=2) {
                 if (keys[i].equals(key)) {
                     keys[i+1] = value;
+                    keysChangedImpl();
                     return;
                 }
@@ -669,4 +671,5 @@
             newKeys[keys.length + 1] = value;
             keys = newKeys;
+            keysChangedImpl();
         }
     }
@@ -682,4 +685,5 @@
         if (keys.length == 2) {
             keys = null;
+            keysChangedImpl();
             return;
         }
@@ -693,4 +697,5 @@
         }
         keys = newKeys;
+        keysChangedImpl();
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 2484)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 2485)
@@ -18,5 +18,4 @@
 import java.util.HashSet;
 import java.util.List;
-import java.util.logging.Logger;
 
 import javax.swing.AbstractAction;
@@ -62,5 +61,5 @@
  */
 public class RelationListDialog extends ToggleDialog implements LayerChangeListener, DataSetListener {
-    private static final Logger logger = Logger.getLogger(RelationListDialog.class.getName());
+    //private static final Logger logger = Logger.getLogger(RelationListDialog.class.getName());
 
     /** The display list. */
@@ -73,4 +72,5 @@
     /** the delete action */
     private DeleteAction deleteAction;
+    private NewAction newAction;
     /** the popup menu */
     private RelationDialogPopupMenu popupMenu;
@@ -101,6 +101,5 @@
         // the new action
         //
-        NewAction newAction = new NewAction();
-        Layer.listeners.add(newAction);
+        newAction = new NewAction();
         buttonPanel.add(new SideButton(newAction), GBC.std());
 
@@ -134,16 +133,22 @@
 
         popupMenu = new RelationDialogPopupMenu();
-
-        // register as layer listener
-        //
+    }
+
+    @Override public void showNotify() {
         Layer.listeners.add(this);
-    }
-
-    @Override public void setVisible(boolean b) {
-        super.setVisible(b);
-        if (b) {
-            updateList();
-        }
-    }
+        Layer.listeners.add(newAction);
+        for (OsmDataLayer layer:Main.map.mapView.getLayersOfType(OsmDataLayer.class)) {
+            layer.data.addDataSetListener(this);
+        }
+    }
+
+    @Override public void hideNotify() {
+        Layer.listeners.remove(this);
+        Layer.listeners.remove(newAction);
+        for (OsmDataLayer layer:Main.map.mapView.getLayersOfType(OsmDataLayer.class)) {
+            layer.data.removeDataSetListener(this);
+        }
+    }
+
 
     protected int getNumRelations() {
@@ -587,8 +592,4 @@
         public RelationListModel(DefaultListSelectionModel selectionModel) {
             this.selectionModel = selectionModel;
-        }
-
-        public ArrayList<Relation> getRelations() {
-            return relations;
         }
 
