diff options
Diffstat (limited to 'plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/CommonImages.java')
-rw-r--r-- | plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/CommonImages.java | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/CommonImages.java b/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/CommonImages.java index 54b0e6a44a1..63a93082b98 100644 --- a/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/CommonImages.java +++ b/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/CommonImages.java @@ -27,63 +27,63 @@ import org.eclipse.swt.graphics.Image; */ public class CommonImages { - private static final URL baseURL = Activator.getDefault().getBundle().getEntry("/icons/full/"); //$NON-NLS-1$ - - private static ImageRegistry imageRegistry; - - private static final String T_TOOL = "etool16"; //$NON-NLS-1$ - - private static final String T_WIZBAN = "wizban"; //$NON-NLS-1$ - - // Discovery - - public static final ImageDescriptor BANNER_DISCOVERY = create(T_WIZBAN, "banner-discovery-papyrus.png"); //$NON-NLS-1$ - - public static final ImageDescriptor FIND_CLEAR = create(T_TOOL, "find-clear.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor FIND_CLEAR_DISABLED = create(T_TOOL, "find-clear-disabled.gif"); //$NON-NLS-1$ - - private static ImageDescriptor create(String prefix, String name) { - try { - return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); - } catch (MalformedURLException e) { - return ImageDescriptor.getMissingImageDescriptor(); - } - } - - /** - * Lazily initializes image map. - * - * @param imageDescriptor - * @return Image - */ - public static Image getImage(ImageDescriptor imageDescriptor) { - ImageRegistry imageRegistry = getImageRegistry(); - Image image = imageRegistry.get("" + imageDescriptor.hashCode()); //$NON-NLS-1$ - if (image == null) { - image = imageDescriptor.createImage(true); - imageRegistry.put("" + imageDescriptor.hashCode(), image); //$NON-NLS-1$ - } - return image; - } - - private static ImageRegistry getImageRegistry() { - if (imageRegistry == null) { - imageRegistry = new ImageRegistry(); - } - - return imageRegistry; - } - - private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException { - if (baseURL == null) { - throw new MalformedURLException(); - } - - StringBuffer buffer = new StringBuffer(prefix); - buffer.append('/'); - buffer.append(name); - return new URL(baseURL, buffer.toString()); - } + private static final URL baseURL = Activator.getDefault().getBundle().getEntry("/icons/full/"); //$NON-NLS-1$ + + private static ImageRegistry imageRegistry; + + private static final String T_TOOL = "etool16"; //$NON-NLS-1$ + + private static final String T_WIZBAN = "wizban"; //$NON-NLS-1$ + + // Discovery + + public static final ImageDescriptor BANNER_DISCOVERY = create(T_WIZBAN, "banner-discovery-papyrus.png"); //$NON-NLS-1$ + + public static final ImageDescriptor FIND_CLEAR = create(T_TOOL, "find-clear.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor FIND_CLEAR_DISABLED = create(T_TOOL, "find-clear-disabled.gif"); //$NON-NLS-1$ + + private static ImageDescriptor create(String prefix, String name) { + try { + return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); + } catch (MalformedURLException e) { + return ImageDescriptor.getMissingImageDescriptor(); + } + } + + /** + * Lazily initializes image map. + * + * @param imageDescriptor + * @return Image + */ + public static Image getImage(ImageDescriptor imageDescriptor) { + ImageRegistry imageRegistry = getImageRegistry(); + Image image = imageRegistry.get("" + imageDescriptor.hashCode()); //$NON-NLS-1$ + if (image == null) { + image = imageDescriptor.createImage(true); + imageRegistry.put("" + imageDescriptor.hashCode(), image); //$NON-NLS-1$ + } + return image; + } + + private static ImageRegistry getImageRegistry() { + if (imageRegistry == null) { + imageRegistry = new ImageRegistry(); + } + + return imageRegistry; + } + + private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException { + if (baseURL == null) { + throw new MalformedURLException(); + } + + StringBuffer buffer = new StringBuffer(prefix); + buffer.append('/'); + buffer.append(name); + return new URL(baseURL, buffer.toString()); + } } |