/** * Returns the image registry for this plugin. * * @return ImageRegistry - image registry for this plugin */ private ImageRegistry getImageRegistry() { return JFaceResources.getImageRegistry(); } }
/** * Returns the image registry for this plugin. * * @return ImageRegistry - image registry for this plugin */ private ImageRegistry getImageRegistry() { return JFaceResources.getImageRegistry(); }
/** * Returns the image in JFace's image registry with the given key, or * <code>null</code> if none. Convenience method equivalent to * * <pre> * JFaceResources.getImageRegistry().get(key) * </pre> * * @param key * the key * @return the image, or <code>null</code> if none */ public static Image getImage(String key) { return getImageRegistry().get(key); }
/** * Returns the image in JFace's image registry with the given key, or * <code>null</code> if none. Convenience method equivalent to * * <pre> * JFaceResources.getImageRegistry().get(key) * </pre> * * @param key * the key * @return the image, or <code>null</code> if none */ public static Image getImage(String key) { return getImageRegistry().get(key); }
@Override public Image getIconFor(Job job) { Enumeration<Object> families = imageKeyTable.keys(); while (families.hasMoreElements()) { Object next = families.nextElement(); if (job.belongsTo(next)) { return JFaceResources.getImageRegistry().get(imageKeyTable.get(next)); } } return null; }
@Override public void registerIconForFamily(ImageDescriptor icon, Object family) { String key = IMAGE_KEY + String.valueOf(imageKeyTable.size()); imageKeyTable.put(family, key); ImageRegistry registry = JFaceResources.getImageRegistry(); // Avoid registering twice. if (registry.getDescriptor(key) == null) { registry.put(key, icon); } }
/** * Returns the standard dialog image with the given key. Note that these * images are managed by the dialog framework, and must not be disposed by * another party. * * @param key * one of the <code>Dialog.DLG_IMG_* </code> constants * @return the standard dialog image * * NOTE: Dialog does not use the following images in the registry * DLG_IMG_ERROR DLG_IMG_INFO DLG_IMG_QUESTION DLG_IMG_WARNING * * They are now coming directly from SWT, see ImageRegistry. For backwards * compatibility they are still supported, however new code should use SWT * for these. * * @see Display#getSystemImage(int) */ public static Image getImage(String key) { return JFaceResources.getImageRegistry().get(key); }
/** * Returns the standard dialog image with the given key. Note that these * images are managed by the dialog framework, and must not be disposed by * another party. * * @param key * one of the <code>Dialog.DLG_IMG_* </code> constants * @return the standard dialog image * * NOTE: Dialog does not use the following images in the registry * DLG_IMG_ERROR DLG_IMG_INFO DLG_IMG_QUESTION DLG_IMG_WARNING * * They are now coming directly from SWT, see ImageRegistry. For backwards * compatibility they are still supported, however new code should use SWT * for these. * * @see Display#getSystemImage(int) */ public static Image getImage(String key) { return JFaceResources.getImageRegistry().get(key); }
/** * Returns the standard dialog image with the given key. Note that these * images are managed by the dialog framework, and must not be disposed by * another party. * * @param key * one of the <code>Dialog.DLG_IMG_* </code> constants * @return the standard dialog image * * NOTE: Dialog does not use the following images in the registry * DLG_IMG_ERROR DLG_IMG_INFO DLG_IMG_QUESTION DLG_IMG_WARNING * * They are now coming directly from SWT, see ImageRegistry. For backwards * compatibility they are still supported, however new code should use SWT * for these. * * @see Display#getSystemImage(int) */ public static Image getImage(String key) { return JFaceResources.getImageRegistry().get(key); }
/** * Sets up the image in the image registry. * * @param iconsRoot * @param fileName * @param key * @throws MalformedURLException */ private void setUpImage(URL iconsRoot, String fileName, String key) throws MalformedURLException { JFaceResources.getImageRegistry().put(key, ImageDescriptor.createFromURL(new URL(iconsRoot, fileName))); }
public Image getImage(String resource) { Image image = JFaceResources.getImageRegistry().get(resource); if (image == null) { image = createImage(resource); } return image; }
protected Image getImageFromURI(String iconURI) { if (iconURI == null || iconURI.length() == 0) return null; ImageRegistry registry = JFaceResources.getImageRegistry(); Image image = registry.get(iconURI); if (image == null) { ImageDescriptor descriptor = resUtils.imageDescriptorFromURI(URI.createURI(iconURI)); registry.put(iconURI, descriptor); image = registry.get(iconURI); } return image; }
FieldDecoration getDecoration() { if (decoration == null) { if (image == null) { if (imageRegistry == null) { imageRegistry = JFaceResources.getImageRegistry(); } image = imageRegistry.get(imageId); } decoration = new FieldDecoration(image, description); } // Null out all other fields now that the decoration has an image description = null; imageId = null; imageRegistry = null; image = null; return decoration; } }
FieldDecoration getDecoration() { if (decoration == null) { if (image == null) { if (imageRegistry == null) { imageRegistry = JFaceResources.getImageRegistry(); } image = imageRegistry.get(imageId); } decoration = new FieldDecoration(image, description); } // Null out all other fields now that the decoration has an image description = null; imageId = null; imageRegistry = null; image = null; return decoration; } }
FieldDecoration getDecoration() { if (decoration == null) { if (image == null) { if (imageRegistry == null) { imageRegistry = JFaceResources.getImageRegistry(); } image = imageRegistry.get(imageId); } decoration = new FieldDecoration(image, description); } // Null out all other fields now that the decoration has an image description = null; imageId = null; imageRegistry = null; image = null; return decoration; } }
public Image createImage(String resource) { ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(XMLUIPlugin.ID, resource); Image image = desc.createImage(); JFaceResources.getImageRegistry().put(resource, image); return image; }
public ImageDescriptor getImageDescriptor(Object object) { String id = getImageId(object); if (id == null) { return null; } ImageDescriptor desc = ProvUIImages.getImageDescriptor(id); if (desc == null) desc = JFaceResources.getImageRegistry().getDescriptor(id); return desc; }
/** * Fetches the label image specific to this object instance. */ public Image getLabelImage(Object node) { Image image = null; if(node instanceof Node) { image = CMImageUtil.getImage(CMImageUtil.getDeclaration((Node) node)); if ((image == null) && (JFaceResources.getImageRegistry() != null)) { ImageRegistry imageRegistry = JFaceResources.getImageRegistry(); String nodeName = getNodeName(node); image = imageRegistry.get(nodeName); if (image == null) { image = createImage(node); if (image != null) { imageRegistry.put(nodeName, image); } } } } return image; }
private void setUpImages() { URL iconsRoot = ProgressManagerUtil.getIconsRoot(); try { setUpImage(iconsRoot, SLEEPING_JOB, SLEEPING_JOB_KEY); setUpImage(iconsRoot, WAITING_JOB, WAITING_JOB_KEY); setUpImage(iconsRoot, BLOCKED_JOB, BLOCKED_JOB_KEY); ImageDescriptor errorImage = ImageDescriptor .createFromURL(new URL(iconsRoot, ERROR_JOB)); JFaceResources.getImageRegistry().put(ERROR_JOB_KEY, errorImage); } catch (MalformedURLException e) { ProgressManagerUtil.logException(e); } }
private int computeDefaultTrimHeight() { int result; Shell shell = new Shell( getDisplay(), SWT.NONE ); try { ToolBar toolBar = new ToolBar( shell, SWT.NONE ); ToolItem toolItem = new ToolItem( toolBar, SWT.PUSH ); toolItem.setImage( JFaceResources.getImageRegistry().get( Dialog.DLG_IMG_MESSAGE_INFO ) ); int toolItemHeight = toolBar.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y; result = Math.max( toolItemHeight, measureText( "Wg" ).y ); } finally { shell.dispose(); } return result; }