/** * decorate an icon given a set of adornment flags. Constants for flag * values are defined in JavaElementImageDescriptor */ public static ImageDescriptor decorate(ImageDescriptor base, int decorations) { Point size = useSmallSize(decorations) ? SMALL_SIZE : BIG_SIZE; // Check the image descriptor cache String key = new String(base.toString() + ":::" + decorations + ":::" //$NON-NLS-1$ //$NON-NLS-2$ + size.toString()); // Example key is // "URLImageDescriptor(platform:/plugin/org.aspectj.ajde_1.1.0/icons/structure/file-lst.gif):::0:::Point // {22, 16}" // or // "URLImageDescriptor(platform:/plugin/org.eclipse.ui_2.0.2/icons/full/obj16/fldr_obj.gif):::0:::Point // {22, 16}" if (imageDescriptorCache.get(key) != null) { return (ImageDescriptor) imageDescriptorCache.get(key); } ImageDescriptor imageDescriptor = new JavaElementImageDescriptor( base, decorations, size); imageDescriptorCache.put(key, imageDescriptor); //System.err.println("IDCache mis for "+key); return imageDescriptor; }