List of usage examples for org.eclipse.jface.resource ImageDescriptor getMissingImageDescriptor
public static ImageDescriptor getMissingImageDescriptor()
From source file:org.ganoro.phing.ui.AntUIImages.java
License:Open Source License
/** * Declare an Image in the registry table. * @param key The key to use when registering the image * @param path The path where the image can be found. This path is relative to where * this plugin class is found (i.e. typically the packages directory) *//*w w w . j a va 2 s .c o m*/ private final static void declareRegistryImage(String key, String path) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); Bundle bundle = Platform.getBundle(PhingUi.getUniqueIdentifier()); URL url = null; if (bundle != null) { url = FileLocator.find(bundle, new Path(path), null); desc = ImageDescriptor.createFromURL(url); } imageRegistry.put(key, desc); }
From source file:org.github.avatar.ui.AvatarImage.java
License:Open Source License
/** * Get avatar image data/* w w w .ja va 2 s. c om*/ * * @return image data */ public ImageData getData() { if (this.data != null) return this.data; try { ImageData[] images = new ImageLoader().load(new ByteArrayInputStream(avatar.getBytes())); if (images.length > 0) this.data = images[0]; else this.data = ImageDescriptor.getMissingImageDescriptor().getImageData(); } catch (SWTException exception) { this.data = ImageDescriptor.getMissingImageDescriptor().getImageData(); } return this.data; }
From source file:org.gradle.eclipse.ImageDescriptorRegistry.java
License:Apache License
/** * Returns the image associated with the given image descriptor. * /*w ww .ja v a 2 s .com*/ * @param descriptor the image descriptor for which the registry manages an image * @return the image associated with the image descriptor or <code>null</code> * if the image descriptor can't create the requested image. */ public Image get(ImageDescriptor descriptor) { if (descriptor == null) descriptor = ImageDescriptor.getMissingImageDescriptor(); Image result = (Image) fRegistry.get(descriptor); if (result != null) return result; Assert.isTrue(fDisplay == GradlePlugin.getStandardDisplay(), GradleMessages.ImageDescriptorRegistryAllocatingImageForWrongDisplay1); result = descriptor.createImage(); if (result != null) fRegistry.put(descriptor, result); return result; }
From source file:org.grails.ide.eclipse.explorer.internal.util.ImageUtils.java
License:Open Source License
/** * Creates an image descriptor from a platform URL String. For example: * "platform:/plugin/org.grails.ide.eclipse.explorer/icons/full/obj16/config.gif" *///from ww w.j a va 2s.co m public static ImageDescriptor imageDescriptor(String url) { try { return ImageDescriptor.createFromURL(new URL(url)); } catch (MalformedURLException e) { GrailsCoreActivator.log(e); return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:org.guvnor.tools.Activator.java
License:Apache License
private static ImageDescriptor loadImageDescriptor(String id) { String iconPath = "icons/"; //$NON-NLS-1$ try {/*from w w w .ja va2 s. c o m*/ URL installURL = Activator.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$ URL url = new URL(installURL, iconPath + id); return ImageDescriptor.createFromURL(url); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:org.hibernate.eclipse.console.utils.EclipseImageMap.java
License:Open Source License
protected void declareRegistryImage(String key, String path) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); try {//from w w w. j a v a 2s . co m desc = ImageDescriptor.createFromURL(makeIconFileURL(path)); } catch (MalformedURLException me) { HibernatePlugin.getDefault().log(me); } imageRegistry.put(key, desc); imageDescriptors.put(key, desc); }
From source file:org.jactr.eclipse.ui.images.JACTRImages.java
License:Open Source License
/** * Declare an Image in the registry table. * //w w w. ja v a 2 s.co m * @param key * The key to use when registering the image * @param path * The path where the image can be found. This path is relative to * where this plugin class is found (i.e. typically the packages * directory) */ private final static void declareRegistryImage(String key, String path) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); try { desc = ImageDescriptor.createFromURL(makeIconFileURL(path)); } catch (MalformedURLException me) { UIPlugin.log(me); } imageRegistry.put(key, desc); imageDescriptors.put(key, desc); }
From source file:org.jboss.tools.cdi.seam.config.ui.CDISeamConfigUiImages.java
License:Open Source License
public ImageDescriptor createImageDescriptor(String key) { try {/*from w ww . ja v a2 s .c o m*/ return ImageDescriptor.createFromURL(makeIconFileURL(key)); } catch (MalformedURLException e) { if (parentRegistry == null) { return ImageDescriptor.getMissingImageDescriptor(); } else { return parentRegistry.createImageDescriptor(key); } } }
From source file:org.jboss.tools.cdi.xml.CDIXMLImages.java
License:Open Source License
public ImageDescriptor createImageDescriptor(String key) { try {/*from w w w . j ava 2 s . co m*/ return ImageDescriptor.createFromURL(makeIconFileURL(key)); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:org.jboss.tools.common.log.BaseUIPlugin.java
License:Open Source License
/** * Creates an image from the given resource and adds the image to the image * registry./* w ww . j av a 2 s .c om*/ * * @param resource * @return Image */ private Image createImage(String resource) { ImageDescriptor desc = getImageDescriptorFromRegistry(resource); Image image = null; if (desc != null) { image = desc.createImage(); // dont add the missing image descriptor image to the image // registry if (!desc.equals(ImageDescriptor.getMissingImageDescriptor())) { getImageRegistry().put(resource, image); } } return image; }