Index: applications/editors/josm/plugins/photo_geotagging/build.xml
===================================================================
--- applications/editors/josm/plugins/photo_geotagging/build.xml	(revision 24927)
+++ applications/editors/josm/plugins/photo_geotagging/build.xml	(revision 24928)
@@ -25,7 +25,7 @@
 
 	<!-- enter the SVN commit message -->
-	<property name="commit.message" value="applied patch by ax (JOSM ticket 5602) - photo_geotagging fails to write coordinates into image header on win32" />
+	<property name="commit.message" value="fixed josm bug 5800 - 'Override old backup files?' message window can't get focus" />
 	<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-	<property name="plugin.main.version" value="3408" />
+	<property name="plugin.main.version" value="3752" />
 
 
Index: applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java
===================================================================
--- applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java	(revision 24927)
+++ applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java	(revision 24928)
@@ -38,4 +38,5 @@
 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer;
 import org.openstreetmap.josm.gui.layer.geoimage.ImageEntry;
+import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -293,25 +294,33 @@
 
         private void confirm_override() {
-            if (override_backup == null) {
-                JLabel l = new JLabel(tr("<html><h3>There are old backup files in the image directory!</h3>"));
-                l.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
-                int override = new ExtendedDialog(
-                        Main.parent,
-                        tr("Override old backup files?"),
-                        new String[] {tr("Cancel"), tr("Keep old backups and continue"), tr("Override")})
-                    .setButtonIcons(new String[] {"cancel.png", "ok.png", "dialogs/delete.png"})
-                    .setContent(l)
-                    .setCancelButton(1)
-                    .setDefaultButton(2)
-                    .showDialog()
-                    .getValue();
-                if (override == 2) {
-                    override_backup = false;
-                } else if (override == 3) {
-                    override_backup = true;
-                } else {
-                    cancelled = true;
-                    return;
-                }
+            if (override_backup != null)
+                return;
+            try {
+                SwingUtilities.invokeAndWait(new Runnable() {
+                    public void run() {
+                        JLabel l = new JLabel(tr("<html><h3>There are old backup files in the image directory!</h3>"));
+                        l.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
+                        int override = new ExtendedDialog(
+                                ((PleaseWaitProgressMonitor) progressMonitor).getDialog(),
+                                tr("Override old backup files?"),
+                                new String[] {tr("Cancel"), tr("Keep old backups and continue"), tr("Override")})
+                            .setButtonIcons(new String[] {"cancel.png", "ok.png", "dialogs/delete.png"})
+                            .setContent(l)
+                            .setCancelButton(1)
+                            .setDefaultButton(2)
+                            .showDialog()
+                            .getValue();
+                        if (override == 2) {
+                            override_backup = false;
+                        } else if (override == 3) {
+                            override_backup = true;
+                        } else {
+                            cancelled = true;
+                        }
+                    }
+                });
+            } catch (Exception e) {
+                System.err.println(e);
+                cancelled = true;
             }
         }
