Index: trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java	(revision 2521)
+++ trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java	(revision 2522)
@@ -56,4 +56,25 @@
 
     /**
+     * Returns the preference value for the preference key "message." + <code>prefKey</code> + ".value".
+     * The default value if the preference key is missing is -1.
+     *
+     * @param  the preference key
+     * @return prefKey the preference value for the preference key "message." + <code>prefKey</code> + ".value"
+     */
+    public static Integer getDialogReturnValue(String prefKey) {
+        return Main.pref.getInteger("message."+prefKey+".value", -1);
+    }
+
+    /**
+     * sets the value for the preference key "message." + <code>prefKey</code> + ".value".
+     *
+     * @param prefKey the key
+     * @param value the value
+     */
+    public static void setDialogReturnValue(String prefKey, Integer value) {
+        Main.pref.putInteger("message."+prefKey+".value", value);
+    }
+
+    /**
      * Displays an confirmation dialog with some option buttons given by <code>optionType</code>.
      * It is always on top even if there are other open windows like detached dialogs,
@@ -89,5 +110,7 @@
         MessagePanel pnl = new MessagePanel(preferenceKey, message);
         int ret = JOptionPane.showOptionDialog(parent, pnl, title, optionType, messageType, null,options,defaultOption);
-        pnl.remeberDialogShowingEnabled();
+
+        if(!pnl.getDialogShowingEnabled())
+            setDialogShowingEnabled(preferenceKey, false);
         return ret;
     }
@@ -124,9 +147,12 @@
      */
     static public boolean showConfirmationDialog(String preferenceKey, Component parent, Object message, String title, int optionType, int messageType, int trueOption) throws HeadlessException {
-        if (!getDialogShowingEnabled(preferenceKey))
-            return true;
+        if (!getDialogShowingEnabled(preferenceKey) && (getDialogReturnValue(preferenceKey) >= 0))
+            return getDialogReturnValue(preferenceKey) == trueOption;
         MessagePanel pnl = new MessagePanel(preferenceKey, message);
         int ret = JOptionPane.showConfirmDialog(parent, pnl, title, optionType, messageType);
-        pnl.remeberDialogShowingEnabled();
+        if ((ret >= 0) && !pnl.getDialogShowingEnabled()) {
+            setDialogShowingEnabled(preferenceKey, false);
+            setDialogReturnValue(preferenceKey, ret);
+        }
         return ret == trueOption;
     }
@@ -155,5 +181,6 @@
         MessagePanel pnl = new MessagePanel(preferenceKey, message);
         JOptionPane.showMessageDialog(parent, pnl, title, messageType);
-        pnl.remeberDialogShowingEnabled();
+        if(!pnl.getDialogShowingEnabled())
+            setDialogShowingEnabled(preferenceKey, false);
     }
 
@@ -184,10 +211,6 @@
 
         public boolean getDialogShowingEnabled() {
-            return cbShowDialog.isSelected();
+            return !cbShowDialog.isSelected();
         }
-
-        public void remeberDialogShowingEnabled() {
-            ConditionalOptionPaneUtil.setDialogShowingEnabled(preferenceKey, !getDialogShowingEnabled());
-        }
     }
 }
