Index: trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java	(revision 18848)
+++ trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java	(revision 18849)
@@ -5,4 +5,5 @@
 
 import java.awt.Component;
+import java.awt.Dialog;
 import java.awt.GridBagLayout;
 import java.util.HashMap;
@@ -15,4 +16,6 @@
 import javax.swing.JPanel;
 import javax.swing.JRadioButton;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
 
 import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
@@ -24,5 +27,5 @@
  * ConditionalOptionPaneUtil provides static utility methods for displaying modal message dialogs
  * which can be enabled/disabled by the user.
- *
+ * <p>
  * They wrap the methods provided by {@link JOptionPane}. Within JOSM you should use these
  * methods rather than the bare methods from {@link JOptionPane} because the methods provided
@@ -93,11 +96,11 @@
      * It is always on top even if there are other open windows like detached dialogs,
      * relation editors, history browsers and the like.
-     *
+     * <p>
      * Set <code>optionType</code> to {@link JOptionPane#YES_NO_OPTION} for a dialog with a YES and
      * a NO button.
-
+     * <p>
      * Set <code>optionType</code> to {@link JOptionPane#YES_NO_CANCEL_OPTION} for a dialog with a YES,
      * a NO and a CANCEL button
-     *
+     * <p>
      * Returns one of the constants JOptionPane.YES_OPTION, JOptionPane.NO_OPTION,
      * JOptionPane.CANCEL_OPTION or JOptionPane.CLOSED_OPTION depending on the action chosen by
@@ -133,11 +136,11 @@
      * It is always on top even if there are other open windows like detached dialogs,
      * relation editors, history browsers and the like.
-     *
+     * <p>
      * Set <code>optionType</code> to {@link JOptionPane#YES_NO_OPTION} for a dialog with a YES and
      * a NO button.
-
+     * <p>
      * Set <code>optionType</code> to {@link JOptionPane#YES_NO_CANCEL_OPTION} for a dialog with a YES,
      * a NO and a CANCEL button
-     *
+     * <p>
      * 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
@@ -181,5 +184,5 @@
      * is always on top even if there are other open windows like detached dialogs,
      * relation editors, history browsers and the like.
-     *
+     * <p>
      * If there is a preference with key <code>preferenceKey</code> and value <code>false</code>
      * the dialog is not show.
@@ -284,4 +287,33 @@
             }
             add(cbStandard, GBC.eol());
+
+            this.addAncestorListener(new AncestorListener() {
+                boolean wasAlwaysOnTop;
+                @Override
+                public void ancestorAdded(AncestorEvent event) {
+                    if (event.getAncestor() instanceof Dialog) {
+                        Dialog dialog = (Dialog) event.getAncestor();
+                        wasAlwaysOnTop = dialog.isAlwaysOnTop();
+                        if (dialog.isVisible() && dialog.isModal()) {
+                            dialog.setAlwaysOnTop(true);
+                        }
+                    }
+                }
+
+                @Override
+                public void ancestorRemoved(AncestorEvent event) {
+                    if (event.getAncestor() instanceof Dialog) {
+                        Dialog dialog = (Dialog) event.getAncestor();
+                        if (dialog.isVisible() && dialog.isModal()) {
+                            dialog.setAlwaysOnTop(wasAlwaysOnTop);
+                        }
+                    }
+                }
+
+                @Override
+                public void ancestorMoved(AncestorEvent event) {
+                    // Do nothing
+                }
+            });
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 18848)
+++ trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 18849)
@@ -460,4 +460,7 @@
             }
         }
+        if (visible && isModal()) {
+            this.setAlwaysOnTop(true);
+        }
         super.setVisible(visible);
 
Index: trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java	(revision 18848)
+++ trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java	(revision 18849)
@@ -219,9 +219,9 @@
      * user clicks on the "Help" button the option dialog remains open and JOSM launches the help
      * browser.
-     *
+     * <p>
      * <code>helpTopic</code> is the trailing part of a JOSM online help URL, i.e. the part after the leading
-     * <code>https://josm.openstreetmap.de/wiki/Help</code>. It should start with a leading '/' and it
+     * {@code https://josm.openstreetmap.de/wiki/Help}. It should start with a leading '/' and it
      * may include an anchor after a '#'.
-     *
+     * <p>
      * <strong>Examples</strong>
      * <ul>
@@ -351,4 +351,7 @@
             HelpUtil.setHelpContext(dialog.getRootPane(), helpTopic);
         }
+        if (dialog.isModal()) {
+            dialog.setAlwaysOnTop(true);
+        }
         dialog.setVisible(true);
     }
@@ -372,5 +375,5 @@
      * Run it in Event Dispatch Thread.
      * This version does not return anything, so it is more like {@code showMessageDialog}.
-     *
+     * <p>
      * It can be used, when you need to show a message dialog from a worker thread,
      * e.g. from {@code PleaseWaitRunnable}.
