Changeset 5316 in josm for trunk/src/org


Ignore:
Timestamp:
2012-07-08T21:11:44+02:00 (12 years ago)
Author:
bastiK
Message:

see #7840 - List Entry icons do not honor the file paths of preset (i.e. the zip file) (based on patch by simon04)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r5208 r5316  
    304304        public String locale_display_value;
    305305        public String locale_short_description;
     306        private final File zipIcons = TaggingPreset.zipIcons;
    306307
    307308        public String getListDisplay() {
     
    325326
    326327        public ImageIcon getIcon() {
    327             return icon == null ? null : ImageProvider.getIfAvailable(icon);
     328            return icon == null ? null : loadImageIcon(icon, zipIcons);
    328329        }
    329330
     
    12281229    }
    12291230
     1231    protected static ImageIcon loadImageIcon(String iconName, File zipIcons) {
     1232        final Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
     1233        return new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true).get();
     1234    }
     1235
    12301236    /*
    12311237     * Called from the XML parser to set the icon.
     
    12361242     */
    12371243    public void setIcon(final String iconName) {
    1238         final File zipIcons = this.zipIcons;
     1244        final File zipIcons = TaggingPreset.zipIcons;
    12391245        Main.worker.submit(new Runnable() {
    12401246
    12411247            @Override
    12421248            public void run() {
    1243                 final Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
    1244                 ImageIcon icon = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true).get();
     1249                ImageIcon icon = loadImageIcon(iconName, zipIcons);
    12451250                if (icon == null) {
    12461251                    System.out.println("Could not get presets icon " + iconName);
     
    14311436                        );
    14321437            }
    1433             zipIcons = null;
    14341438        }
    14351439        return allPresets;
Note: See TracChangeset for help on using the changeset viewer.