List of usage examples for org.eclipse.jface.resource ImageDescriptor ImageDescriptor
protected ImageDescriptor()
From source file:org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramImageGenerator.java
License:Open Source License
protected ImageDescriptor getImageDescriptor(Graphics g) { return new ImageDescriptor() { ImageData imgData = image.getImageData(); /*/*www. ja va 2s.c o m*/ * (non-Javadoc) * * @see org.eclipse.jface.resource.ImageDescriptor#getImageData() */ public ImageData getImageData() { return imgData; } }; }
From source file:org.eclipse.papyrus.infra.widgets.toolbox.utils.ToolbooxImageUtils.java
License:Open Source License
/** * Returns an image descriptor according to {@link ISharedImages} * //from www . ja va 2s . c om * @param id * , the constant * @return */ public static ImageDescriptor getImageDescriptor(final int id) { return new ImageDescriptor() { @Override public ImageData getImageData() { return getImage(id).getImageData(); } }; }
From source file:org.eclipse.richbeans.widgets.Activator.java
License:Open Source License
public static ImageDescriptor getImageDesciptor(String iconPath) { if (context == null) { // Testing final File file = new File("../org.eclipse.richbeans.widgets/" + iconPath); final ImageData data = file.exists() ? new ImageData(file.getAbsolutePath()) : new ImageData(16, 16, 24, new PaletteData(0xff0000, 0x00ff00, 0x0000ff)); return new ImageDescriptor() { @Override//from ww w. j a v a 2s . c om public ImageData getImageData() { return data; } }; } Bundle bundle = context.getBundle(); // look for the image (this will check both the plugin and fragment // folders URL fullPathString = bundle.getEntry(iconPath); if (fullPathString == null) { try { fullPathString = new URL(iconPath); } catch (MalformedURLException e) { return null; } } return ImageDescriptor.createFromURL(fullPathString); }
From source file:org.eclipse.richbeans.widgets.file.Activator.java
License:Open Source License
public static ImageDescriptor getImageDescriptor(String path) { if (plugin == null) { // Testing final File file = new File("../" + PLUGIN_ID + "/" + path); final ImageData data = file.exists() ? new ImageData(file.getAbsolutePath()) : new ImageData(16, 16, 24, new PaletteData(0xff0000, 0x00ff00, 0x0000ff)); return new ImageDescriptor() { @Override//from w w w .j a va 2 s .c om public ImageData getImageData() { return data; } }; } return imageDescriptorFromPlugin(PLUGIN_ID, path); }
From source file:org.eclipse.scanning.device.ui.Activator.java
License:Open Source License
public static ImageDescriptor getImageDescriptor(String path) { if (plugin == null) { final ImageData data = new ImageData("../" + PLUGIN_ID + "/" + path); return new ImageDescriptor() { @Override//from w ww .j ava 2 s. c o m public ImageData getImageData() { return data; } }; } return imageDescriptorFromPlugin(PLUGIN_ID, path); }
From source file:org.kalypso.contribs.eclipse.swt.udig.AWTSWTImageUtils.java
License:Open Source License
public static ImageDescriptor createImageDescriptor(final RenderedImage image, final boolean transparent) { AWTSWTImageUtils.checkAccess();/*from ww w . ja v a 2 s . com*/ return new ImageDescriptor() { @Override public ImageData getImageData() { return createImageData(image, transparent); } }; }
From source file:org.kalypso.contribs.eclipse.swt.udig.AWTSWTImageUtils.java
License:Open Source License
/** * Creates an image descriptor that from the source image. * /* www.ja v a 2 s. c o m*/ * @param image * source image * @return an image descriptor that from the source image. */ public static ImageDescriptor createImageDescriptor(final BufferedImage image) { AWTSWTImageUtils.checkAccess(); return new ImageDescriptor() { @Override public ImageData getImageData() { return AWTSWTImageUtils.createImageData(image); } }; }
From source file:org.kalypso.contribs.eclipse.swt.udig.AWTSWTImageUtils.java
License:Open Source License
/** * Converts a Swing {@link Icon} to an {@link ImageDescriptor} * //from w w w . j ava 2 s . c o m * @param icon * icon to convert * @return an ImageDescriptor */ public static ImageDescriptor awtIcon2ImageDescriptor(final Icon icon) { final ImageDescriptor descriptor = new ImageDescriptor() { @Override public ImageData getImageData() { final BufferedImage image = createBufferedImage(icon.getIconWidth(), icon.getIconHeight()); final Graphics2D g = image.createGraphics(); try { icon.paintIcon(null, g, 0, 0); } finally { g.dispose(); } final ImageData data = createImageData(image); return data; } }; return descriptor; }
From source file:org.locationtech.udig.catalog.ui.CatalogUIPlugin.java
License:Open Source License
/** * Create icon for provided resource, this will block! * /* ww w .ja va2s.c om*/ * @param resource * @param monitor used to track progress in fetching an appropriate icon * @return ImageDescriptor for resource. * @throws IOException */ public static ImageDescriptor icon(final IResolve resolve, IProgressMonitor monitor) throws IOException { if (resolve.canResolve(ImageDescriptor.class)) { ImageDescriptor descriptor = resolve.resolve(ImageDescriptor.class, monitor); if (descriptor != null) { return descriptor; } } if (resolve instanceof IGeoResource) { ImageDescriptor icon = icon((IGeoResource) resolve, monitor); return icon != null ? icon : new ImageDescriptor() { public ImageData getImageData() { return image(resolve).getImageData(); } }; } if (resolve instanceof IService) { ImageDescriptor icon = icon((IService) resolve, monitor); if (icon != null) { return icon; } return CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.SERVER_OBJ); } if (resolve instanceof IResolveFolder) { ImageDescriptor icon = icon((IResolveFolder) resolve, monitor); return icon != null ? icon : CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.FOLDER_OBJ); } if (resolve instanceof ICatalog) return CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.CATALOG_OBJ); return CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.RESOURCE_OBJ); }
From source file:org.locationtech.udig.style.sld.StyleGlyph.java
License:Open Source License
private static ImageDescriptor descriptor(ImageData imageData, Image image, GC gc) { final ImageData finalImageData = (ImageData) image.getImageData().clone(); image.dispose();/*from ww w .j a v a2 s .com*/ gc.dispose(); return new ImageDescriptor() { public ImageData getImageData() { return finalImageData; } }; }