Example #1
0
 /**
  * @param bundleIdentifier Application
  * @param size Requested size
  * @return Cached icon
  */
 public NSImage iconForApplication(final String bundleIdentifier, final Integer size) {
   NSImage icon = this.load(bundleIdentifier, size);
   if (null == icon) {
     icon =
         NSWorkspace.sharedWorkspace()
             .iconForFile(
                 NSWorkspace.sharedWorkspace()
                     .absolutePathForAppBundleWithIdentifier(bundleIdentifier));
     this.put(bundleIdentifier, this.convert(icon, size), size);
   }
   if (null == icon) {
     return this.iconForName("notfound.tiff", size);
   }
   return icon;
 }
Example #2
0
 /**
  * @param extension File type
  * @param size Requested size
  * @return Cached icon
  */
 public NSImage iconForExtension(final String extension, final Integer size) {
   NSImage image = this.load(extension, size);
   if (null == image) {
     image = NSWorkspace.sharedWorkspace().iconForFileType(extension);
     this.put(extension, this.convert(image, size), size);
   }
   return image;
 }
Example #3
0
 /**
  * @param item File
  * @param size Requested size
  * @return Cached icon
  */
 public NSImage iconForPath(final Local item, final Integer size) {
   NSImage icon = null;
   if (item.exists()) {
     icon = this.load(item.getAbsolute(), size);
     if (null == icon) {
       icon = NSWorkspace.sharedWorkspace().iconForFile(item.getAbsolute());
       this.put(item.getAbsolute(), this.convert(icon, size), size);
     }
   }
   if (null == icon) {
     return this.iconForName("notfound.tiff", size);
   }
   return icon;
 }