Esempio n. 1
0
 /**
  * @param name When looking for files in the application bundle, it is better (but not required)
  *     to include the filename extension in the name parameter
  * @param width Requested size
  * @param height Requested size
  * @return Cached icon
  * @see NSImage#imageNamed(String)
  * @see #convert(ch.cyberduck.ui.cocoa.application.NSImage, Integer, Integer)
  */
 protected NSImage iconForName(final String name, final Integer width, final Integer height) {
   NSImage image = this.load(name, width);
   if (null == image) {
     if (name.startsWith("/")) {
       image = NSImage.imageWithContentsOfFile(name);
     } else {
       image = NSImage.imageNamed(name);
     }
     if (null == image) {
       log.warn(String.format("No icon named %s", name));
       this.put(name, null, width);
     } else {
       // You can clear an image object from the cache explicitly by passing nil for the image
       // name.
       image.setName(null);
       this.put(name, this.convert(image, width, height), width);
     }
   }
   return image;
 }