Ignore:
Timestamp:
2011-02-09T09:53:35+01:00 (13 years ago)
Author:
bastiK
Message:

use classloader to find projections from plugins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r3862 r3874  
    2424import java.util.Collection;
    2525import java.util.HashMap;
    26 import java.util.LinkedList;
    27 import java.util.List;
    2826import java.util.Map;
    2927import java.util.zip.ZipEntry;
     
    3634import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    3735import org.openstreetmap.josm.io.MirroredInputStream;
     36import org.openstreetmap.josm.plugins.PluginHandler;
    3837
    3938/**
     
    6867     */
    6968    private static Map<String, ImageWrapper> cache = new HashMap<String, ImageWrapper>();
    70 
    71     /**
    72      * Add here all ClassLoader whose resource should be searched. Plugin's class loaders are added
    73      * by main.
    74      */
    75     public static final List<ClassLoader> sources = new LinkedList<ClassLoader>();
    7669
    7770    /**
     
    234227        if (path.startsWith("resource://")) {
    235228            String p = path.substring("resource://".length());
    236             for (ClassLoader source : sources) {
     229            for (ClassLoader source : PluginHandler.getResourceClassLoaders()) {
    237230                URL res;
    238231                if ((res = source.getResource(p + name)) != null)
     
    355348    }
    356349
    357     static {
    358         try {
    359             sources.add(ClassLoader.getSystemClassLoader());
    360             sources.add(org.openstreetmap.josm.gui.MainApplication.class.getClassLoader());
    361         } catch (SecurityException ex) {
    362             sources.add(ImageProvider.class.getClassLoader());
    363         }
    364     }
    365 
    366350    /*
    367351     * from: http://www.jidesoft.com/blog/2008/02/29/rotate-an-icon-in-java/ License:
Note: See TracChangeset for help on using the changeset viewer.