List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:com.persistent.ui.decorator.LightWeightDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if (element instanceof IProject) { try {/*from ww w . j a v a 2 s . c o m*/ IProject project = (IProject) element; if (!project.isOpen() || !project.hasNature(WAProjectNature.NATURE_ID)) { return; } URL url = null; URL resolve = null; url = Activator.getDefault().getBundle().getEntry(Messages.projFolder); URL fileURL = FileLocator.toFileURL(url); resolve = FileLocator.resolve(fileURL); ImageDescriptor overlay = ImageDescriptor.createFromURL(resolve); decoration.addOverlay(overlay, IDecoration.TOP_LEFT); } catch (Exception e) { //This class sets the icons for folders, which is not an user //initiated process so only logging the exception. Activator.getDefault().log(Messages.errProjIcon, e); } } else if (element instanceof IFolder) { IFolder folder = (IFolder) element; IProject project = folder.getProject(); try { if (!project.isOpen() || !project.hasNature(WAProjectNature.NATURE_ID)) { return; } WindowsAzureProjectManager projMngr = WindowsAzureProjectManager .load(project.getLocation().toFile()); WindowsAzureRole role = projMngr.roleFromPath(folder.getLocation().toFile()); if (role == null) { return; } URL url = null; URL resolve = null; url = Activator.getDefault().getBundle().getEntry(Messages.roleFolder); URL fileURL = FileLocator.toFileURL(url); resolve = FileLocator.resolve(fileURL); ImageDescriptor overlay = ImageDescriptor.createFromURL(resolve); decoration.addOverlay(overlay, IDecoration.TOP_RIGHT); } catch (Exception e) { //This class sets the icons for folders, which is not an user //initiated process so only logging the exception. Activator.getDefault().log(Messages.errRoleIcon, e); } } }
From source file:com.photon.phresco.ui.wizards.PhrescoProjectWizard.java
License:Apache License
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { ImageDescriptor myImage = ImageDescriptor.createFromURL( FileLocator.find(Activator.getDefault().getBundle(), new Path("icons/phresco.png"), null)); super.setDefaultPageImageDescriptor(myImage); super.setNeedsProgressMonitor(true); super.setWindowTitle("Phresco"); try {/*from w w w . java 2 s .c o m*/ doLogin(); } catch (PhrescoException e) { e.printStackTrace(); } }
From source file:com.platzerworld.e4.biergarten.login.internal.LoginDialog.java
License:Open Source License
public ImageDescriptor imageDescriptorFromURI(URI iconPath) { try {/*from ww w . j a v a2 s . co m*/ return ImageDescriptor.createFromURL(new URL(iconPath.toString())); } catch (MalformedURLException e) { System.err.println( "iconURI \"" + iconPath.toString() + "\" is invalid, a \"missing image\" icon will be shown"); return ImageDescriptor.getMissingImageDescriptor(); } }
From source file:com.pps.webos.WebOSEclipsePlugin.java
License:Open Source License
/** * Since 3.1.1. Load from icon paths with $NL$ * // ww w .ja v a 2s.c o m * @param bundle * @param path * @return */ public static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path) { URL url = FileLocator.find(bundle, path, null); if (url != null) { return ImageDescriptor.createFromURL(url); } return ImageDescriptor.getMissingImageDescriptor(); }
From source file:com.puppetlabs.geppetto.pp.dsl.ui.internal.PPPluginImages.java
License:Open Source License
private static ImageDescriptor create(String prefix, String name) { return ImageDescriptor.createFromURL(makeImageURL(prefix, name)); }
From source file:com.quantcomponents.ui.algo.TradingAgentPlugin.java
License:Open Source License
@Override protected void initializeImageRegistry(ImageRegistry registry) { super.initializeImageRegistry(registry); registry.put(TRADING_AGENT_MANAGER_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(TRADING_AGENT_MANAGER_IMAGE_PATH), null))); registry.put(TRADING_AGENT_FACTORY_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(TRADING_AGENT_FACTORY_IMAGE_PATH), null))); registry.put(TRADING_AGENT_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(TRADING_AGENT_IMAGE_PATH), null))); registry.put(TRADING_AGENT_BINDING_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(TRADING_AGENT_BINDING_IMAGE_PATH), null))); registry.put(TRADING_AGENT_EXECUTION_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(TRADING_AGENT_EXECUTION_IMAGE_PATH), null))); registry.put(UNKNOWN_OBJECT_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(UNKNOWN_OBJECT_IMAGE_PATH), null))); registry.put(DECORATOR_RUNNING_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(DECORATOR_RUNNING_IMAGE_PATH), null))); registry.put(DECORATOR_PAUSED_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(DECORATOR_PAUSED_IMAGE_PATH), null))); }
From source file:com.quantcomponents.ui.marketdata.MarketDataPlugin.java
License:Open Source License
@Override protected void initializeImageRegistry(ImageRegistry registry) { super.initializeImageRegistry(registry); registry.put(MARKET_DATA_MANAGER_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(MARKET_DATA_MANAGER_IMAGE_PATH), null))); registry.put(STOCK_DATABASE_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(STOCK_DATABASE_IMAGE_PATH), null))); registry.put(UNKNOWN_OBJECT_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(UNKNOWN_OBJECT_IMAGE_PATH), null))); registry.put(DECORATOR_AUTOUPDATE_IMAGE_KEY, ImageDescriptor .createFromURL(FileLocator.find(getBundle(), new Path(DECORATOR_AUTOUPDATE_IMAGE_PATH), null))); }
From source file:com.rainerschuster.webidl.ui.wizard.WebIDLNewFileResourceWizard.java
License:Apache License
protected void initializeDefaultPageImageDescriptor() { try {//from ww w . j a va 2 s .c om final ImageDescriptor desc = ImageDescriptor .createFromURL(new URL("platform:/plugin/com.rainerschuster.webidl.ui/icons/logo.png")); //$NON-NLS-1$ // ImageDescriptor desc = IDEWorkbenchPlugin.getIDEImageDescriptor("icons/logo.png");//$NON-NLS-1$ setDefaultPageImageDescriptor(desc); } catch (MalformedURLException e) { e.printStackTrace(); } }
From source file:com.rcpcompany.utils.extensionpoints.CEResourceHolder.java
License:Open Source License
/** * Returns the image descriptor for the holder object. * //from w w w . j av a 2s.c o m * @return the image or <code>null</code> */ public ImageDescriptor getImageDescriptor() { if (myImageDescriptor == null) { final String imageName = myCE.getAttribute(myAttrName); if (imageName == null) return null; final Bundle bundle = Platform.getBundle(myCE.getContributor().getName()); URL url = FileLocator.find(bundle, new Path(imageName), null); if (url == null) { try { url = new URL(imageName); } catch (final MalformedURLException e) { return null; } } if (url == null) return null; myImageDescriptor = ImageDescriptor.createFromURL(url); ; } return myImageDescriptor; }
From source file:com.reprezen.swagedit.Activator.java
License:Open Source License
private ImageDescriptor getImageDescriptor(Bundle bundle, String pathName) { Path path = new Path(pathName); return ImageDescriptor.createFromURL(FileLocator.find(bundle, path, null)); }