Java Code Examples for org.eclipse.jface.resource.ImageDescriptor#getMissingImageDescriptor()
The following examples show how to use
org.eclipse.jface.resource.ImageDescriptor#getMissingImageDescriptor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageLibrary.java From hadoop-gpu with Apache License 2.0 | 6 votes |
/** * 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. * * @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; }
Example 2
Source File: ImageLibrary.java From hadoop-gpu with Apache License 2.0 | 6 votes |
/** * 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. * * @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; }
Example 3
Source File: PluginImageHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * Returns the image associated with the given image descriptor. * * @param descriptor * the image descriptor for which the helper manages an image, or <code>null</code> for a missing image * descriptor * @return the image associated with the image descriptor or <code>null</code> if the image descriptor can't create * the requested image. */ @Override public Image getImage(ImageDescriptor descriptor) { if (descriptor == null) { descriptor = ImageDescriptor.getMissingImageDescriptor(); } Image result = registry.get(descriptor); if (result != null) { return result; } result = descriptor.createImage(); if (result != null) { registry.put(descriptor, result); } return result; }
Example 4
Source File: ImageLibrary.java From RDFS with Apache License 2.0 | 6 votes |
/** * Load and register a new image. If the image resource does not exist or * fails to load, a default "error" resource is supplied. * * @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; }
Example 5
Source File: ImageLibrary.java From RDFS with Apache License 2.0 | 6 votes |
/** * 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. * * @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; }
Example 6
Source File: ImageLibrary.java From hadoop-gpu with Apache License 2.0 | 6 votes |
/** * Load and register a new image. If the image resource does not exist or * fails to load, a default "error" resource is supplied. * * @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; }
Example 7
Source File: GamaIcon.java From gama with GNU General Public License v3.0 | 6 votes |
public ImageDescriptor descriptor() { if (descriptor == null) { final Image image = GamaIcons.getInstance().getImageInCache(code); if (image != null) { descriptor = ImageDescriptor.createFromImage(image); } else { descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(plugin, GamaIcons.DEFAULT_PATH + path + ".png"); } if (descriptor == null) { DEBUG.ERR("ERROR: Cannot find icon " + GamaIcons.DEFAULT_PATH + path + ".png in plugin: " + plugin); descriptor = ImageDescriptor.getMissingImageDescriptor(); } } return descriptor; }
Example 8
Source File: ImageLibrary.java From RDFS with Apache License 2.0 | 6 votes |
/** * 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. * * @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; }
Example 9
Source File: ImageManager.java From saros with GNU General Public License v2.0 | 5 votes |
/** * Returns an image from the file at the given plug-in relative path. * * @param path * @return image; the returned image <b>MUST be disposed after usage</b> to free up memory */ public static Image getImage(final String path) { ImageDescriptor descriptor = getImageDescriptor(path); if (descriptor == null) { log.warn( "could not create image for path '" + path + "', either the file does not exists or the format is not supported"); descriptor = ImageDescriptor.getMissingImageDescriptor(); } return new Image(Display.getDefault(), descriptor.getImageData()); }
Example 10
Source File: PortingActionProvider.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the image descriptor with the given relative path. */ protected ImageDescriptor getImageDescriptor(String relativePath) { String iconPath = "icons/full/"; //$NON-NLS-1$ URL url = FileLocator.find(WorkbenchNavigatorPlugin.getDefault().getBundle(), new Path(iconPath + relativePath), Collections.EMPTY_MAP); if (url == null) { return ImageDescriptor.getMissingImageDescriptor(); } return ImageDescriptor.createFromURL(url); }
Example 11
Source File: GitlabImages.java From mylyn-gitlab with Eclipse Public License 1.0 | 5 votes |
private static ImageDescriptor create(String name) { try { return ImageDescriptor.createFromURL(makeIconFileURL(name)); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }
Example 12
Source File: JavaPluginImages.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path, boolean useMissingImageDescriptor) { URL url= FileLocator.find(bundle, path, null); if (url != null) { return ImageDescriptor.createFromURL(url); } if (useMissingImageDescriptor) { return ImageDescriptor.getMissingImageDescriptor(); } return null; }
Example 13
Source File: EditorPluginImages.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path, boolean useMissingImageDescriptor) { URL url = FileLocator.find(bundle, path, null); if (url != null) { return ImageDescriptor.createFromURL(url); } if (useMissingImageDescriptor) { return ImageDescriptor.getMissingImageDescriptor(); } return null; }
Example 14
Source File: UIImages.java From LogViewer with Eclipse Public License 2.0 | 5 votes |
private static void declareRegistryImage(String key, String path) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); try { desc = ImageDescriptor.createFromURL(makeIconFileURL(path)); } catch(MalformedURLException me) { LogViewerPlugin.getDefault().showErrorMessage(me); } imageRegistry.put(key, desc); }
Example 15
Source File: LapseImages.java From lapse-plus with GNU General Public License v3.0 | 5 votes |
private static ImageDescriptor create(String path, String name) { try { return ImageDescriptor.createFromURL(makeIconFileURL(path, name)); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }
Example 16
Source File: TypeScriptUIImageResource.java From typescript.java with MIT License | 5 votes |
/** * Return the image descriptor with the given key. * * @param key * java.lang.String * @return org.eclipse.jface.resource.ImageDescriptor */ public static ImageDescriptor getImageDescriptor(String key) { initializeIfNeeded(); ImageDescriptor id = imageDescriptors.get(key); if (id != null) return id; return ImageDescriptor.getMissingImageDescriptor(); }
Example 17
Source File: SootPlugin.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public static ImageDescriptor getImageDescriptor(String name){ try { URL installURL = getDefault().getDescriptor().getInstallURL(); URL iconURL = new URL(installURL, ISootConstants.ICON_PATH + name); return ImageDescriptor.createFromURL(iconURL); } catch (MalformedURLException e){ return ImageDescriptor.getMissingImageDescriptor(); } }
Example 18
Source File: Pics.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public static ImageDescriptor getImageDescriptor(final String imageName, final AbstractUIPlugin plugin) { ImageDescriptor desc; try { desc = ImageDescriptor.createFromURL( new URL( plugin.getBundle().getResource("/"), //$NON-NLS-1$ "icons/" + imageName)); //$NON-NLS-1$ } catch (final MalformedURLException e) { desc = ImageDescriptor.getMissingImageDescriptor(); } return desc; }
Example 19
Source File: ExamplesView.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Returns an image descriptor for the image file at the given plug-in relative * path. * * @param path the path * @return the image descriptor */ public static ImageDescriptor getImageDescriptor(String path) { try { return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.nebula.examples", path); } catch (Throwable e) { return ImageDescriptor.getMissingImageDescriptor(); } }
Example 20
Source File: OpenDashboardHandler.java From developer-studio with Apache License 2.0 | 4 votes |
public ImageDescriptor getImageDescriptor() { return ImageDescriptor.getMissingImageDescriptor(); }