Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 3826)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 3827)
@@ -23,4 +23,5 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.XmlObjectParser;
+import org.openstreetmap.josm.tools.Utils;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
@@ -30,5 +31,4 @@
     private static ElemStyles styles = new ElemStyles();
     private static Collection<String> iconDirs;
-    private static File zipIcons;
 
     public static ElemStyles getStyles()
@@ -36,7 +36,19 @@
         return styles;
     }
+    
+    public static class IconReference {
 
-    public static ImageIcon getIcon(String name, String styleName)
+        public String iconName;
+        public XmlStyleSource source;
+
+        public IconReference(String iconName, XmlStyleSource source) {
+            this.iconName = iconName;
+            this.source = source;
+        }
+    }
+
+    public static ImageIcon getIcon(IconReference ref)
     {
+        String styleName = ref.source.getPrefName();
         List<String> dirs = new LinkedList<String>();
         for(String fileset : iconDirs)
@@ -54,8 +66,8 @@
             }
         }
-        ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, name, zipIcons);
+        ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, ref.iconName, ref.source.zipIcons);
         if(i == null)
         {
-            System.out.println("Mappaint style \""+styleName+"\" icon \"" + name + "\" not found.");
+            System.out.println("Mappaint style \""+styleName+"\" icon \"" + ref.iconName + "\" not found.");
             i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, "misc/no_icon.png");
         }
@@ -86,5 +98,5 @@
                 if(zip != null)
                 {
-                    zipIcons = in.getFile();
+                    style.zipIcons = in.getFile();
                     ins = new InputStreamReader(zip);
                 } else {
@@ -110,6 +122,4 @@
             styles.add(style);
         }
-        iconDirs = null;
-        zipIcons = null;
     }
 }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java	(revision 3826)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java	(revision 3827)
@@ -2,7 +2,7 @@
 package org.openstreetmap.josm.gui.mappaint.xml;
 
-import javax.swing.ImageIcon;
-
 import org.openstreetmap.josm.gui.mappaint.IconElemStyle;
+import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
+import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle;
 import org.openstreetmap.josm.gui.mappaint.SimpleNodeElemStyle;
@@ -10,5 +10,5 @@
 public class IconPrototype extends Prototype {
     
-    public ImageIcon icon;
+    public IconReference icon;
     public boolean annotate;
 
@@ -33,5 +33,5 @@
             return SimpleNodeElemStyle.INSTANCE;
         } else {
-            IconElemStyle i = new IconElemStyle(minScale, maxScale, icon);
+            IconElemStyle i = new IconElemStyle(minScale, maxScale, MapPaintStyles.getIcon(icon));
             i.annotate = annotate;
             return i;
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(revision 3826)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(revision 3827)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.mappaint.xml;
 
+import java.io.File;
 import java.util.Collection;
 import java.util.Collections;
@@ -28,4 +29,5 @@
 
     public boolean hasError = false;
+    public File zipIcons;
 
     public XmlStyleSource(String url, String name, String shortdescription) {
@@ -200,12 +202,3 @@
          }
      }
-
-    /**
-     * 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 3826)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java	(revision 3827)
@@ -6,8 +6,6 @@
 import java.util.LinkedList;
 
-import javax.swing.ImageIcon;
-
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
+import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
 import org.openstreetmap.josm.tools.ColorHelper;
 import org.xml.sax.Attributes;
@@ -211,5 +209,5 @@
                 {
                     if (atts.getQName(count).equals("src")) {
-                        ImageIcon icon = MapPaintStyles.getIcon(atts.getValue(count), style.getPrefName());
+                        IconReference icon = new IconReference(atts.getValue(count), style);
                         hadIcon = (icon != null);
                         rule.icon.icon = icon;
Index: trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java	(revision 3826)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java	(revision 3827)
@@ -96,3 +96,11 @@
     }
 
+    /**
+     * 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;
+    }
 }
