Ticket #7840: 7840-2.patch
File 7840-2.patch, 2.4 KB (added by , 13 years ago) |
---|
-
src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
303 303 public String icon; 304 304 public String locale_display_value; 305 305 public String locale_short_description; 306 private final File zipIcons = TaggingPreset.zipIcons; 306 307 307 308 public String getListDisplay() { 308 309 if (value.equals(DIFFERENT)) … … 324 325 } 325 326 326 327 public ImageIcon getIcon() { 327 return icon == null ? null : ImageProvider.getIfAvailable(icon);328 return icon == null ? null : loadImageIcon(icon, zipIcons); 328 329 } 329 330 330 331 public PresetListEntry() { … … 1227 1228 return group != null ? group.getRawName() + "/" + name : name; 1228 1229 } 1229 1230 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 1230 1236 /* 1231 1237 * Called from the XML parser to set the icon. 1232 1238 * This task is performed in the background in order to speedup startup. … … 1235 1241 * and the 16x16 icons for SMALL_ICON. 1236 1242 */ 1237 1243 public void setIcon(final String iconName) { 1238 final File zipIcons = this.zipIcons;1244 final File zipIcons = TaggingPreset.zipIcons; 1239 1245 Main.worker.submit(new Runnable() { 1240 1246 1241 1247 @Override 1242 1248 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); 1245 1250 if (icon == null) { 1246 1251 System.out.println("Could not get presets icon " + iconName); 1247 1252 icon = new ImageIcon(iconName); … … 1430 1435 JOptionPane.ERROR_MESSAGE 1431 1436 ); 1432 1437 } 1433 zipIcons = null;1434 1438 } 1435 1439 return allPresets; 1436 1440 }