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)
@@ -174,6 +174,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 +208,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,16 +237,10 @@
         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
      * @param selectedMembers
@@ -424,6 +421,15 @@
     }
 
     @Override
+    protected void buttonAction(ActionEvent evt) {
+        String a = evt.getActionCommand();
+        if(applyChangesText.equals(a))
+            applyChanges();
+
+        setVisible(false);
+    }
+
+    @Override
     protected Dimension findMaxDialogSize() {
         // FIXME: Make it remember dialog size
         return new Dimension(600, 500);
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)
@@ -27,11 +27,11 @@
     private int result = 0;
     private Component parent;
     private final String[] bTexts;
-    
+
     // For easy access when inherited
     protected Object contentConstraints = GBC.eol().anchor(GBC.CENTER).insets(5,10,5,0);
     protected ArrayList<JButton> buttons = new ArrayList<JButton>();
-    
+
     /**
      * Sets up the dialog. The first button is always the default.
      * @param parent The parent element that will be used for position and maximum size
@@ -39,113 +39,121 @@
      * @param content Any component that should be show above the buttons (e.g. JLabel)
      * @param buttonTexts The labels that will be displayed on the buttons
      * @param buttonIcons The path to the icons that will be displayed on the buttons. Path is relative to JOSM's image directory. File extensions need to be included. If a button should not have an icon pass null.
-     */ 
+     */
     public ExtendedDialog(Component parent, String title, Component content, String[] buttonTexts, String[] buttonIcons) {
-        super(JOptionPane.getFrameForComponent(parent), title, true);  
+        super(JOptionPane.getFrameForComponent(parent), title, true);
         this.parent = parent;
-        bTexts = buttonTexts;        
+        bTexts = buttonTexts;
         setupDialog(content, buttonIcons);
         setVisible(true);
     }
-    
+
     public ExtendedDialog(Component parent, String title, Component content, String[] buttonTexts) {
         this(parent, title, content, buttonTexts, null);
     }
-    
+
     /**
      * Sets up the dialog and displays the given message in a breakable label
      */
     public ExtendedDialog(Component parent, String title, String message, String[] buttonTexts, String[] buttonIcons) {
         super(JOptionPane.getFrameForComponent(parent), title, true);
-        
+
         JMultilineLabel lbl = new JMultilineLabel(message);
         // Make it not wider than 2/3 of the screen
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
         lbl.setMaxWidth(Math.round(screenSize.width*2/3));
-        
-        bTexts = buttonTexts;        
+
+        bTexts = buttonTexts;
         setupDialog(lbl, buttonIcons);
         setVisible(true);
     }
-    
+
     public ExtendedDialog(Component parent, String title, String message, String[] buttonTexts) {
         this(parent, title, message, buttonTexts, null);
     }
-    
+
     /**
      * Constructor that doesn't make the dialog visible immediately. Intended for when inheriting.
      */
     public ExtendedDialog(Component parent, String title, String[] buttonTexts, boolean modal) {
-        super(JOptionPane.getFrameForComponent(parent), title, modal);     
-        bTexts = buttonTexts;   
+        super(JOptionPane.getFrameForComponent(parent), title, modal);
+        bTexts = buttonTexts;
     }
-    
+
     protected void setupDialog(Component content, String[] buttonIcons) {
         setupEscListener();
-        
+
         JButton button;
         JPanel buttonsPanel = new JPanel(new GridBagLayout());
-        
+
         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);
                 }
             };
-            
-            button = new JButton(action);            
+
+            button = new JButton(action);
             if(buttonIcons != null && buttonIcons[i] != null)
                 button.setIcon(ImageProvider.get(buttonIcons[i]));
-            
-            if(i == 0) rootPane.setDefaultButton(button);           
+
+            if(i == 0) rootPane.setDefaultButton(button);
             buttonsPanel.add(button, GBC.std().insets(2,2,2,2));
             buttons.add(button);
         }
-        
-        JPanel cp = new JPanel(new GridBagLayout());        
+
+        JPanel cp = new JPanel(new GridBagLayout());
         cp.add(content, contentConstraints);
         cp.add(buttonsPanel, GBC.eol().anchor(GBC.CENTER).insets(5,5,5,5));
-        
+
         JScrollPane pane = new JScrollPane(cp);
-        pane.setBorder(null);        
+        pane.setBorder(null);
         setContentPane(pane);
-        
-        pack(); 
-        
+
+        pack();
+
         // Try to make it not larger than the parent window or at least not larger than 2/3 of the screen
         Dimension d = getSize();
         Dimension x = findMaxDialogSize();
-        
+
         boolean limitedInWidth = d.width > x.width;
         boolean limitedInHeight = d.height > x.height;
 
         if(x.width  > 0 && d.width  > x.width)  d.width  = x.width;
         if(x.height > 0 && d.height > x.height) d.height = x.height;
-        
+
         // We have a vertical scrollbar and enough space to prevent a horizontal one
         if(!limitedInWidth && limitedInHeight)
             d.width += new JScrollBar().getPreferredSize().width;
-        
+
         setSize(d);
         setLocationRelativeTo(parent);
     }
-    
+
     /**
-     * @return int The selected button. The count starts with 1. 
+     * @return int The selected button. The count starts with 1.
      *             A return value of 0 means the dialog has been closed otherwise.
-     */    
+     */
     public int getValue() {
         return result;
     }
-    
+
     /**
+     * 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
      */
@@ -159,19 +167,19 @@
         } catch(NullPointerException e) { }
         return x;
     }
-    
+
     /**
      * Makes the dialog listen to ESC keypressed
      */
     private void setupEscListener() {
-        Action actionListener = new AbstractAction() { 
-            public void actionPerformed(ActionEvent actionEvent) { 
+        Action actionListener = new AbstractAction() {
+            public void actionPerformed(ActionEvent actionEvent) {
                 setVisible(false);
-            } 
+            }
         };
-        
+
         rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
             .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE");
-        rootPane.getActionMap().put("ESCAPE", actionListener);        
+        rootPane.getActionMap().put("ESCAPE", actionListener);
     }
 }
\ No newline at end of file
