List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:com.google.dart.tools.ui.internal.text.dart.CompletionProposalCategory.java
License:Open Source License
CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) { fElement = element;/*from ww w. j av a 2 s .c o m*/ fRegistry = registry; IExtension parent = (IExtension) element.getParent(); fId = parent.getUniqueIdentifier(); checkNotNull(fId, "id"); //$NON-NLS-1$ String name = parent.getLabel(); if (name == null) { fName = fId; } else { fName = name; } String icon = element.getAttribute(ICON); ImageDescriptor img = null; if (icon != null) { Bundle bundle = getBundle(); if (bundle != null) { Path path = new Path(icon); URL url = FileLocator.find(bundle, path, null); img = ImageDescriptor.createFromURL(url); } } fImage = img; }
From source file:com.google.eclipse.elt.emulator.impl.TerminalPlugin.java
License:Open Source License
protected void putImageInRegistry(ImageRegistry imageRegistry, String strKey, String relativePath) { URL url = TerminalPlugin.getDefault().getBundle().getEntry(relativePath); ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); imageRegistry.put(strKey, imageDescriptor); }
From source file:com.google.eclipse.elt.view.Activator.java
License:Open Source License
private void addImage(ImageRegistry registry, String key, String path) { URL imageUrl = instance().getBundle().getEntry(path); registry.put(key, ImageDescriptor.createFromURL(imageUrl)); }
From source file:com.google.eclipse.javascript.jstestdriver.ui.Icons.java
License:Apache License
/** * The icon used in the button to Start the server. *///from w w w . j av a2 s. c o m public ImageDescriptor startServerIcon() { return ImageDescriptor.createFromURL(getImageFileUrl("icons/startServer.png")); }
From source file:com.google.eclipse.javascript.jstestdriver.ui.Icons.java
License:Apache License
/** * The icon used in the button to Stop the server. */// w w w. ja v a 2 s . com public ImageDescriptor stopServerIcon() { return ImageDescriptor.createFromURL(getImageFileUrl("icons/stopServer.png")); }
From source file:com.google.eclipse.javascript.jstestdriver.ui.Icons.java
License:Apache License
/** * Gets the grayed out icon for the given icon image. * @param iconPath the path to the icon. * @return the grayed out image./*from ww w . ja v a 2 s .c o m*/ */ public Image getGrayedIcon(String iconPath) { synchronized (this) { if (!greyedImages.containsKey(iconPath)) { greyedImages.put(iconPath, new Image(Display.getCurrent(), ImageDescriptor.createFromURL(getImageFileUrl(iconPath)).createImage(), SWT.IMAGE_GRAY)); } return greyedImages.get(iconPath); } }
From source file:com.google.eclipse.javascript.jstestdriver.ui.Icons.java
License:Apache License
/** * Returns an image from the given path. Makes sure that only one instance of an image is passed * around even if multiple requests are made for the path. Callers should not worry about * releasing the image resource, as that will be handled by the Activator at the end of the * plugin's lifecycle./*from w ww . j a va 2 s.c om*/ * * @param imagePath The path to the image. * @return the image */ public Image getImage(String imagePath) { synchronized (this) { if (!images.containsKey(imagePath)) { images.put(imagePath, ImageDescriptor.createFromURL(getImageFileUrl(imagePath)).createImage()); } return images.get(imagePath); } }
From source file:com.google.gdt.eclipse.designer.hosted.tdt.Activator.java
License:Open Source License
/** * Get image descriptor from "icons" directory. *//*from w ww .ja va 2 s. co m*/ public static ImageDescriptor getImageDescriptor(String name) { URL url = m_plugin.getBundle().getEntry("icons/" + name); return ImageDescriptor.createFromURL(url); }
From source file:com.google.gdt.eclipse.login.ui.LoginTrimContribution.java
License:Open Source License
private static Image getIcon(String name) { try {/*from www .j av a2 s . co m*/ URL url = new URL(GoogleLoginPlugin.getDefault().getBundle().getEntry("/"), "icons/" + name); return ImageDescriptor.createFromURL(url).createImage(); } catch (Exception e) { GoogleLoginPlugin.logError("Could not load icon '" + name + "'", e); return null; } }
From source file:com.google.gdt.eclipse.managedapis.BaseResources.java
License:Open Source License
/** * Provides method to access the 16x16 icon used for the classpath container. *///from www. ja v a 2 s . c o m public ImageDescriptor getGoogleAPIContainerIcon16ImageDescriptor() throws MalformedURLException { URL updateAvailableImageUrl = getURLForLocalPath(ManagedApiConstants.ICON_16_GOOGLE_API_CONTAINER); return ImageDescriptor.createFromURL(updateAvailableImageUrl); }