List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:bndtools.wizards.project.NewBndProjectWizard.java
License:Open Source License
@Override public void init(IWorkbench workbench, IStructuredSelection currentSelection) { super.init(workbench, currentSelection); BuiltInTemplate baseTemplate = new BuiltInTemplate(EMPTY_TEMPLATE_NAME, DEFAULT_TEMPLATE_ENGINE); baseTemplate.addInputResource(Project.BNDFILE, new StringResource("")); //$NON-NLS-1$ baseTemplate.setHelpPath("docs/empty_project.xml"); //$NON-NLS-1$ templatePage = new ProjectTemplateSelectionWizardPage("projectTemplateSelection", "project", baseTemplate); templatePage.setTitle("Select Project Template"); paramsPage = new TemplateParamsWizardPage(ProjectTemplateParam.valueStrings()); templatePage.addPropertyChangeListener(TemplateSelectionWizardPage.PROP_TEMPLATE, new PropertyChangeListener() { @Override//from w w w. ja va2s .c o m public void propertyChange(PropertyChangeEvent evt) { Template template = templatePage.getTemplate(); pageOne.setTemplate(template); paramsPage.setTemplate(template); } }); setDefaultPageImageDescriptor(ImageDescriptor .createFromURL(Plugin.getDefault().getBundle().getEntry("icons/bndtools-wizban.png"))); }
From source file:br.com.santos.celeste.outros.ResourceManager.java
License:Open Source License
/** * Returns an {@link ImageDescriptor} stored in the file at the specified path. * //from www . j av a 2 s . com * @param path * the path to the image file. * @return the {@link ImageDescriptor} stored in the file at the specified path. */ public static ImageDescriptor getImageDescriptor(String path) { try { return ImageDescriptor.createFromURL(new File(path).toURI().toURL()); } catch (MalformedURLException e) { return null; } }
From source file:br.com.santos.celeste.outros.ResourceManager.java
License:Open Source License
/** * Returns an {@link ImageDescriptor} based on a plugin and file path. * //from w w w. j a v a 2 s. com * @param plugin * the plugin {@link Object} containing the image. * @param name * the path to th eimage within the plugin. * @return the {@link ImageDescriptor} stored in the file at the specified path. * * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead. */ @Deprecated public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) { try { try { URL url = getPluginImageURL(plugin, name); return ImageDescriptor.createFromURL(url); } catch (Throwable e) { // Ignore any exceptions } } catch (Throwable e) { // Ignore any exceptions } return null; }
From source file:br.com.santos.celeste.outros.ResourceManager.java
License:Open Source License
/** * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. * //from w w w .ja va 2 s .c o m * @param symbolicName * the symbolic name of the {@link Bundle}. * @param path * the path of the resource entry. * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. */ public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) { try { URL url = getPluginImageURL(symbolicName, path); if (url != null) { return ImageDescriptor.createFromURL(url); } } catch (Throwable e) { // Ignore any exceptions } return null; }
From source file:ca.concordia.todolist.ui.core.Util.java
License:Open Source License
/** * Returns the associated image descriptor for the given image file name * @param name the image file name/*from w w w. jav a2s . c om*/ * @return the associated image descriptor for the given image file name */ public static ImageDescriptor getImageDescriptor(String name) { String iconPath = "icons/"; try { File currentDir = new File(System.getProperty("user.dir")); URL baseUrl = currentDir.toURI().toURL(); URL url = new URL(baseUrl, iconPath + name); return ImageDescriptor.createFromURL(url); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:ca.maestrosoft.eclipse.cdt.plugin.studio.option.ui.MaestroFileListControl.java
License:Open Source License
private static Image getImage(String imgFilelistRelpath) { URL urlImage = FileLocator.find(Activator.getDefault().getBundle(), new Path(imgFilelistRelpath), null); ImageDescriptor imageDesc = ImageDescriptor.createFromURL(urlImage); ImageRegistry registry = Activator.getDefault().getImageRegistry(); Image image = registry.get(imgFilelistRelpath); if (image == null) { registry.put(imgFilelistRelpath, imageDesc); }//from w ww . j ava 2 s . c om return registry.get(imgFilelistRelpath); }
From source file:ca.mcgill.sable.soot.SootPlugin.java
License:Open Source License
public static ImageDescriptor getImageDescriptor(String name) { try {//from www.ja v a2 s .com URL installURL = getDefault().getDescriptor().getInstallURL(); URL iconURL = new URL(installURL, ISootConstants.ICON_PATH + name); return ImageDescriptor.createFromURL(iconURL); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:ca.usask.cs.srlab.simclipse.SimClipsePluginImages.java
License:Open Source License
public static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path, boolean useMissingImageDescriptor) { URL url = FileLocator.find(bundle, path, null); if (url != null) { return ImageDescriptor.createFromURL(url); }/*from w w w .j av a2 s . c om*/ if (useMissingImageDescriptor) { return ImageDescriptor.getMissingImageDescriptor(); } return null; }
From source file:carisma.ui.eclipse.CarismaGUI.java
License:Open Source License
@Override protected final void initializeImageRegistry(final ImageRegistry registry) { Bundle bundle = Platform.getBundle(PLUGIN_ID); IPath path = new Path("icons/successful.png"); URL url = FileLocator.find(bundle, path, null); ImageDescriptor desc = ImageDescriptor.createFromURL(url); registry.put(IMG_SUCCESSFUL_ID, desc); path = new Path("icons/error.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_ERROR_ID, desc);//from ww w . j av a2 s .c o m path = new Path("icons/info.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_INFO_ID, desc); path = new Path("icons/warning.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_WARNING_ID, desc); path = new Path("icons/successfulwarning.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_SUCCESSWARNING_ID, desc); path = new Path("icons/successfulerror.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_SUCCESSERROR_ID, desc); path = new Path("icons/running.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_RUNNING_ID, desc); path = new Path("icons/up.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_UP, desc); path = new Path("icons/down.png"); url = FileLocator.find(bundle, path, null); desc = ImageDescriptor.createFromURL(url); registry.put(IMG_DOWN, desc); }
From source file:cc.warlock.rcp.stormfront.ui.StormFrontSharedImages.java
License:Open Source License
private void addImage(String path) { Bundle pluginBundle = StormFrontRCPPlugin.getDefault().getBundle(); ImageDescriptor descriptor = ImageDescriptor.createFromURL(pluginBundle.getEntry(path)); descriptors.put(path, descriptor);/*from w w w . j a va 2 s . c om*/ images.put(path, descriptor.createImage()); }