/** * Returns an image descriptor. * * @return an {@link ImageDescriptor} */ public ImageDescriptor imageDescriptor() { final ImageRegistry imageRegistry = DiagramActivator.getDefault().getImageRegistry(); ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(path); if (imageDescriptor == null) { addImageDescriptor(); imageDescriptor = imageRegistry.getDescriptor(path); } return imageDescriptor; }
private void addImageDescriptor() { final DiagramActivator plugin = DiagramActivator.getDefault(); final ImageDescriptor id = ImageDescriptor.createFromURL(plugin.getBundle().getEntry(path)); plugin.getImageRegistry().put(path, id); }