Java Code Examples for org.eclipse.jface.resource.ImageDescriptor#createFromURL()
The following examples show how to use
org.eclipse.jface.resource.ImageDescriptor#createFromURL() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZoomOutToolEntry.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private static ImageDescriptor findIconImageDescriptor(String iconPath) { String pluginId = "org.eclipse.gmf.runtime.diagram.ui.providers"; Bundle bundle = Platform.getBundle(pluginId); try { if (iconPath != null) { URL fullPathString = FileLocator.find(bundle, new Path(iconPath), null); fullPathString = fullPathString != null ? fullPathString : new URL(iconPath); if (fullPathString != null) { return ImageDescriptor.createFromURL(fullPathString); } } } catch (MalformedURLException e) { Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, DefaultPaletteProvider.class, e.getLocalizedMessage(), e); Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.RESOURCE_FAILURE, e.getMessage(), e); } return null; }
Example 2
Source File: NextAction.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * <p> * The constructor * </p> * * @param parent * <p> * The ViewPart to whom the object of this class belongs. * </p> */ public NextAction(PlayableViewPart parent) { viewer = parent; this.setText("Next"); Bundle bundle = FrameworkUtil.getBundle(getClass()); Path imagePath = new Path( "icons" + System.getProperty("file.separator") + "next.gif"); URL imageURL = FileLocator.find(bundle, imagePath, null); ImageDescriptor imageDescriptor = ImageDescriptor .createFromURL(imageURL); this.setImageDescriptor(imageDescriptor); return; }
Example 3
Source File: ZoomInToolEntry.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private static ImageDescriptor findIconImageDescriptor(String iconPath) { String pluginId = "org.eclipse.gmf.runtime.diagram.ui.providers"; Bundle bundle = Platform.getBundle(pluginId); try { if (iconPath != null) { URL fullPathString = FileLocator.find(bundle, new Path(iconPath), null); fullPathString = fullPathString != null ? fullPathString : new URL(iconPath); if (fullPathString != null) { return ImageDescriptor.createFromURL(fullPathString); } } } catch (MalformedURLException e) { Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, DefaultPaletteProvider.class, e.getLocalizedMessage(), e); Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.RESOURCE_FAILURE, e.getMessage(), e); } return null; }
Example 4
Source File: DotnetExportWizardPage.java From aCute with Eclipse Public License 2.0 | 6 votes |
protected DotnetExportWizardPage(IFile projectFile) { super(DotnetExportWizardPage.class.getName()); setTitle(Messages.DotnetExportWizardPage_exportProject_title); setDescription(Messages.DotnetExportWizardPage_exportProject_message); Bundle bundle = FrameworkUtil.getBundle(this.getClass()); URL url = bundle.getEntry("images/dotnet.png"); //$NON-NLS-1$ ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); setImageDescriptor(imageDescriptor); if (projectFile != null) { projectPath = new Path(projectFile.getRawLocation().toString()); } targetFrameworks = ProjectFileAccessor.getTargetFrameworks(projectPath); defaultRuntime = DotnetExportAccessor.getDefaultRuntime(); }
Example 5
Source File: PlayAction.java From ice with Eclipse Public License 1.0 | 5 votes |
/** * <p> * The constructor * </p> * * @param parent * <p> * The PlayableViewPart to whom the object of this class belongs. * </p> */ public PlayAction(PlayableViewPart parent) { // Call this class' super constructor for a drop-down menu and declare // this class as the menu creator super(null, IAction.AS_DROP_DOWN_MENU); setMenuCreator(this); // Store the calling class in the local field viewer = parent; // Set the text of the "hover" display this.setText("Play"); // Set the button image Bundle bundle = FrameworkUtil.getBundle(getClass()); Path imagePath = new Path( "icons" + System.getProperty("file.separator") + "play.gif"); URL imageURL = FileLocator.find(bundle, imagePath, null); ImageDescriptor imageDescriptor = ImageDescriptor .createFromURL(imageURL); this.setImageDescriptor(imageDescriptor); // Create the drop-down selections for 12, 24, and 30 fps and a // selection to access the custom frame rate dialog FrameRateChangeAction fps12 = new FrameRateChangeAction(12, this, "12fps"); rateActions.add(fps12); FrameRateChangeAction fps24 = new FrameRateChangeAction(24, this, "24fps"); rateActions.add(fps24); FrameRateChangeAction fps30 = new FrameRateChangeAction(30, this, "30fps"); rateActions.add(fps30); FrameRateChangeAction fpsCustom = new FrameRateChangeAction(this, "Custom..."); rateActions.add(fpsCustom); return; }
Example 6
Source File: ImageUtils.java From developer-studio with Apache License 2.0 | 5 votes |
/** * create ImageDescriptor * @param imgName * @return */ private ImageDescriptor createImageDescriptor(String imgName) { if (imgName == null) return null; ImageDescriptor imageDescriptor = null; IPath path = new Path(getImageDirectoryName() + imgName); URL gifImageURL = FileLocator.find(getBundle(), path, null); if (gifImageURL != null){ imageDescriptor = ImageDescriptor.createFromURL(gifImageURL); } return imageDescriptor; }
Example 7
Source File: CommonVoiceXMLBrowserTab.java From JVoiceXML with GNU Lesser General Public License v2.1 | 5 votes |
public Image getImage() { try { if (icon != null) { return icon; } URL imageURL = new URL( "platform:/plugin/org.jvoicexml.eclipse.debug.ui/icons/cview16/VoiceXMLFile.gif"); //$NON-NLS-1$ ImageDescriptor id = ImageDescriptor.createFromURL(imageURL); icon = id.createImage(); return icon; } catch (Exception e) { return super.getImage(); } }
Example 8
Source File: QuickFixer.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 5 votes |
@Override public Image getImage() { Bundle bundle = Platform.getBundle("org.eclipse.ui.editors"); URL url = FileLocator.find(bundle, new Path("icons/full/obj16/quick_fix_warning_obj.png"), null); ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url); Image image = imageDesc.createImage(); return image; }
Example 9
Source File: ResourceManager.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Returns an {@link ImageDescriptor} stored in the file at the specified path. * * @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; } }
Example 10
Source File: EditorPluginImages.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public 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; }
Example 11
Source File: ApplicationWorkbenchWindowAdvisor.java From gama with GNU General Public License v3.0 | 5 votes |
public ApplicationWorkbenchWindowAdvisor(final ApplicationWorkbenchAdvisor adv, final IWorkbenchWindowConfigurer configurer) { super(adv, configurer); // Hack and workaround for the inability to find launcher icons... final Bundle bundle = Platform.getBundle("msi.gama.application"); final ImageDescriptor myImage = ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path("branding_icons/icon256.png"), null)); configurer.getWindow().getShell().setImage(myImage.createImage()); }
Example 12
Source File: GenerateDiffFileWizard.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Declares the wizard banner iamge descriptor */ protected void initializeDefaultPageImageDescriptor() { String iconPath; iconPath = "icons/full/"; //$NON-NLS-1$ try { URL installURL = SVNUIPlugin.getPlugin().getBundle().getEntry("/"); //$NON-NLS-1$ URL url = new URL(installURL, iconPath + "wizards/newconnect_wiz.gif"); //$NON-NLS-1$ ImageDescriptor desc = ImageDescriptor.createFromURL(url); setDefaultPageImageDescriptor(desc); } catch (MalformedURLException e) { // Should not happen. Ignore. } }
Example 13
Source File: HybridUI.java From thym with Eclipse Public License 1.0 | 5 votes |
/** * Returns an image descriptor for the icon referenced by the given path * and contributor plugin * * @param plugin symbolic name * @param path the path of the icon * @return image descriptor or null */ public static ImageDescriptor getImageDescriptor(String name, String path) { Bundle bundle = Platform.getBundle(name); if (path != null) { URL iconURL = FileLocator.find(bundle , new Path(path), null); if (iconURL != null) { return ImageDescriptor.createFromURL(iconURL); } } return null; }
Example 14
Source File: GUIHelper.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public static Image getImage(String key) { Image image = JFaceResources.getImage(key); if (image == null) { URL imageUrl = getImageUrl(key); if (imageUrl != null) { ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imageUrl); JFaceResources.getImageRegistry().put(key, imageDescriptor.createImage()); image = JFaceResources.getImage(key); } } return image; }
Example 15
Source File: ResourceManager.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. * * @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; }
Example 16
Source File: CodewindUIPlugin.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
private void registerImage(ImageRegistry registry, String key, String partialURL) { try { ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL)); registry.put(key, id); imageDescriptors.put(key, id); } catch (Exception e) { Logger.logError("Error registering image", e); } }
Example 17
Source File: ConfigurationFormToolkit.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public ImageDescriptor getImageDescriptor () { return ImageDescriptor.createFromURL ( Activator.getDefault ().getBundle ().getEntry ( "/icons/delete.gif" ) ); }
Example 18
Source File: ResourceManager.java From developer-studio with Apache License 2.0 | 3 votes |
/** * Returns an {@link ImageDescriptor} based on a plugin and file path. * * @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 { URL url = getPluginImageURL(plugin, name); return ImageDescriptor.createFromURL(url); } catch (Throwable e) { log.error(e.getMessage(), e); } return null; }
Example 19
Source File: ApplicationWorkbenchAdvisor.java From tmxeditor8 with GNU General Public License v2.0 | 2 votes |
/** * Declares an IDE-specific workbench image. * @param symbolicName * the symbolic name of the image * @param path * the path of the image file; this path is relative to the base of the IDE plug-in * @param shared * <code>true</code> if this is a shared image, and <code>false</code> if this is not a shared image * @see IWorkbenchConfigurer#declareImage */ private void declareWorkbenchImage(Bundle ideBundle, String symbolicName, String path, boolean shared) { URL url = FileLocator.find(ideBundle, new Path(path), null); ImageDescriptor desc = ImageDescriptor.createFromURL(url); getWorkbenchConfigurer().declareImage(symbolicName, desc, shared); }
Example 20
Source File: NavigatorUIPluginImages.java From tmxeditor8 with GNU General Public License v2.0 | 2 votes |
/** * Create and returns a image descriptor. * * @param prefix * - Icon dir structure. * @param name * - The name of the icon. * @return ImageDescriptor */ private static ImageDescriptor create(String prefix, String name) { return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); }