Index: src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java	(revision 1431)
+++ src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java	(working copy)
@@ -9,6 +9,8 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
 import java.io.IOException;
 import java.text.Collator;
 import java.util.ArrayList;
@@ -18,6 +20,8 @@
 import java.util.Comparator;
 import java.util.Map.Entry;
 
+import javax.swing.AbstractAction;
+import javax.swing.Action;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
@@ -25,6 +29,7 @@
 import javax.swing.JTabbedPane;
 import javax.swing.JTable;
 import javax.swing.ListSelectionModel;
+import javax.swing.WindowConstants;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
 import javax.swing.event.TableModelEvent;
@@ -174,6 +179,9 @@
     // =================== FIXME FIXME FIXME =====================
     // ... until here, and also get rid of the "Collections.sort..." below.
 
+    // We need this twice, so cache result
+    protected final static String applyChangesText = tr("Apply Changes");
+    
     /**
      * Creates a new relation editor for the given relation. The relation
      * will be saved if the user selects "ok" in the editor.
@@ -205,13 +213,13 @@
                             ? tr ("Edit new relation")
                             : tr("Edit relation #{0}", relation.id)
                        ),
-                new String[] { tr("Apply Changes"), tr("Cancel")},
+                new String[] { applyChangesText, tr("Cancel")},
                 false
         );
 
         this.relation = relation;
         ordered = !Main.pref.get("osm-server.version", "0.5").equals("0.5");
-ordered = true;
+
         if (relation == null) {
             // create a new relation
             this.clone = new Relation();
@@ -234,15 +242,9 @@
         setSize(findMaxDialogSize());
 
         try { setAlwaysOnTop(true); } catch (SecurityException sx) {}
-
         setVisible(true);
-
-        if(getValue() != 1)
-            return;
-
-        // User clicked "Apply"
-        applyChanges();
     }
+    
 
     /**
      * Basic Editor panel has two blocks: a tag table at the top and a membership list below
@@ -422,6 +424,15 @@
             DataSet.fireSelectionChanged(Main.ds.getSelected());
         }
     }
+    
+    @Override
+    protected void buttonAction(ActionEvent evt) {
+        String a = evt.getActionCommand();
+        if(applyChangesText.equals(a))
+            applyChanges();
+            
+        setVisible(false);
+    }
 
     @Override
     protected Dimension findMaxDialogSize() {
Index: src/org/openstreetmap/josm/gui/ExtendedDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 1431)
+++ src/org/openstreetmap/josm/gui/ExtendedDialog.java	(working copy)
@@ -89,14 +89,7 @@
         for(int i=0; i < bTexts.length; i++) {
             Action action = new AbstractAction(bTexts[i]) {
                 public void actionPerformed(ActionEvent evt) {
-                    String a = evt.getActionCommand();
-                    for(int i=0; i < bTexts.length; i++)
-                        if(bTexts[i].equals(a)) {
-                            result = i+1;
-                            break;
-                        }
-                        
-                    setVisible(false);
+                    buttonAction(evt);
                 }
             };
             
@@ -146,6 +139,21 @@
     }
     
     /**
+     * This gets performed whenever a button is clicked or activated
+     * @param evt the button event
+     */
+    protected void buttonAction(ActionEvent evt) {
+        String a = evt.getActionCommand();
+        for(int i=0; i < bTexts.length; i++)
+            if(bTexts[i].equals(a)) {
+                result = i+1;
+                break;
+            }
+            
+        setVisible(false);
+    }
+    
+    /**
      * Tries to find a good value of how large the dialog should be
      * @return Dimension Size of the parent Component or 2/3 of screen size if not available
      */
