Index: /trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java	(revision 2928)
+++ /trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java	(revision 2929)
@@ -87,7 +87,7 @@
      * a NO and a CANCEL button
      *
-     * Replies true, if the selected option is equal to <code>trueOption</code>, otherwise false.
-     * Replies true, if the dialog is not displayed because the respective preference option
-     * <code>preferenceKey</code> is set to false.
+     * Returns one of the constants JOptionPane.YES_OPTION, JOptionPane.NO_OPTION,
+     * JOptionPane.CANCEL_OPTION or JOptionPane.CLOSED_OPTION depending on the action chosen by
+     * the user.
      *
      * @param preferenceKey the preference key
@@ -100,22 +100,22 @@
      * @param defaultOption the default option
      *
-     *
-     * @return the index of the selected option. {@see JOptionPane#CLOSED_OPTION} if the dialog was closed.
-     * {@see ConditionalOptionPaneUtil#DIALOG_DISABLED_OPTION} if the dialog is disabled.
-     *
+     * @return the option selected by user. {@see JOptionPane#CLOSED_OPTION} if the dialog was closed.
      */
     static public int showOptionDialog(String preferenceKey, Component parent, Object message, String title, int optionType, int messageType, Object [] options, Object defaultOption) throws HeadlessException {
-        if (!getDialogShowingEnabled(preferenceKey))
-            return DIALOG_DISABLED_OPTION;
+        int ret = getDialogReturnValue(preferenceKey);
+        if (!getDialogShowingEnabled(preferenceKey) && ((ret == JOptionPane.YES_OPTION) || (ret == JOptionPane.NO_OPTION)))
+            return ret;
         MessagePanel pnl = new MessagePanel(false, message);
-        int ret = JOptionPane.showOptionDialog(parent, pnl, title, optionType, messageType, null,options,defaultOption);
-
-        if(!pnl.getDialogShowingEnabled())
+        ret = JOptionPane.showOptionDialog(parent, pnl, title, optionType, messageType, null, options, defaultOption);
+
+        if (((ret == JOptionPane.YES_OPTION) || (ret == JOptionPane.NO_OPTION)) && !pnl.getDialogShowingEnabled()) {
             setDialogShowingEnabled(preferenceKey, false);
+            setDialogReturnValue(preferenceKey, ret);
+        }
         return ret;
     }
 
     /**
-     * Displays an confirmation dialog with some option buttons given by <code>optionType</code>.
+     * Displays a 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,
      * relation editors, history browsers and the like.
@@ -129,5 +129,6 @@
      * Replies true, if the selected option is equal to <code>trueOption</code>, otherwise false.
      * Replies true, if the dialog is not displayed because the respective preference option
-     * <code>preferenceKey</code> is set to false.
+     * <code>preferenceKey</code> is set to false and the user has previously chosen
+     * <code>trueOption</code>.
      *
      * @param preferenceKey the preference key
@@ -147,9 +148,10 @@
      */
     static public boolean showConfirmationDialog(String preferenceKey, Component parent, Object message, String title, int optionType, int messageType, int trueOption) throws HeadlessException {
-        if (!getDialogShowingEnabled(preferenceKey) && (getDialogReturnValue(preferenceKey) >= 0))
-            return getDialogReturnValue(preferenceKey) == trueOption;
+        int ret = getDialogReturnValue(preferenceKey);
+        if (!getDialogShowingEnabled(preferenceKey) && ((ret == JOptionPane.YES_OPTION) || (ret == JOptionPane.NO_OPTION)))
+            return ret == trueOption;
         MessagePanel pnl = new MessagePanel(false, message);
-        int ret = JOptionPane.showConfirmDialog(parent, pnl, title, optionType, messageType);
-        if ((ret >= 0) && !pnl.getDialogShowingEnabled()) {
+        ret = JOptionPane.showConfirmDialog(parent, pnl, title, optionType, messageType);
+        if (((ret == JOptionPane.YES_OPTION) || (ret == JOptionPane.NO_OPTION)) && !pnl.getDialogShowingEnabled()) {
             setDialogShowingEnabled(preferenceKey, false);
             setDialogReturnValue(preferenceKey, ret);
@@ -181,6 +183,7 @@
         MessagePanel pnl = new MessagePanel(false, message);
         JOptionPane.showMessageDialog(parent, pnl, title, messageType);
-        if(!pnl.getDialogShowingEnabled())
+        if(!pnl.getDialogShowingEnabled()) {
             setDialogShowingEnabled(preferenceKey, false);
+        }
     }
 
