List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:com.windowtester.runtime.swt.internal.preferences.ProductPreferencePage.java
License:Open Source License
/** * Answer the product's banner image descriptor. * //from www . j a v a 2 s. c om * @return the banner image descriptor or <code>null</code> if no banner image is * defined for this product */ protected ImageDescriptor getBannerImageDescriptor() { String pluginId = support.getProduct().getPluginId(); String imagePath = getBannerImagePath(); if (imagePath == null) return null; URL bannerImageUrl = PluginUtilities.getUrl(pluginId, imagePath); if (bannerImageUrl == null) return null; return ImageDescriptor.createFromURL(bannerImageUrl); }
From source file:com.windowtester.swt.util.ImageManager.java
License:Open Source License
/** * Creates an image descriptor for a given image directory prefix and * image name. The image prefix is appended to the * {@link #iconBaseURL base icon url}/*from www. ja v a2 s. com*/ * @param prefix * @param name * @return ImageDescriptor */ protected ImageDescriptor createImageDescriptor(String prefix, String name) { try { return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:com.xored.glance.internal.ui.GlancePlugin.java
License:Open Source License
private static ImageDescriptor getImageDescriptor(String path, boolean addToRegistry) { ImageDescriptor imageDescriptor = getDefault().getImageRegistry().getDescriptor(path); if (imageDescriptor == null) { imageDescriptor = ImageDescriptor.createFromURL(makeImageURL(path)); if (addToRegistry) { getDefault().getImageRegistry().put(path, imageDescriptor); }// ww w . j a va 2 s . c o m } return imageDescriptor; }
From source file:com.zenika.doclipser.api.DockerClientMessageConsole.java
License:Open Source License
public DockerClientMessageConsole(String name) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) { if (name.equals(existing[i].getName())) { dockerMessageConsole = (MessageConsole) existing[i]; dockerConsoleOut = dockerMessageConsole.newMessageStream(); return; }/*ww w.ja v a 2s .c o m*/ } // no console found, so create a new one Bundle bundle = Platform.getBundle("com.zenika.doclipser.api"); ImageDescriptor imageDcr = ImageDescriptor .createFromURL(FileLocator.find(bundle, new Path("icons/docker-solo.gif"), null)); MessageConsole dockerConsole = new MessageConsole(name, imageDcr); conMan.addConsoles(new IConsole[] { dockerConsole }); dockerMessageConsole = dockerConsole; dockerConsoleOut = dockerMessageConsole.newMessageStream(); // Currently does not work: win is always null // (I guess because we are not in the main UI Thread) // // // get current active page // IWorkbench wb = PlatformUI.getWorkbench(); // IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); // // // on new versions it may need to be changed to: // IWorkbenchPage page = win.getActivePage(); // // // Reveal the console view // String id = IConsoleConstants.ID_CONSOLE_VIEW; // IConsoleView view; // try { // view = (IConsoleView) page.showView(id); // view.display(dockerConsole); // } catch (PartInitException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } }
From source file:cz.cvut.kbss.owldiff.neonplugin.views.ODActions.java
License:Open Source License
/** * Method creates an instance of the action and put it to the actionMap * hashmap./*from w w w .ja v a 2 s . c o m*/ * * @param actionEnum - * identifies the particular action * @see OWLDiffAction * @param relativeIconName - * name of the icon representing the particular action in the GUI * @param actionRunnable - * its run() method will be carried out when the action is * invoked * @throws IOException */ private void setupAction(final Action a, final OWLDiffAction actionEnum, final String relativeIconName, final int styleConstant) { ImageDescriptor imageDescr = null; // KeyStroke keyStroke = (KeyStroke) actionEnum.getKeyStroke(); // a.setAccelerator(keyStroke.getKeyCode() | SWT.CTRL);// // keyStroke.getModifiers()); imageDescr = ImageDescriptor.createFromURL(ODActions.class.getClassLoader().getResource(relativeIconName)); a.setImageDescriptor(imageDescr); a.setEnabled(false); actionMap.put(actionEnum, a); }
From source file:de.anbos.eclipse.easyshell.plugin.Activator.java
License:Open Source License
protected void addImageToRegistry(ImageRegistry registry, Bundle bundle, String imagePath, String image_id) { IPath path = new Path(imagePath); URL url = FileLocator.find(bundle, path, null); ImageDescriptor desc = ImageDescriptor.createFromURL(url); registry.put(image_id, desc);//from w ww .j a va 2 s .c o m }
From source file:de.anbos.eclipse.logviewer.plugin.UIImages.java
License:Apache License
private static void declareRegistryImage(String key, String path) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); try {//from ww w . j a v a 2s .c o m desc = ImageDescriptor.createFromURL(makeIconFileURL(path)); } catch (MalformedURLException me) { LogViewerPlugin.getDefault().showErrorMessage(me); } imageRegistry.put(key, desc); }
From source file:de.berlios.svgcompost.provider.SVGEditorPaletteFactory.java
License:Apache License
private static PaletteContainer createElementsDrawer() { PaletteDrawer componentsDrawer = new PaletteDrawer("SVG Elements"); CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry("Ellipse", "Create an ellipse", SVGEllipseElement.class, new SVGElementCreationFactory(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ELLIPSE_TAG), ImageDescriptor.createFromURL( SVGCompostPlugin.getDefault().getBundle().getResource("icons/ellipse16.gif")), ImageDescriptor.createFromURL( SVGCompostPlugin.getDefault().getBundle().getResource("icons/ellipse16.gif"))); componentsDrawer.add(component);//from w w w.j a va 2s. c o m component = new CombinedTemplateCreationEntry("Rectangle", "Create a rectangle", SVGRectElement.class, new SVGElementCreationFactory(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_RECT_TAG), ImageDescriptor.createFromURL( SVGCompostPlugin.getDefault().getBundle().getResource("icons/rectangle16.gif")), ImageDescriptor.createFromURL( SVGCompostPlugin.getDefault().getBundle().getResource("icons/rectangle16.gif"))); componentsDrawer.add(component); ToolEntry setOriginEntry = new ToolEntry("Set Origin", "Set a new origin while keeping everything in place", null, null, SetOriginTool.class) { }; componentsDrawer.add(setOriginEntry); return componentsDrawer; }
From source file:de.bmw.yamaica.ea.ui.internal.Activator.java
License:Mozilla Public License
@Override protected void initializeImageRegistry(ImageRegistry imageRegistry) { Map<String, Resource> resources = Resources.getResources(getBundle()); for (Resource resource : resources.values()) { Bundle bundle = Platform.getBundle(resource.getBundleId()); IPath path = new Path(resource.getPath()); URL url = FileLocator.find(bundle, path, null); imageRegistry.put(resource.getName(), ImageDescriptor.createFromURL(url)); }/*from w w w . j av a2 s. co m*/ }
From source file:de.devboost.eclipse.feedback.util.ImageHelper.java
License:Open Source License
public ImageDescriptor getImage(String urlText) throws MalformedURLException { URL url = new URL(urlText); ImageDescriptor rawDescriptor = ImageDescriptor.createFromURL(url); ImageDescriptor cachedDescriptor = new CachedImageDescriptor(rawDescriptor); if (cachedDescriptor.getImageData() != null) { return cachedDescriptor; }/* ww w.j a v a2 s. c o m*/ return null; }