List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:de.uniluebeck.itm.spyglass.gui.configuration.PluginPreferenceDialog.java
License:Open Source License
private ImageDescriptor createImageDescriptor(final String fileName) { return ImageDescriptor.createFromURL(getResourceUrl(fileName)); }
From source file:de.unisiegen.informatik.bs.alvis.ui.navigator.views.AlvisLabelProvider.java
License:Open Source License
@Override protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) { if (element instanceof IProject) { IProject project = (IProject) element; IFolder src = project.getFolder(new Path("src")); //$NON-NLS-1$ IFolder data = project.getFolder(new Path("data")); //$NON-NLS-1$ if (src.exists() && data.exists()) { input = ImageDescriptor.createFromURL(FileLocator.find(Activator.getDefault().getBundle(), new Path("icons/navigator/alvis_project.png"), null)); //$NON-NLS-1$ }//from w w w. j a v a2 s. c o m } return super.decorateImage(input, element); }
From source file:de.unistuttgart.ipvs.pmp.editor.ui.editors.internals.Images.java
License:Apache License
/** * Gets an {@link ImageDescriptor} to a path and icon name inside this * plugin/*w w w . j av a 2 s .co m*/ * * @param path * path without "/" e.g. "icons" * @param iconName * name of the icon with the file ending e.g. "sample.gif" * @return the {@link ImageDescriptor} */ public static ImageDescriptor getImageDescriptor(String path, String iconName) { Bundle bundle = Platform.getBundle("de.unistuttgart.ipvs.pmp.editor"); //$NON-NLS-1$ URL fullPathString = BundleUtility.find(bundle, path + "/" + iconName); //$NON-NLS-1$ return ImageDescriptor.createFromURL(fullPathString); }
From source file:de.uni_koeln.ub.drc.ui.DrcUiActivator.java
License:Open Source License
/** * @param location/* ww w .j a va 2 s . co m*/ * The bundle path of the image to load * @return The loaded image */ public Image loadImage(String location) { IPath path = new Path(location); URL url = FileLocator.find(this.getBundle(), path, Collections.EMPTY_MAP); ImageDescriptor desc = ImageDescriptor.createFromURL(url); return desc.createImage(); }
From source file:de.uni_koeln.ub.drc.ui.facades.SessionContextSingletonImpl.java
License:Open Source License
/** * @param location//w w w . j a v a 2 s . c o m * The bundle path of the image to load * @return The loaded image */ @Override public Image loadImage(String location) { IPath path = new Path(location); URL url = FileLocator.find(DrcUiActivator.getDefault().getBundle(), path, Collections.EMPTY_MAP); ImageDescriptor desc = ImageDescriptor.createFromURL(url); return desc.createImage(); }
From source file:de.walware.ecommons.ui.util.ImageRegistryUtil.java
License:Open Source License
protected ImageDescriptor createDescriptor(final String prefix, final String name) { try {/*w ww.java2 s .c om*/ return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); } catch (final MalformedURLException e) { fPlugin.getLog().log(new Status(IStatus.ERROR, fPlugin.getBundle().getSymbolicName(), 0, "Error occured while loading an image descriptor. (internal, unexpected)", e)); //$NON-NLS-1$ return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:de.walware.statet.r.internal.ui.nolazy.RResourceDecorator.java
License:Open Source License
private ImageDescriptor createOverlayDescriptor(final String id) { final URL url = FileLocator.find(Platform.getBundle(de.walware.statet.r.ui.RUI.PLUGIN_ID), OVR_PATH.append(id + ".png"), null); //$NON-NLS-1$ return ImageDescriptor.createFromURL(url); }
From source file:descent.internal.ui.text.java.CompletionProposalCategory.java
License:Open Source License
CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) { fElement = element;// w w w .ja va2 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:descent.internal.unittest.DescentUnittestPlugin.java
License:Open Source License
/** * Creates an image descriptor for the given path in a bundle. The path can * contain variables like $NL$. If no image could be found, * <code>useMissingImageDescriptor</code> decides if either the 'missing * image descriptor' is returned or <code>null</code>. * //from w w w . j a v a2s. com * @param bundle * @param path * @param useMissingImageDescriptor * @return an {@link ImageDescriptor}, or <code>null</code> iff there's * no image at the given location and * <code>useMissingImageDescriptor</code> is <code>true</code> */ private static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path, boolean useMissingImageDescriptor) { URL url = FileLocator.find(bundle, path, null); if (url != null) { return ImageDescriptor.createFromURL(url); } if (useMissingImageDescriptor) { return ImageDescriptor.getMissingImageDescriptor(); } return null; }
From source file:distributed.plugin.ui.actions.AddStateRetargetAction.java
License:Open Source License
/** * @param actionID//from w w w .j av a2s .c om * @param text */ public AddStateRetargetAction(String actionID, String text) { super(actionID, text); try { final URL installUrl = Activator.getDefault().getBundle().getEntry("/"); final URL imageUrl = new URL(installUrl, "icons/add_state.png"); setImageDescriptor(ImageDescriptor.createFromURL(imageUrl)); } catch (MalformedURLException e) { } setToolTipText(text); }