Ignore:
Timestamp:
2006-10-13T13:02:57+02:00 (20 years ago)
Author:
imi
Message:
  • moved translations into plugins
  • added main menu control to main
  • added ImageProvider access to plugins
File:
1 edited

Legend:

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

    r101 r159  
    1212import java.net.URL;
    1313import java.util.HashMap;
     14import java.util.LinkedList;
     15import java.util.List;
    1416import java.util.Map;
    1517
     
    3739
    3840        /**
     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        /**
    3947         * Return an image from the specified location.
    4048         *
     
    4755                        subdir += "/";
    4856                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                }
    5063                if (path == null)
    5164                        throw new NullPointerException("/images/"+subdir+name+ext+" not found");
     
    108121                return new ImageIcon(img);
    109122        }
     123
     124        static {
     125                sources.add(Main.class);
     126        }
    110127}
Note: See TracChangeset for help on using the changeset viewer.