Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java	(revision 3824)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java	(revision 3825)
@@ -79,7 +79,7 @@
             if (osm.mappaintStyle.equals(StyleCache.EMPTY_STYLECACHE)) {
                 if(osm instanceof Node)
-                    osm.mappaintStyle = StyleCache.SIMPLE_NODE_STYLECACHE;// SimpleNodeElemStyle.INSTANCE;
+                    osm.mappaintStyle = StyleCache.SIMPLE_NODE_STYLECACHE;
                 else if (osm instanceof Way)
-                    osm.mappaintStyle = StyleCache.UNTAGGED_WAY_STYLECACHE;//LineElemStyle.UNTAGGED_WAY;
+                    osm.mappaintStyle = StyleCache.UNTAGGED_WAY_STYLECACHE;
             }
         }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java	(revision 3824)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java	(revision 3825)
@@ -55,5 +55,5 @@
     public void initialize() throws Exception {
         styles = MapPaintStyles.getStyles();
-}
+    }
 
     private List<List<Node>> joinWays(Collection<Way> ways) {
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 3824)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 3825)
@@ -6,6 +6,4 @@
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
@@ -20,27 +18,27 @@
 import org.openstreetmap.josm.gui.mappaint.xml.LinePrototype;
 import org.openstreetmap.josm.gui.mappaint.xml.LinemodPrototype;
-import org.openstreetmap.josm.gui.mappaint.xml.Prototype;
+import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource;
 import org.openstreetmap.josm.tools.FilteredCollection;
 import org.openstreetmap.josm.tools.Predicate;
 
 public class ElemStyles {
-    private List<StyleSource> styleSources;
+    private List<XmlStyleSource> styleSources;
 
     public ElemStyles()
     {
-        styleSources = new ArrayList<StyleSource>();
+        styleSources = new ArrayList<XmlStyleSource>();
     }
 
-    public void add(StyleSource style) {
+    public void add(XmlStyleSource style) {
         styleSources.add(style);
     }
 
-    public Collection<StyleSource> getStyleSources() {
-        return new FilteredCollection<StyleSource>(styleSources, new Predicate<StyleSource>() {
+    public Collection<XmlStyleSource> getStyleSources() {
+        return new FilteredCollection<XmlStyleSource>(styleSources, new Predicate<XmlStyleSource>() {
 
             String name = Main.pref.get("mappaint.style", "standard");
 
             @Override
-            public boolean evaluate(StyleSource s) {
+            public boolean evaluate(XmlStyleSource s) {
                 return equal(s.getPrefName(), name);
             }
@@ -50,7 +48,7 @@
 
     public static class WayPrototypesRecord {
-        LinePrototype line;
-        List<LinemodPrototype> linemods;
-        AreaPrototype area;
+        public LinePrototype line;
+        public List<LinemodPrototype> linemods;
+        public AreaPrototype area;
 
         public List<ElemStyle> createStyles() {
@@ -97,5 +95,5 @@
     public IconPrototype getNode(OsmPrimitive osm) {
         IconPrototype icon = null;
-        for (StyleSource s : getStyleSources()) {
+        for (XmlStyleSource s : getStyleSources()) {
             icon = s.getNode(osm, icon);
         }
@@ -105,5 +103,5 @@
     private WayPrototypesRecord get(OsmPrimitive osm, boolean forceArea) {
         WayPrototypesRecord p = new WayPrototypesRecord();
-        for (StyleSource s : getStyleSources()) {
+        for (XmlStyleSource s : getStyleSources()) {
             s.get(osm, forceArea || !(osm instanceof Way) || ((Way) osm).isClosed(), p);
         }
@@ -112,5 +110,5 @@
 
     public boolean hasAreas() {
-        for (StyleSource s : getStyleSources()) {
+        for (XmlStyleSource s : getStyleSources()) {
             if (s.hasAreas())
                 return true;
@@ -120,5 +118,5 @@
 
     public boolean isArea(OsmPrimitive osm) {
-        for (StyleSource s : getStyleSources()) {
+        for (XmlStyleSource s : getStyleSources()) {
             if (s.isArea(osm))
                 return true;
@@ -160,5 +158,5 @@
         Set<String> names = new HashSet<String>();
         names.add("standard");
-        for (StyleSource s : styleSources) {
+        for (XmlStyleSource s : styleSources) {
             if (s.name != null) {
                 names.add(s.name);
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 3824)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 3825)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.mappaint;
 
+import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource;
 import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSourceHandler;
 import static org.openstreetmap.josm.tools.I18n.tr;
@@ -77,5 +78,5 @@
 
         for (SourceEntry entry : sourceEntries) {
-            StyleSource style = new StyleSource(entry);
+            XmlStyleSource style = new XmlStyleSource(entry);
             try {
                 XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(style));
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java	(revision 3824)
+++ 	(revision )
@@ -1,241 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmUtils;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.mappaint.ElemStyles.WayPrototypesRecord;
-import org.openstreetmap.josm.gui.mappaint.xml.AreaPrototype;
-import org.openstreetmap.josm.gui.mappaint.xml.IconPrototype;
-import org.openstreetmap.josm.gui.mappaint.xml.LinePrototype;
-import org.openstreetmap.josm.gui.mappaint.xml.LinemodPrototype;
-import org.openstreetmap.josm.gui.mappaint.xml.Prototype;
-import org.openstreetmap.josm.gui.mappaint.xml.XmlCondition;
-import org.openstreetmap.josm.gui.preferences.SourceEntry;
-
-public class StyleSource extends SourceEntry {
-
-    public final HashMap<String, IconPrototype> icons = new HashMap<String, IconPrototype>();
-    public final HashMap<String, LinePrototype> lines = new HashMap<String, LinePrototype>();
-    public final HashMap<String, LinemodPrototype> modifiers = new HashMap<String, LinemodPrototype>();
-    public final HashMap<String, AreaPrototype> areas = new HashMap<String, AreaPrototype>();
-    public final LinkedList<IconPrototype> iconsList = new LinkedList<IconPrototype>();
-    public final LinkedList<LinePrototype> linesList = new LinkedList<LinePrototype>();
-    public final LinkedList<LinemodPrototype> modifiersList = new LinkedList<LinemodPrototype>();
-    public final LinkedList<AreaPrototype> areasList = new LinkedList<AreaPrototype>();
-
-    public boolean hasError = false;
-
-    public StyleSource(String url, String name, String shortdescription) {
-        super(url, name, shortdescription, true);
-    }
-
-    public StyleSource(SourceEntry entry) {
-        super(entry.url, entry.name, entry.shortdescription, entry.active);
-    }
-
-    public IconPrototype getNode(OsmPrimitive primitive, IconPrototype icon) {
-        for (String key : primitive.keySet()) {
-            String val = primitive.get(key);
-            IconPrototype style;
-            if ((style = icons.get("n" + key + "=" + val)) != null) {
-                if (icon == null || style.priority >= icon.priority) {
-                    icon = style;
-                }
-            }
-            if ((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null) {
-                if (icon == null || style.priority >= icon.priority) {
-                    icon = style;
-                }
-            }
-            if ((style = icons.get("x" + key)) != null) {
-                if (icon == null || style.priority >= icon.priority) {
-                    icon = style;
-                }
-            }
-        }
-        for (IconPrototype s : iconsList) {
-            if ((icon == null || s.priority >= icon.priority) && s.check(primitive)) {
-                icon = s;
-            }
-        }
-        return icon;
-    }
-
-    /**
-     * @param closed The primitive is a closed way or we pretend it is closed.
-     *  This is useful for multipolygon relations and outer ways of untagged
-     *  multipolygon relations.
-     */
-    public void get(OsmPrimitive primitive, boolean closed, WayPrototypesRecord p) {
-        String lineIdx = null;
-        HashMap<String, LinemodPrototype> overlayMap = new HashMap<String, LinemodPrototype>();
-        for (String key : primitive.keySet()) {
-            String val = primitive.get(key);
-            AreaPrototype styleArea;
-            LinePrototype styleLine;
-            LinemodPrototype styleLinemod;
-            String idx = "n" + key + "=" + val;
-            if ((styleArea = areas.get(idx)) != null && (p.area == null || styleArea.priority >= p.area.priority) && (closed || !styleArea.closed)) {
-                p.area = styleArea;
-            }
-            if ((styleLine = lines.get(idx)) != null && (p.line == null || styleLine.priority >= p.line.priority)) {
-                p.line = styleLine;
-                lineIdx = idx;
-            }
-            if ((styleLinemod = modifiers.get(idx)) != null) {
-                overlayMap.put(idx, styleLinemod);
-            }
-            idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
-            if ((styleArea = areas.get(idx)) != null && (p.area == null || styleArea.priority >= p.area.priority) && (closed || !styleArea.closed)) {
-                p.area = styleArea;
-            }
-            if ((styleLine = lines.get(idx)) != null && (p.line == null || styleLine.priority >= p.line.priority)) {
-                p.line = styleLine;
-                lineIdx = idx;
-            }
-            if ((styleLinemod = modifiers.get(idx)) != null) {
-                overlayMap.put(idx, styleLinemod);
-            }
-            idx = "x" + key;
-            if ((styleArea = areas.get(idx)) != null && (p.area == null || styleArea.priority >= p.area.priority) && (closed || !styleArea.closed)) {
-                p.area = styleArea;
-            }
-            if ((styleLine = lines.get(idx)) != null && (p.line == null || styleLine.priority >= p.line.priority)) {
-                p.line = styleLine;
-                lineIdx = idx;
-            }
-            if ((styleLinemod = modifiers.get(idx)) != null) {
-                overlayMap.put(idx, styleLinemod);
-            }
-        }
-        for (AreaPrototype s : areasList) {
-            if ((p.area == null || s.priority >= p.area.priority) && (closed || !s.closed) && s.check(primitive)) {
-                p.area = s;
-            }
-        }
-        for (LinePrototype s : linesList) {
-            if ((p.line == null || s.priority >= p.line.priority) && s.check(primitive)) {
-                p.line = s;
-            }
-        }
-        for (LinemodPrototype s : modifiersList) {
-            if (s.check(primitive)) {
-                overlayMap.put(s.getCode(), s);
-            }
-        }
-        overlayMap.remove(lineIdx); // do not use overlay if linestyle is from the same rule (example: railway=tram)
-        if (!overlayMap.isEmpty() && p.line != null) {
-            List<LinemodPrototype> tmp = new LinkedList<LinemodPrototype>();
-            if (p.linemods != null) {
-                tmp.addAll(p.linemods);
-            }
-            tmp.addAll(overlayMap.values());
-            Collections.sort(tmp);
-            p.linemods = tmp;
-        }
-    }
-
-    public boolean isArea(OsmPrimitive o) {
-        if (o.hasKeys() && !(o instanceof Node)) {
-            boolean noclosed = o instanceof Way && !((Way) o).isClosed();
-            Iterator<String> iterator = o.keySet().iterator();
-            while (iterator.hasNext()) {
-                String key = iterator.next();
-                String val = o.get(key);
-                AreaPrototype s = areas.get("n" + key + "=" + val);
-                if (s == null || (s.closed && noclosed)) {
-                    s = areas.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val));
-                }
-                if (s == null || (s.closed && noclosed)) {
-                    s = areas.get("x" + key);
-                }
-                if (s != null && !(s.closed && noclosed)) {
-                    return true;
-                }
-            }
-            for (AreaPrototype s : areasList) {
-                if (!(s.closed && noclosed) && s.check(o)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public boolean hasAreas() {
-        return areas.size() > 0;
-    }
-
-    public void add(XmlCondition c, Collection<XmlCondition> conditions, Prototype prot) {
-         if(conditions != null)
-         {
-            prot.conditions = conditions;
-            if (prot instanceof IconPrototype) {
-                iconsList.add((IconPrototype) prot);
-            } else if (prot instanceof LinemodPrototype) {
-                modifiersList.add((LinemodPrototype) prot);
-            } else if (prot instanceof LinePrototype) {
-                linesList.add((LinePrototype) prot);
-            } else if (prot instanceof AreaPrototype) {
-                areasList.add((AreaPrototype) prot);
-            } else
-                throw new RuntimeException();
-         }
-         else {
-             String key = c.getKey();
-            prot.code = key;
-            if (prot instanceof IconPrototype) {
-                icons.put(key, (IconPrototype) prot);
-            } else if (prot instanceof LinemodPrototype) {
-               modifiers.put(key, (LinemodPrototype) prot);
-            } else if (prot instanceof LinePrototype) {
-                lines.put(key, (LinePrototype) prot);
-            } else if (prot instanceof AreaPrototype) {
-                areas.put(key, (AreaPrototype) prot);
-            } else
-                throw new RuntimeException();
-         }
-     }
-
-    /**
-     * the name / identifier that should be used to save custom color values
-     * and similar stuff to the preference file
-     * @return the identifier; never null. Usually the result is "standard"
-     */
-    public String getPrefName() {
-        return name == null ? "standard" : name;
-    }
-
-    /**
-     * String to show in menus and error messages.
-     * @return Usually the shortdescription, but can be the file name
-     * if no shortdescription is available.
-     */
-    public String getDisplayString() {
-        if (shortdescription != null)
-            return shortdescription;
-        /**
-         * extract file part from url, e.g.:
-         * http://www.test.com/file.xml?format=text  --> file.xml
-         */
-        Pattern p = Pattern.compile("([^/\\\\]*?)([?].*)?$");
-        Matcher m = p.matcher(url);
-        if (m.find()) {
-            return m.group(1);
-        } else {
-            System.err.println("Warning: Unexpected URL format: "+url);
-            return url;
-        }
-    }
-}
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(revision 3825)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(revision 3825)
@@ -0,0 +1,211 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.mappaint.xml;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmUtils;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.mappaint.ElemStyles.WayPrototypesRecord;
+import org.openstreetmap.josm.gui.preferences.SourceEntry;
+
+public class XmlStyleSource extends SourceEntry {
+
+    public final HashMap<String, IconPrototype> icons = new HashMap<String, IconPrototype>();
+    public final HashMap<String, LinePrototype> lines = new HashMap<String, LinePrototype>();
+    public final HashMap<String, LinemodPrototype> modifiers = new HashMap<String, LinemodPrototype>();
+    public final HashMap<String, AreaPrototype> areas = new HashMap<String, AreaPrototype>();
+    public final LinkedList<IconPrototype> iconsList = new LinkedList<IconPrototype>();
+    public final LinkedList<LinePrototype> linesList = new LinkedList<LinePrototype>();
+    public final LinkedList<LinemodPrototype> modifiersList = new LinkedList<LinemodPrototype>();
+    public final LinkedList<AreaPrototype> areasList = new LinkedList<AreaPrototype>();
+
+    public boolean hasError = false;
+
+    public XmlStyleSource(String url, String name, String shortdescription) {
+        super(url, name, shortdescription, true);
+    }
+
+    public XmlStyleSource(SourceEntry entry) {
+        super(entry.url, entry.name, entry.shortdescription, entry.active);
+    }
+
+    public IconPrototype getNode(OsmPrimitive primitive, IconPrototype icon) {
+        for (String key : primitive.keySet()) {
+            String val = primitive.get(key);
+            IconPrototype style;
+            if ((style = icons.get("n" + key + "=" + val)) != null) {
+                if (icon == null || style.priority >= icon.priority) {
+                    icon = style;
+                }
+            }
+            if ((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null) {
+                if (icon == null || style.priority >= icon.priority) {
+                    icon = style;
+                }
+            }
+            if ((style = icons.get("x" + key)) != null) {
+                if (icon == null || style.priority >= icon.priority) {
+                    icon = style;
+                }
+            }
+        }
+        for (IconPrototype s : iconsList) {
+            if ((icon == null || s.priority >= icon.priority) && s.check(primitive)) {
+                icon = s;
+            }
+        }
+        return icon;
+    }
+
+    /**
+     * @param closed The primitive is a closed way or we pretend it is closed.
+     *  This is useful for multipolygon relations and outer ways of untagged
+     *  multipolygon relations.
+     */
+    public void get(OsmPrimitive primitive, boolean closed, WayPrototypesRecord p) {
+        String lineIdx = null;
+        HashMap<String, LinemodPrototype> overlayMap = new HashMap<String, LinemodPrototype>();
+        for (String key : primitive.keySet()) {
+            String val = primitive.get(key);
+            AreaPrototype styleArea;
+            LinePrototype styleLine;
+            LinemodPrototype styleLinemod;
+            String idx = "n" + key + "=" + val;
+            if ((styleArea = areas.get(idx)) != null && (p.area == null || styleArea.priority >= p.area.priority) && (closed || !styleArea.closed)) {
+                p.area = styleArea;
+            }
+            if ((styleLine = lines.get(idx)) != null && (p.line == null || styleLine.priority >= p.line.priority)) {
+                p.line = styleLine;
+                lineIdx = idx;
+            }
+            if ((styleLinemod = modifiers.get(idx)) != null) {
+                overlayMap.put(idx, styleLinemod);
+            }
+            idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
+            if ((styleArea = areas.get(idx)) != null && (p.area == null || styleArea.priority >= p.area.priority) && (closed || !styleArea.closed)) {
+                p.area = styleArea;
+            }
+            if ((styleLine = lines.get(idx)) != null && (p.line == null || styleLine.priority >= p.line.priority)) {
+                p.line = styleLine;
+                lineIdx = idx;
+            }
+            if ((styleLinemod = modifiers.get(idx)) != null) {
+                overlayMap.put(idx, styleLinemod);
+            }
+            idx = "x" + key;
+            if ((styleArea = areas.get(idx)) != null && (p.area == null || styleArea.priority >= p.area.priority) && (closed || !styleArea.closed)) {
+                p.area = styleArea;
+            }
+            if ((styleLine = lines.get(idx)) != null && (p.line == null || styleLine.priority >= p.line.priority)) {
+                p.line = styleLine;
+                lineIdx = idx;
+            }
+            if ((styleLinemod = modifiers.get(idx)) != null) {
+                overlayMap.put(idx, styleLinemod);
+            }
+        }
+        for (AreaPrototype s : areasList) {
+            if ((p.area == null || s.priority >= p.area.priority) && (closed || !s.closed) && s.check(primitive)) {
+                p.area = s;
+            }
+        }
+        for (LinePrototype s : linesList) {
+            if ((p.line == null || s.priority >= p.line.priority) && s.check(primitive)) {
+                p.line = s;
+            }
+        }
+        for (LinemodPrototype s : modifiersList) {
+            if (s.check(primitive)) {
+                overlayMap.put(s.getCode(), s);
+            }
+        }
+        overlayMap.remove(lineIdx); // do not use overlay if linestyle is from the same rule (example: railway=tram)
+        if (!overlayMap.isEmpty() && p.line != null) {
+            List<LinemodPrototype> tmp = new LinkedList<LinemodPrototype>();
+            if (p.linemods != null) {
+                tmp.addAll(p.linemods);
+            }
+            tmp.addAll(overlayMap.values());
+            Collections.sort(tmp);
+            p.linemods = tmp;
+        }
+    }
+
+    public boolean isArea(OsmPrimitive o) {
+        if (o.hasKeys() && !(o instanceof Node)) {
+            boolean noclosed = o instanceof Way && !((Way) o).isClosed();
+            Iterator<String> iterator = o.keySet().iterator();
+            while (iterator.hasNext()) {
+                String key = iterator.next();
+                String val = o.get(key);
+                AreaPrototype s = areas.get("n" + key + "=" + val);
+                if (s == null || (s.closed && noclosed)) {
+                    s = areas.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val));
+                }
+                if (s == null || (s.closed && noclosed)) {
+                    s = areas.get("x" + key);
+                }
+                if (s != null && !(s.closed && noclosed)) {
+                    return true;
+                }
+            }
+            for (AreaPrototype s : areasList) {
+                if (!(s.closed && noclosed) && s.check(o)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public boolean hasAreas() {
+        return areas.size() > 0;
+    }
+
+    public void add(XmlCondition c, Collection<XmlCondition> conditions, Prototype prot) {
+         if(conditions != null)
+         {
+            prot.conditions = conditions;
+            if (prot instanceof IconPrototype) {
+                iconsList.add((IconPrototype) prot);
+            } else if (prot instanceof LinemodPrototype) {
+                modifiersList.add((LinemodPrototype) prot);
+            } else if (prot instanceof LinePrototype) {
+                linesList.add((LinePrototype) prot);
+            } else if (prot instanceof AreaPrototype) {
+                areasList.add((AreaPrototype) prot);
+            } else
+                throw new RuntimeException();
+         }
+         else {
+             String key = c.getKey();
+            prot.code = key;
+            if (prot instanceof IconPrototype) {
+                icons.put(key, (IconPrototype) prot);
+            } else if (prot instanceof LinemodPrototype) {
+               modifiers.put(key, (LinemodPrototype) prot);
+            } else if (prot instanceof LinePrototype) {
+                lines.put(key, (LinePrototype) prot);
+            } else if (prot instanceof AreaPrototype) {
+                areas.put(key, (AreaPrototype) prot);
+            } else
+                throw new RuntimeException();
+         }
+     }
+
+    /**
+     * the name / identifier that should be used to save custom color values
+     * and similar stuff to the preference file
+     * @return the identifier; never null. Usually the result is "standard"
+     */
+    public String getPrefName() {
+        return name == null ? "standard" : name;
+    }
+}
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java	(revision 3824)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java	(revision 3825)
@@ -10,5 +10,4 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
-import org.openstreetmap.josm.gui.mappaint.StyleSource;
 import org.openstreetmap.josm.tools.ColorHelper;
 import org.xml.sax.Attributes;
@@ -21,5 +20,5 @@
     private RuleElem rule = new RuleElem();
 
-    StyleSource style;
+    XmlStyleSource style;
 
     static class RuleElem {
@@ -45,5 +44,5 @@
     }
 
-    public XmlStyleSourceHandler(StyleSource style) {
+    public XmlStyleSourceHandler(XmlStyleSource style) {
         this.style = style;
         inDoc=inRule=inCondition=inLine=inIcon=inArea=false;
Index: trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java	(revision 3824)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java	(revision 3825)
@@ -1,3 +1,7 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.gui.preferences;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import static org.openstreetmap.josm.tools.Utils.equal;
@@ -70,4 +74,25 @@
     }
 
+    /**
+     * String to show in menus and error messages.
+     * @return Usually the shortdescription, but can be the file name
+     * if no shortdescription is available.
+     */
+    public String getDisplayString() {
+        if (shortdescription != null)
+            return shortdescription;
+        /**
+         * extract file part from url, e.g.:
+         * http://www.test.com/file.xml?format=text  --> file.xml
+         */
+        Pattern p = Pattern.compile("([^/\\\\]*?)([?].*)?$");
+        Matcher m = p.matcher(url);
+        if (m.find()) {
+            return m.group(1);
+        } else {
+            System.err.println("Warning: Unexpected URL format: "+url);
+            return url;
+        }
+    }
 
 }
