Changeset 159 in josm for src/org/openstreetmap/josm/tools/ImageProvider.java
- Timestamp:
- 2006-10-13T13:02:57+02:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/tools/ImageProvider.java
r101 r159 12 12 import java.net.URL; 13 13 import java.util.HashMap; 14 import java.util.LinkedList; 15 import java.util.List; 14 16 import java.util.Map; 15 17 … … 37 39 38 40 /** 41 * Add here all ClassLoader whose ressource should be searched. 42 * Plugin's class loaders are added by main. 43 */ 44 public static final List<Class<?>> sources = new LinkedList<Class<?>>(); 45 46 /** 39 47 * Return an image from the specified location. 40 48 * … … 47 55 subdir += "/"; 48 56 String ext = name.indexOf('.') != -1 ? "" : ".png"; 49 URL path = Main.class.getResource("/images/"+subdir+name+ext); 57 URL path = null; 58 for (Class<?> source : sources) { 59 path = source.getResource("/images/"+subdir+name+ext); 60 if (path != null) 61 break; 62 } 50 63 if (path == null) 51 64 throw new NullPointerException("/images/"+subdir+name+ext+" not found"); … … 108 121 return new ImageIcon(img); 109 122 } 123 124 static { 125 sources.add(Main.class); 126 } 110 127 }
Note:
See TracChangeset
for help on using the changeset viewer.
