List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:com.cloudbees.eclipse.ui.internal.wizard.JenkinsWizard.java
License:Open Source License
public JenkinsWizard(final JenkinsInstance ni) { this.instance = ni; setNeedsProgressMonitor(true);//from ww w . j av a2s. c o m ImageDescriptor id = ImageDescriptor .createFromURL(CloudBeesUIPlugin.getDefault().getBundle().getResource("/icons/cb_wiz_icon2.png")); setDefaultPageImageDescriptor(id); if (ni.label == null) { setWindowTitle("New Jenkins instance"); } else { setWindowTitle("Edit Jenkins instance"); } setForcePreviousAndNextButtons(true); setHelpAvailable(false); this.pageUrl = new JenkinsUrlPage(ni); this.pageFinish = new JenkinsFinishPage(ni); }
From source file:com.clustercontrol.ClusterControlPlugin.java
License:Open Source License
/** * ImageRegistry????//ww w .j a v a 2s . co m * * @param registry * ImageRegistry * @param key * ? * @param fileName * ?? */ private void registerImage(ImageRegistry registry, String key, String fileName) { try { URL url = new URL(getDefault().getBundle().getEntry("/"), "icons/" + fileName); ImageDescriptor desc = ImageDescriptor.createFromURL(url); registry.put(key, desc); } catch (Exception e) { m_log.debug(e.getMessage(), e); } }
From source file:com.clustercontrol.startup.view.StartUpView.java
License:Open Source License
private static Image loadImage(String fileName) { Image image = null;//from w w w . j a v a 2 s .c o m ImageDescriptor desc; try { URL url = new URL(ClusterControlPlugin.getDefault().getBundle().getEntry("/"), "icons/" + fileName); desc = ImageDescriptor.createFromURL(url); } catch (MalformedURLException e1) { desc = ImageDescriptor.getMissingImageDescriptor(); } image = desc.createImage(); return image; }
From source file:com.codesourcery.installer.Installer.java
License:Open Source License
/** * Called to initialize images./*from w w w . ja v a 2 s . c om*/ */ public void initializeImages() { if (imageRegistry == null) { try { imageRegistry = new ImageRegistry(); Bundle bundle = getContext().getBundle(); URL imagePathUrl; imagePathUrl = FileLocator.find(bundle, new Path("icons/bullet-empty.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.BULLET_EMPTY, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/bullet-solid.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.BULLET_SOLID, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/bullet-error.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.BULLET_ERROR, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/bullet-checked.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.BULLET_CHECKED, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/arrow-right.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.ARROW_RIGHT, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/title.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.PAGE_BANNER, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/comp.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.COMPONENT, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/comp-opt.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.COMPONENT_OPTIONAL, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/refresh.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.REFRESH, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/folder.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.FOLDER, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/csl-16x16-32bit.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.TITLE_ICON, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/info.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.INFO, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/error.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.ERROR, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/warning.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WARNING, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait0.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT0, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait1.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT1, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait2.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT2, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait3.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT3, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait4.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT4, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait5.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT5, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait6.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT6, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait7.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT7, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait8.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT8, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait9.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT9, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait10.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT10, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait11.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT11, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait12.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT12, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait13.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT13, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/wait14.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.WAIT14, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/comp-required.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.COMP_REQUIRED_OVERLAY, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/comp-optional.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.COMP_OPTIONAL_OVERLAY, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/comp-addon.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.COMP_ADDON_OVERLAY, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/update-add.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.UPDATE_ADD, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/update-folder.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.UPDATE_FOLDER, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/update-install.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.UPDATE_INSTALL, ImageDescriptor.createFromURL(imagePathUrl)); imagePathUrl = FileLocator.find(bundle, new Path("icons/update-remove.png"), null); //$NON-NLS-1$ imageRegistry.put(IInstallerImages.UPDATE_REMOVE, ImageDescriptor.createFromURL(imagePathUrl)); } catch (Exception e) { log(e); } } }
From source file:com.codesourcery.internal.installer.ContributorRegistry.java
License:Open Source License
/** * Returns the title icon.//from w ww .j a v a 2s.co m * * @return Title icon or <code>null</code> if no icon has been registered */ public Image getTitleIcon() { if (iconImage != null) return iconImage; String plugin = Installer.getDefault().getContext().getBundle().getSymbolicName(); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(plugin, ICON_EXTENSION_ID); IExtension[] extensions = extensionPoint.getExtensions(); for (int i1 = 0; i1 < extensions.length; i1++) { // Loop through the extension elements IConfigurationElement[] elements = extensions[i1].getConfigurationElements(); for (int i2 = 0; i2 < elements.length; i2++) { // Action element IConfigurationElement confElement = elements[i2]; if (!(confElement.getName().equals(ELEMENT_ICON))) //$NON-NLS-1$ continue; else { Bundle bundle = Platform.getBundle(confElement.getContributor().getName()); String iconPath = confElement.getAttribute(ATTRIBUTE_IMAGE); if (iconPath != null) { URL iconURL = FileLocator.find(bundle, new Path(iconPath), null); if (iconURL != null) { ImageDescriptor id = ImageDescriptor.createFromURL(iconURL); iconImage = id.createImage(); return iconImage; } } } } } return null; }
From source file:com.coretek.spte.common.UIPluginImages.java
License:Open Source License
private static ImageDescriptor create(String prefix, String name) { return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); }
From source file:com.drgarbage.bytecodevisualizer.BytecodeVisualizerPlugin.java
License:Apache License
private void registerImage(String path, ImageRegistry registry) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); Bundle bundle = getBundle();// ww w . j a va 2 s . c o m URL url = null; if (bundle != null) { url = FileLocator.find(bundle, new Path(ICONS_PATH + path), null); desc = ImageDescriptor.createFromURL(url); } registry.put(path, desc); }
From source file:com.ecfeed.ui.common.ImageManager.java
License:Open Source License
public ImageDescriptor getImageDescriptor(String fileName) { String path = Constants.ICONS_FOLDER_NAME + "/" + fileName; if (fDescriptors.containsKey(path) == false) { Bundle bundle = FrameworkUtil.getBundle(this.getClass()); URL url = FileLocator.find(bundle, new Path(path), null); fDescriptors.put(path, ImageDescriptor.createFromURL(url)); }/*from w ww. j ava 2 s . com*/ return fDescriptors.get(path); }
From source file:com.elphel.vdt.ui.VDTPluginImages.java
License:Open Source License
private static ImageDescriptor create(String prefix, String name, String key) { ImageDescriptor desc = ImageDescriptor.createFromURL(makeImageURL(prefix, name)); if (key != null) getImageRegistry().put(key, desc); return desc;//from w w w . j a v a2 s.c om }
From source file:com.elphel.vdt.ui.VDTPluginImages.java
License:Open Source License
public static void addImage(String fileName, String key, String launchType) { ImageDescriptor desc = null;/*from w ww .ja va2 s . c om*/ File file = new File(fileName); URL url = null; if (file.isAbsolute()) { desc = ImageDescriptor.createFromFile(null, fileName); } else { url = makeImageURL(ICONS_PATH, fileName); desc = ImageDescriptor.createFromURL(url); } if (key != null) getImageRegistry().put(key, desc); if ((launchType != null) && !VDT.ID_DEFAULT_LAUNCH_TYPE.equals(launchType)) DebugPluginImages.getImageRegistry().put(launchType, desc); // ImageData [] imageData = new ImageLoader().load(new FileInputStream(fileName)); ImageData[] imageData = null; if (url != null) { try { imageData = new ImageLoader().load(url.openStream()); } catch (IOException e) { System.out.println("Failed to open url " + url.toString()); return; } } else { try { imageData = new ImageLoader().load(file.getAbsolutePath()); } catch (Exception e) { System.out.println("Failed to open absolute path " + file.getAbsolutePath()); return; } } if (imageData.length > 1) { animatedGifMap.put(desc, imageData); // System.out.println("animatedGifMap.size()="+animatedGifMap.size()); // System.out.println("imageData.length="+imageData.length); } }