Index: trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 5452)
@@ -20,5 +20,4 @@
 
 import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.Main;
@@ -36,4 +35,5 @@
 import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.tools.Pair;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -224,9 +224,5 @@
                 }
             };
-            if (SwingUtilities.isEventDispatchThread()) {
-                guiTask.run();
-            } else {
-                SwingUtilities.invokeLater(guiTask);
-            }
+            GuiHelper.runInEDT(guiTask);
         }
     }
Index: trunk/src/org/openstreetmap/josm/actions/ValidateAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ValidateAction.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/actions/ValidateAction.java	(revision 5452)
@@ -11,6 +11,4 @@
 import java.util.List;
 
-import javax.swing.SwingUtilities;
-
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -21,4 +19,5 @@
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.preferences.ValidatorPreference;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.OsmTransferException;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -138,5 +137,5 @@
             // update GUI on Swing EDT
             //
-            Runnable r = new Runnable()  {
+            GuiHelper.runInEDT(new Runnable()  {
                 @Override
                 public void run() {
@@ -145,10 +144,5 @@
                     Main.main.getCurrentDataSet().fireSelectionChanged();
                 }
-            };
-            if (SwingUtilities.isEventDispatchThread()) {
-                r.run();
-            } else {
-                SwingUtilities.invokeLater(r);
-            }
+            });
         }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java	(revision 5452)
@@ -11,9 +11,8 @@
 import java.util.concurrent.CopyOnWriteArrayList;
 
-import javax.swing.SwingUtilities;
-
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 
 /**
@@ -65,5 +64,5 @@
 
     protected void fireChangesetCacheEvent(final ChangesetCacheEvent e) {
-        Runnable r = new Runnable() {
+        GuiHelper.runInEDT(new Runnable() {
             public void run() {
                 for(ChangesetCacheListener l: listeners) {
@@ -71,10 +70,5 @@
                 }
             }
-        };
-        if (SwingUtilities.isEventDispatchThread()) {
-            r.run();
-        } else {
-            SwingUtilities.invokeLater(r);
-        }
+        });
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java	(revision 5452)
@@ -6,9 +6,6 @@
 
 import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 import java.util.Set;
-
-import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.actions.AutoScaleAction;
@@ -25,4 +22,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.MultiFetchServerObjectReader;
 import org.openstreetmap.josm.io.OsmServerObjectReader;
@@ -82,5 +80,5 @@
             return;
         }
-        Runnable r = new Runnable() {
+        GuiHelper.runInEDTAndWait(new Runnable() {
             public void run() {
                 layer.mergeFrom(ds);
@@ -88,17 +86,5 @@
                 layer.onPostDownloadFromServer();
             }
-        };
-
-        if (SwingUtilities.isEventDispatchThread()) {
-            r.run();
-        } else {
-            try {
-                SwingUtilities.invokeAndWait(r);
-            } catch(InterruptedException e) {
-                e.printStackTrace();
-            } catch(InvocationTargetException e) {
-                e.printStackTrace();
-            }
-        }
+        });
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/io/UpdatePrimitivesTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/UpdatePrimitivesTask.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/gui/io/UpdatePrimitivesTask.java	(revision 5452)
@@ -23,4 +23,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.MultiFetchServerObjectReader;
 import org.openstreetmap.josm.io.OsmServerObjectReader;
@@ -80,22 +81,10 @@
             return;
         }
-        Runnable r = new Runnable() {
+        GuiHelper.runInEDTAndWait(new Runnable() {
             public void run() {
                 layer.mergeFrom(ds);
                 layer.onPostDownloadFromServer();
             }
-        };
-
-        if (SwingUtilities.isEventDispatchThread()) {
-            r.run();
-        } else {
-            try {
-                SwingUtilities.invokeAndWait(r);
-            } catch(InterruptedException e) {
-                e.printStackTrace();
-            } catch(InvocationTargetException e) {
-                e.printStackTrace();
-            }
-        }
+        });
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java	(revision 5452)
@@ -28,4 +28,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.ChangesetClosedException;
 import org.openstreetmap.josm.io.OsmApi;
@@ -316,5 +317,5 @@
         // - to the Upload Dialog
         // - to map editing
-        Runnable r = new Runnable() {
+        GuiHelper.runInEDT(new Runnable() {
             public void run() {
                 // if the changeset is still open after this upload we want it to
@@ -357,10 +358,5 @@
                 }
             }
-        };
-        if (SwingUtilities.isEventDispatchThread()) {
-            r.run();
-        } else {
-            SwingUtilities.invokeLater(r);
-        }
+        });
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java	(revision 5452)
@@ -24,5 +24,4 @@
 import javax.swing.JTabbedPane;
 import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
@@ -38,4 +37,5 @@
 import org.openstreetmap.josm.gui.SideButton;
 import org.openstreetmap.josm.gui.help.HelpUtil;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator;
 import org.openstreetmap.josm.gui.widgets.HtmlPanel;
@@ -519,9 +519,5 @@
             };
             e.printStackTrace();
-            if (SwingUtilities.isEventDispatchThread()) {
-                r.run();
-            } else {
-                SwingUtilities.invokeLater(r);
-            }
+            GuiHelper.runInEDT(r);
         }
 
@@ -552,15 +548,10 @@
                 getProgressMonitor().worked(1);
                 if (canceled)return;
-                Runnable r = new Runnable() {
+                GuiHelper.runInEDT(new Runnable() {
                     public void run() {
                         prepareUIForResultDisplay();
                         setAccessToken(accessToken);
                     }
-                };
-                if (SwingUtilities.isEventDispatchThread()) {
-                    r.run();
-                } else {
-                    SwingUtilities.invokeLater(r);
-                }
+                });
             } catch(final OsmOAuthAuthorizationException e) {
                 handleException(e);
Index: trunk/src/org/openstreetmap/josm/gui/progress/SwingRenderingProgressMonitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/progress/SwingRenderingProgressMonitor.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/gui/progress/SwingRenderingProgressMonitor.java	(revision 5452)
@@ -4,7 +4,6 @@
 import java.awt.Component;
 
-import javax.swing.SwingUtilities;
-
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
@@ -32,15 +31,7 @@
     }
 
-    private void doInEDT(Runnable runnable) {
-        if (SwingUtilities.isEventDispatchThread()) {
-            runnable.run();
-        } else {
-            SwingUtilities.invokeLater(runnable);
-        }
-    }
-
     @Override
     public void doBeginTask() {
-        doInEDT(new Runnable() {
+        GuiHelper.runInEDT(new Runnable() {
             public void run() {
                 delegate.setCustomText("");
@@ -60,5 +51,5 @@
         if (newValue != currentProgressValue) {
             currentProgressValue = newValue;
-            doInEDT(new Runnable() {
+            GuiHelper.runInEDT(new Runnable() {
                 public void run() {
                     delegate.setValue(currentProgressValue);
@@ -71,5 +62,5 @@
     protected void doSetCustomText(final String title) {
         checkState(State.IN_TASK, State.IN_SUBTASK);
-        doInEDT(new Runnable() {
+        GuiHelper.runInEDT(new Runnable() {
             public void run() {
                 delegate.setCustomText(title);
@@ -81,5 +72,5 @@
     protected void doSetTitle(final String title) {
         checkState(State.IN_TASK, State.IN_SUBTASK);
-        doInEDT(new Runnable() {
+        GuiHelper.runInEDT(new Runnable() {
             public void run() {
                 delegate.setTaskTitle(title);
@@ -90,5 +81,5 @@
     @Override
     protected void doSetIntermediate(final boolean value) {
-        doInEDT(new Runnable() {
+        GuiHelper.runInEDT(new Runnable() {
             public void run() {
                 delegate.setIndeterminate(value);
Index: trunk/src/org/openstreetmap/josm/io/NMEAImporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/NMEAImporter.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/io/NMEAImporter.java	(revision 5452)
@@ -9,5 +9,4 @@
 
 import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.Main;
@@ -17,4 +16,5 @@
 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 
 public class NMEAImporter extends FileImporter {
@@ -35,5 +35,5 @@
             final File fileFinal = file;
 
-            Runnable uiStuff = new Runnable() {
+            GuiHelper.runInEDT(new Runnable() {
                 public void run() {
                     Main.main.addLayer(gpxLayer);
@@ -45,10 +45,5 @@
                     }
                 }
-            };
-            if (SwingUtilities.isEventDispatchThread()) {
-                uiStuff.run();
-            } else {
-                SwingUtilities.invokeLater(uiStuff);
-            }
+            });
         }
         showNmeaInfobox(r.getNumberOfCoordinates() > 0, r);
Index: trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java	(revision 5451)
+++ trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java	(revision 5452)
@@ -11,5 +11,4 @@
 
 import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.Main;
@@ -19,4 +18,5 @@
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 
 public class OsmChangeImporter extends FileImporter {
@@ -60,5 +60,5 @@
         // FIXME: remove UI stuff from IO subsystem
         //
-        Runnable uiStuff = new Runnable() {
+        GuiHelper.runInEDT(new Runnable() {
             @Override
             public void run() {
@@ -73,10 +73,5 @@
                 layer.onPostLoadFromFile();
             }
-        };
-        if (SwingUtilities.isEventDispatchThread()) {
-            uiStuff.run();
-        } else {
-            SwingUtilities.invokeLater(uiStuff);
-        }
+        });
     }
 }
