Index: trunk/src/org/openstreetmap/josm/gui/MapView.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MapView.java	(revision 5217)
+++ trunk/src/org/openstreetmap/josm/gui/MapView.java	(revision 5219)
@@ -238,5 +238,5 @@
             }
         });
-        
+
         // Add Multipolygon cache to layer listeners
         addLayerChangeListener(MultipolygonCache.getInstance());
@@ -730,5 +730,5 @@
             AbstractButton button = e.nextElement();
             MapMode mode = (MapMode)button.getAction();
-            boolean isLayerSupported = mode.layerIsSupported(layer); 
+            boolean isLayerSupported = mode.layerIsSupported(layer);
             button.setEnabled(isLayerSupported);
             // Also update associated shortcut (fix #6876)
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java	(revision 5217)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java	(revision 5219)
@@ -3,4 +3,5 @@
 
 import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
 
 import java.awt.Component;
@@ -11,8 +12,11 @@
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
@@ -61,4 +65,5 @@
 import org.openstreetmap.josm.gui.SideButton;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
+import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintStyleLoader;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener;
 import org.openstreetmap.josm.gui.mappaint.StyleSource;
@@ -143,9 +148,9 @@
         selectionModel.addListSelectionListener(upAction);
         selectionModel.addListSelectionListener(downAction);
-        
+
         // Toggle style on Enter and Spacebar
         InputMapUtils.addEnterAction(tblStyles, onoffAction);
         InputMapUtils.addSpacebarAction(tblStyles, onoffAction);
-        
+
         createLayout(p, true, Arrays.asList(new SideButton[] {
                 new SideButton(onoffAction, false),
@@ -173,8 +178,77 @@
     }
 
+    /**
+     * Reload local styles when they have been changed in an external editor.
+     *
+     * Checks file modification time when an WindowEvent is invoked. Because
+     * any dialog window can get activated, when switching to another app and back,
+     * we have to register listeners to all windows in JOSM.
+     */
+    protected static class ReloadWindowListener extends WindowAdapter {
+
+        private static ReloadWindowListener INSTANCE;
+
+        public static ReloadWindowListener getInstance() {
+            if (INSTANCE == null) {
+                INSTANCE = new ReloadWindowListener();
+            }
+            return INSTANCE;
+        }
+
+        public static void setup() {
+            for (Window w : Window.getWindows()) {
+                if (w.isShowing()) {
+                    w.addWindowListener(getInstance());
+                }
+            }
+        }
+
+        public static void teardown() {
+            for (Window w : Window.getWindows()) {
+                w.removeWindowListener(getInstance());
+            }
+        }
+
+        @Override
+        public void windowActivated(WindowEvent e) {
+            if (e.getOppositeWindow() == null) { // we come from a native window, e.g. editor
+                // reload local styles, if necessary
+                List<StyleSource> toReload = new ArrayList<StyleSource>();
+                for (StyleSource s : MapPaintStyles.getStyles().getStyleSources()) {
+                    if (s.isLocal()) {
+                        File f = new File(s.url);
+                        long mtime = f.lastModified();
+                        if (mtime > s.getLastMTime()) {
+                            toReload.add(s);
+                            s.setLastMTime(mtime);
+                        }
+                    }
+                }
+                if (!toReload.isEmpty()) {
+                    System.out.println(trn("Reloading {0} map style.", "Reloading {0} map styles.", toReload.size(), toReload.size()));
+                    Main.worker.submit(new MapPaintStyleLoader(toReload));
+                }
+            }
+        }
+
+        @Override
+        public void windowDeactivated(WindowEvent e) {
+            // set up windows that have been created in the meantime
+            for (Window w : Window.getWindows()) {
+                w.removeWindowListener(getInstance());
+                if (w.isShowing()) {
+                    w.addWindowListener(getInstance());
+                }
+            }
+        }
+    }
+
     @Override
     public void showNotify() {
         MapPaintStyles.addMapPaintSylesUpdateListener(model);
         Main.main.menu.wireFrameToggleAction.addButtonModel(cbWireframe.getModel());
+        if (Main.pref.getBoolean("mappaint.auto_reload_local_styles", true)) {
+            ReloadWindowListener.setup();
+        }
     }
 
@@ -183,4 +257,7 @@
         Main.main.menu.wireFrameToggleAction.removeButtonModel(cbWireframe.getModel());
         MapPaintStyles.removeMapPaintSylesUpdateListener(model);
+        if (Main.pref.getBoolean("mappaint.auto_reload_local_styles", true)) {
+            ReloadWindowListener.teardown();
+        }
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java	(revision 5217)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java	(revision 5219)
@@ -50,3 +50,9 @@
         return text.hashCode();
     }
+
+    @Override
+    public String toString() {
+        return "LineTextElemStyle{" + super.toString() + "text=" + text + "}";
+    }
+
 }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 5217)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 5219)
@@ -4,4 +4,5 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -21,6 +22,6 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
 import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource;
+import org.openstreetmap.josm.gui.preferences.SourceEntry;
 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference.MapPaintPrefHelper;
-import org.openstreetmap.josm.gui.preferences.SourceEntry;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.io.MirroredInputStream;
@@ -165,6 +166,11 @@
         for (StyleSource source : styles.getStyleSources()) {
             source.loadStyleSource();
-        }
-
+            if (Main.pref.getBoolean("mappaint.auto_reload_local_styles", true)) {
+                if (source.isLocal()) {
+                    File f = new File(source.url);
+                    source.setLastMTime(f.lastModified());
+                }
+            }
+        }
         fireMapPaintSylesUpdated();
     }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java	(revision 5217)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java	(revision 5219)
@@ -26,4 +26,5 @@
 
     private ImageIcon imageIcon;
+    private long lastMTime = 0l;
 
     /******
@@ -31,5 +32,5 @@
      * of the source file.
      */
-    
+
     public String icon;
 
@@ -104,3 +105,13 @@
         return null;
     }
+
+    public long getLastMTime() {
+        return lastMTime;
+    }
+
+    public void setLastMTime(long lastMTime) {
+        this.lastMTime = lastMTime;
+    }
+
+
 }
