List of usage examples for org.eclipse.jface.resource ImageDescriptor getMissingImageDescriptor
public static ImageDescriptor getMissingImageDescriptor()
From source file:org.apache.directory.studio.valueeditors.ValueEditorManager.java
License:Apache License
/** * Returns all value editor extensions specified by value editor extensions. * * @return the value editor extensions/*from ww w. j a v a2 s . c om*/ */ public static Collection<ValueEditorExtension> getValueEditorExtensions() { Collection<ValueEditorExtension> valueEditorExtensions = new ArrayList<ValueEditorExtension>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT); IConfigurationElement[] members = extensionPoint.getConfigurationElements(); // For each extension: for (IConfigurationElement member : members) { ValueEditorExtension proxy = new ValueEditorExtension(); valueEditorExtensions.add(proxy); IExtension extension = member.getDeclaringExtension(); String extendingPluginId = extension.getNamespaceIdentifier(); proxy.member = member; proxy.name = member.getAttribute(NAME); String iconPath = member.getAttribute(ICON); proxy.icon = AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId, iconPath); if (proxy.icon == null) { proxy.icon = ImageDescriptor.getMissingImageDescriptor(); } proxy.className = member.getAttribute(CLASS); IConfigurationElement[] children = member.getChildren(); for (IConfigurationElement child : children) { String type = child.getName(); if (SYNTAX.equals(type)) { String syntaxOID = child.getAttribute(SYNTAX_OID); proxy.syntaxOids.add(syntaxOID); } else if (ATTRIBUTE.equals(type)) { String attributeType = child.getAttribute(ATTRIBUTE_TYPE); proxy.attributeTypes.add(attributeType); } } } return valueEditorExtensions; }
From source file:org.apache.hadoop.eclipse.ImageLibrary.java
License:Apache License
/** * Load and register a new image. If the image resource does not exist or * fails to load, a default "error" resource is supplied. * /*from w ww. j a v a 2 s . co m*/ * @param name name of the image * @param filename name of the file containing the image * @return whether the image has correctly been loaded */ private boolean newImage(String name, String filename) { ImageDescriptor id; boolean success; try { URL fileURL = FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null); id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL)); success = true; } catch (Exception e) { e.printStackTrace(); id = ImageDescriptor.getMissingImageDescriptor(); // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK); success = false; } descMap.put(name, id); imageMap.put(name, id.createImage(true)); return success; }
From source file:org.apache.hadoop.eclipse.ImageLibrary.java
License:Apache License
/** * Register an image from the workspace shared image pool. If the image * resource does not exist or fails to load, a default "error" resource is * supplied./*from ww w . ja va 2s. c o m*/ * * @param name name of the image * @param sharedName name of the shared image ({@link ISharedImages}) * @return whether the image has correctly been loaded */ private boolean newSharedImage(String name, String sharedName) { boolean success = true; ImageDescriptor id = getSharedByName(sharedName); if (id == null) { id = ImageDescriptor.getMissingImageDescriptor(); // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK); success = false; } descMap.put(name, id); imageMap.put(name, id.createImage(true)); return success; }
From source file:org.apache.hadoop.eclipse.ImageLibrary.java
License:Apache License
/** * Register an image from the workspace shared image pool. If the image * resource does not exist or fails to load, a default "error" resource is * supplied.//from w ww .j av a2 s . c o m * * @param name name of the image * @param sharedName name of the shared image ({@link ISharedImages}) * @return whether the image has correctly been loaded */ private boolean newPluginImage(String name, String pluginId, String filename) { boolean success = true; ImageDescriptor id = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, filename); if (id == null) { id = ImageDescriptor.getMissingImageDescriptor(); // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK); success = false; } descMap.put(name, id); imageMap.put(name, id.createImage(true)); return success; }
From source file:org.apache.ivyde.internal.eclipse.ui.DecorationOverlayIcon.java
License:Apache License
protected void drawCompositeImage(int width, int height) { drawImage(baseImage.getImageData(), 0, 0); ImageData overlayData = overlayImage.getImageData(); // Use the missing descriptor if it is not there. if (overlayData == null) { overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData(); }/*ww w . j av a 2 s . c o m*/ drawImage(overlayData, 0, size.y - overlayData.height); }
From source file:org.axdt.core.ui.img.AxdtImageHelper.java
License:Open Source License
public Image getImage(ImageDescriptor descriptor) { if (descriptor == null) { descriptor = ImageDescriptor.getMissingImageDescriptor(); }//from ww w . j a v a 2s . c o m Image result = registry.get(descriptor); if (result != null) { return result; } result = descriptor.createImage(); if (result != null) { Image existing = registry.put(descriptor, result); if (existing != null) { existing.dispose(); } } return result; }
From source file:org.bonitasoft.studio.pics.Pics.java
License:Open Source License
public static ImageDescriptor getImageDescriptor(String imageName, AbstractUIPlugin plugin) { ImageDescriptor desc;/*from w w w. j a va2 s . c o m*/ try { desc = ImageDescriptor.createFromURL(new URL(plugin.getBundle().getResource("/"), //$NON-NLS-1$ "icons/" + imageName)); //$NON-NLS-1$ } catch (MalformedURLException e) { desc = ImageDescriptor.getMissingImageDescriptor(); } return desc; }
From source file:org.brainwy.liclipsetext.shared_ui.ImageCache.java
License:Open Source License
/** * @param key - relative path to the plugin directory * @return the image//from w w w.j a va2s .c o m */ public Image get(String key) { Image image = getFromImageHash(key); if (image == null) { ImageDescriptor desc; try { // Don't lock for this creation (GTK has a global lock for the image // creation which is the same one for the main thread, so, if this // happens in a thread, the main thread could deadlock). // #PyDev-527: Deadlock in ImageCache rendering debug completions desc = getDescriptor(key); image = desc.createImage(); image = putOnImageHash(key, image); } catch (NoClassDefFoundError e) { //we're in tests... return null; } catch (UnsatisfiedLinkError e) { //we're in tests... return null; } catch (Exception e) { // If image is missing, create a default missing one Log.log("ERROR: Missing image: " + key); Image m = missing; if (m == null || m.isDisposed()) { desc = ImageDescriptor.getMissingImageDescriptor(); m = missing = desc.createImage(); } image = m; } } return image; }
From source file:org.brainwy.liclipsetext.shared_ui.ImageCache.java
License:Open Source License
/** * like get, but returns ImageDescription instead of image *///from w w w . ja va 2 s. co m public ImageDescriptor getDescriptor(String key) { synchronized (descriptorLock) { if (!descriptorHash.containsKey(key)) { URL url; ImageDescriptor desc; try { url = new URL(baseURL, key); desc = ImageDescriptor.createFromURL(url); } catch (MalformedURLException e) { Log.log("ERROR: Missing image: " + key); desc = ImageDescriptor.getMissingImageDescriptor(); } descriptorHash.put(key, desc); return desc; } return descriptorHash.get(key); } }
From source file:org.caesarj.ui.CaesarPluginImages.java
License:Open Source License
private static ImageDescriptor createManaged(String name) { try {/* w w w. j a v a 2 s .c o m*/ ImageDescriptor result = ImageDescriptor .createFromURL(makeIconFileURL(name.substring(NAME_PREFIX_LENGTH))); if (fgAvoidSWTErrorMap == null) { fgAvoidSWTErrorMap = new HashMap(); } fgAvoidSWTErrorMap.put(name, result); if (fgImageRegistry != null) { JavaPlugin.logErrorMessage("Image registry already defined"); //$NON-NLS-1$ } return result; } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }