org.eclipse.jface.resource.ImageDescriptor Java Examples
The following examples show how to use
org.eclipse.jface.resource.ImageDescriptor.
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 Project: APICloud-Studio Author: apicloudcom File: SWTUtils.java License: GNU General Public License v3.0 | 6 votes |
private static Image getImage(String bundleSymbolicName, String path, ImageDescriptor id) { String computedName = bundleSymbolicName + path; Image image = JFaceResources.getImage(computedName); if (image != null) { return image; } if (id == null) { id = AbstractUIPlugin.imageDescriptorFromPlugin(bundleSymbolicName, path); } if (id != null) { JFaceResources.getImageRegistry().put(computedName, id); return JFaceResources.getImage(computedName); } return null; }
Example #2
Source Project: gwt-eclipse-plugin Author: gwt-plugins File: NewAsyncRemoteServiceInterfaceCreationWizardPage.java License: Eclipse Public License 1.0 | 6 votes |
public NewAsyncRemoteServiceInterfaceCreationWizardPage( ITypeBinding syncTypeBinding) { super(); this.syncTypeBinding = syncTypeBinding; syncTypeDialogField = new StringButtonDialogField( new IStringButtonAdapter() { public void changeControlPressed(DialogField field) { // Purposely ignored } }); syncTypeDialogField.setButtonLabel("Browse..."); syncTypeDialogField.setLabelText("Synchronous type:"); syncTypeDialogField.setEnabled(false); syncTypeDialogField.setText(syncTypeBinding.getQualifiedName()); ImageDescriptor imageDescriptor = GWTPlugin.getDefault().getImageRegistry().getDescriptor( GWTImages.NEW_ASYNC_INTERFACE_LARGE); setImageDescriptor(imageDescriptor); setDescription("Create a new asynchronous remote service interface"); }
Example #3
Source Project: xds-ide Author: excelsior-oss File: XBookmarksPlugin.java License: Eclipse Public License 1.0 | 6 votes |
/** * * @param imgid IMG_* constant * @return Image */ public Image getCachedBookmarkImage(int bookmarkNum) { // 0..9 if (hmCachedImages == null || bookmarkNum < 0 || bookmarkNum > 9) { return null; // hbz } Integer key = new Integer(IMGID_BOOKMARKS + bookmarkNum); Image img = hmCachedImages.get(key); if (img == null) { IPath path = new Path(String.format(IMG_SOURCES_BOOKMARKS, bookmarkNum)); URL url = FileLocator.find(XBookmarksPlugin.getDefault().getBundle(), path, null); if (url != null) { img = ImageDescriptor.createFromURL(url).createImage(); } if (img != null) { hmCachedImages.put(key, img); } } return img; }
Example #4
Source Project: Eclipse-Postfix-Code-Completion Author: trylimits File: BindingLabelProvider.java License: Eclipse Public License 1.0 | 6 votes |
private static ImageDescriptor getTypeImageDescriptor(boolean inner, ITypeBinding binding, int flags) { if (binding.isEnum()) return JavaPluginImages.DESC_OBJS_ENUM; else if (binding.isAnnotation()) return JavaPluginImages.DESC_OBJS_ANNOTATION; else if (binding.isInterface()) { if ((flags & JavaElementImageProvider.LIGHT_TYPE_ICONS) != 0) return JavaPluginImages.DESC_OBJS_INTERFACEALT; if (inner) return getInnerInterfaceImageDescriptor(binding.getModifiers()); return getInterfaceImageDescriptor(binding.getModifiers()); } else if (binding.isClass()) { if ((flags & JavaElementImageProvider.LIGHT_TYPE_ICONS) != 0) return JavaPluginImages.DESC_OBJS_CLASSALT; if (inner) return getInnerClassImageDescriptor(binding.getModifiers()); return getClassImageDescriptor(binding.getModifiers()); } else if (binding.isTypeVariable()) { return JavaPluginImages.DESC_OBJS_TYPEVARIABLE; } // primitive type, wildcard return null; }
Example #5
Source Project: Pydev Author: fabioz File: CopiedWorkbenchLabelProvider.java License: Eclipse Public License 1.0 | 6 votes |
@Override public Image getImage(Object element) { //obtain the base image by querying the element IWorkbenchAdapter adapter = getAdapter(element); if (adapter == null) { return null; } ImageDescriptor descriptor = adapter.getImageDescriptor(element); if (descriptor == null) { return null; } //add any annotations to the image descriptor descriptor = decorateImage(descriptor, element); try { return resourceManager.createImage(descriptor); } catch (Exception e) { Log.log(e); return null; } }
Example #6
Source Project: bonita-studio Author: bonitasoft File: LivingApplicationPlugin.java License: GNU General Public License v2.0 | 6 votes |
public static Image getImage(final String imageName) { final ImageRegistry reg = getDefault().getImageRegistry(); Image result = reg.get(imageName); if (result != null && !result.isDisposed()) {//prevent from bad dispose return result; } final ImageDescriptor descriptor = ImageDescriptor.createFromURL(getDefault().getBundle().getResource(imageName)); if (descriptor != null) { result = descriptor.createImage(); } reg.remove(imageName); if (result != null) { reg.put(imageName, result); } return result; }
Example #7
Source Project: sarl Author: sarl File: SARLImages.java License: Apache License 2.0 | 6 votes |
/** Replies the image descriptor for the given element. * * @param type the type of the SARL element, or {@code null} if unknown. * @param isInner indicates if the element is inner. * @param isInInterfaceOrAnnotation indicates if the element is defined inside an interface or an annotation. * @param flags the adornments. * @param useLightIcons indicates of light icons should be used. * @return the image descriptor. */ public ImageDescriptor getTypeImageDescriptor( SarlElementType type, boolean isInner, boolean isInInterfaceOrAnnotation, int flags, boolean useLightIcons) { final ImageDescriptor desc; if (type != null) { final StringBuilder iconName = new StringBuilder(IMAGE_NAMES[type.ordinal()]); if (Flags.isPackageDefault(flags)) { iconName.append("_package"); //$NON-NLS-1$ } else if (Flags.isProtected(flags)) { iconName.append("_protected"); //$NON-NLS-1$ } else if (Flags.isPrivate(flags)) { iconName.append("_private"); //$NON-NLS-1$ } iconName.append(".png"); //$NON-NLS-1$ desc = this.imageHelper.getImageDescriptor(iconName.toString()); } else { desc = JavaElementImageProvider.getTypeImageDescriptor(isInner, isInInterfaceOrAnnotation, flags, useLightIcons); } return desc; }
Example #8
Source Project: Eclipse-Postfix-Code-Completion Author: trylimits File: CallHierarchyImageDescriptor.java License: Eclipse Public License 1.0 | 5 votes |
private ImageData getImageData(ImageDescriptor descriptor) { ImageData data= descriptor.getImageData(); // see bug 51965: getImageData can return null if (data == null) { data= DEFAULT_IMAGE_DATA; JavaPlugin.logErrorMessage("Image data not available: " + descriptor.toString()); //$NON-NLS-1$ } return data; }
Example #9
Source Project: goclipse Author: GoClipse File: LangNavigatorLabelProvider.java License: Eclipse Public License 1.0 | 5 votes |
public Image getBaseImage(Object element) { ImageDescriptor baseImage = getBaseImage_switcher().switchElement(element); if(baseImage != null) { return registry.get(baseImage); } if(element instanceof IResource) { IResource resource = (IResource) element; return registry.get(getWorkbenchImageDescriptor(resource)); } return null; }
Example #10
Source Project: xtext-eclipse Author: eclipse File: AbstractLabelProvider.java License: Eclipse Public License 2.0 | 5 votes |
/** * @since 2.4 */ protected ImageDescriptor convertToImageDescriptor(Object imageDescription) { if (imageDescription instanceof Image) { final Image image = (Image) imageDescription; return imageDescriptorHelper.getImageDescriptor(image); } else if (imageDescription instanceof ImageDescriptor) { return (ImageDescriptor) imageDescription; } else if (imageDescription instanceof String) { return imageDescriptorHelper.getImageDescriptor((String) imageDescription); } return null; }
Example #11
Source Project: gama Author: gama-platform File: GamlImageHelper.java License: GNU General Public License v3.0 | 5 votes |
/** * @see org.eclipse.xtext.ui.IImageHelper.IImageDescriptorHelper#getImageDescriptor(org.eclipse.swt.graphics.Image) */ @Override public ImageDescriptor getImageDescriptor(final Image image) { for (final Map.Entry<ImageDescriptor, Image> entry : registry.entrySet()) { if (entry.getValue().equals(image)) { return entry.getKey(); } } final ImageDescriptor newDescriptor = ImageDescriptor.createFromImage(image); registry.put(newDescriptor, image); return newDescriptor; }
Example #12
Source Project: APICloud-Studio Author: apicloudcom File: JSModelFormatter.java License: GNU General Public License v3.0 | 5 votes |
private Image addOverlay(Image base, ImageDescriptor overlay, int location, String key) { ImageRegistry reg = getImageRegistry(); Image cached = reg.get(key); if (cached != null) { return cached; } DecorationOverlayIcon decorator = new DecorationOverlayIcon(base, overlay, location); Image result = decorator.createImage(); reg.put(key, result); return result; }
Example #13
Source Project: http4e Author: nextinterfaces File: ExportVbAction.java License: Apache License 2.0 | 5 votes |
public ExportVbAction( ViewPart view) { this.view = view; fMenu = null; setToolTipText("Export call as Visual Basic"); setImageDescriptor(ImageDescriptor.createFromImage(ResourceUtils.getImage(CoreConstants.PLUGIN_UI, CoreImages.VB))); setText(" Visual Basic"); }
Example #14
Source Project: sarl Author: sarl File: PyGeneratorUiPlugin.java License: Apache License 2.0 | 5 votes |
/** Replies the image stored in the current Eclipse plugin. * * @param imagePath path of the image. * @return the image. */ public Image getImage(String imagePath) { final ImageDescriptor descriptor = getImageDescriptor(imagePath); if (descriptor == null) { return null; } return descriptor.createImage(); }
Example #15
Source Project: JVoiceXML Author: JVoiceXML File: CommonVoiceXMLBrowserTab.java License: 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 #16
Source Project: developer-studio Author: wso2 File: WSO2PluginSampleExt.java License: Apache License 2.0 | 5 votes |
public Image getImage(String iconLocation, String id, String isFromGit) { ImageDescriptor imageDescriptor = null; if (!Boolean.parseBoolean(isFromGit)) { if (iconLocation != null && !iconLocation.isEmpty()) { imageDescriptor = ImageDescriptor.createFromURL(FileLocator.find(Platform.getBundle(bundleID), new Path(iconLocation), null)); } else { imageDescriptor = ImageDescriptor.createFromURL(FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path("icons/plugin-icon.png"), null)); } return imageDescriptor.createImage(); } else { try { String gitIconLoc = WSO2PluginListSelectionPage.tempCloneDir + File.separator + id + File.separator + "icons" + File.separator + iconLocation; imageDescriptor = ImageDescriptor.createFromURL(new URL(WSO2PluginConstants.FILE_PROTOCOL + gitIconLoc)); return imageDescriptor.createImage(); } catch (MalformedURLException e) { // log image cannot be found at location return null; } } }
Example #17
Source Project: olca-app Author: GreenDelta File: Images.java License: Mozilla Public License 2.0 | 5 votes |
public static ImageDescriptor descriptor(Group group) { if (group == null) return null; ModelIcon icon = icon(group.type); if (icon == null) return Icon.FOLDER.descriptor(); return ImageManager.descriptor(icon); }
Example #18
Source Project: APICloud-Studio Author: apicloudcom File: PatchFileSelectionPage.java License: GNU General Public License v3.0 | 5 votes |
public PatchFileSelectionPage(String pageName, String title, ImageDescriptor image, IStructuredSelection selection, HashMap statusMap) { super(pageName, title, image); this.statusMap = statusMap; Object[] selectedResources = selection.toArray(); resources = new IResource[selectedResources.length]; for (int i = 0; i < selectedResources.length; i++) resources[i] = (IResource)selectedResources[i]; setPageComplete(false); }
Example #19
Source Project: translationstudio8 Author: heartsome File: Activator.java License: GNU General Public License v2.0 | 5 votes |
/** * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。 * @param path * the path * @return the icon descriptor */ public static ImageDescriptor getIconDescriptor(String path) { ImageDescriptor image = getImageDescriptor(path); ImageData data = image.getImageData(); data = data.scaledTo(16, 16); image = ImageDescriptor.createFromImageData(data); return image; }
Example #20
Source Project: xtext-eclipse Author: eclipse File: XtextEditorErrorTickUpdater.java License: Eclipse Public License 2.0 | 5 votes |
/** * @since 2.4 */ public void scheduleUpdateEditor(final ImageDescriptor titleImageDescription) { Display display = PlatformUI.getWorkbench().getDisplay(); display.asyncExec(new Runnable() { @Override public void run() { if (editor != null) { Image image = imageHelper.getImage(titleImageDescription); if (editor.getTitleImage() != image) { editor.updatedTitleImage(image); } } } }); }
Example #21
Source Project: Eclipse-Postfix-Code-Completion Author: trylimits File: JavaElementImageProvider.java License: Eclipse Public License 1.0 | 5 votes |
private static ImageDescriptor getInnerEnumImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) { if (Flags.isPublic(flags) || isInInterfaceOrAnnotation) return JavaPluginImages.DESC_OBJS_ENUM; else if (Flags.isPrivate(flags)) return JavaPluginImages.DESC_OBJS_ENUM_PRIVATE; else if (Flags.isProtected(flags)) return JavaPluginImages.DESC_OBJS_ENUM_PROTECTED; else return JavaPluginImages.DESC_OBJS_ENUM_DEFAULT; }
Example #22
Source Project: goclipse Author: GoClipse File: LangElementImageDescriptor.java License: Eclipse Public License 1.0 | 5 votes |
public static ImageDescriptor getProtectionDecoration_Small(EProtection protection) { if(protection == null) return null; switch (protection) { case PRIVATE: return LangImages.DESC_OVR_PRIVATE_SMALL; case PROTECTED: return LangImages.DESC_OVR_PROTECTED_SMALL; case PACKAGE: return LangImages.DESC_OVR_DEFAULT_SMALL; case PUBLIC: default: return null; } }
Example #23
Source Project: Eclipse-Postfix-Code-Completion Author: trylimits File: ParameterGuesser.java License: Eclipse Public License 1.0 | 5 votes |
public Variable(String qualifiedTypeName, String name, int variableType, boolean isAutoboxMatch, int positionScore, char[] triggerChars, ImageDescriptor descriptor) { this.qualifiedTypeName= qualifiedTypeName; this.name= name; this.variableType= variableType; this.positionScore= positionScore; this.triggerChars= triggerChars; this.descriptor= descriptor; this.isAutoboxingMatch= isAutoboxMatch; this.alreadyMatched= false; }
Example #24
Source Project: goclipse Author: GoClipse File: ProblemsLabelDecorator.java License: Eclipse Public License 1.0 | 5 votes |
@Override public void decorate(Object element, IDecoration decoration) { ImageDescriptor imageDescriptor= computeAdornmentFlags(element); if(imageDescriptor != null) { decoration.addOverlay(imageDescriptor); } }
Example #25
Source Project: typescript.java Author: angelozerr File: BuildpathIndicatorLabelDecorator.java License: MIT License | 5 votes |
@Override public void decorate(Object element, IDecoration decoration) { ImageDescriptor overlay = getOverlay(element); if (overlay != null) { decoration.addOverlay(overlay, IDecoration.TOP_RIGHT); } }
Example #26
Source Project: n4js Author: eclipse File: TestResultsView.java License: Eclipse Public License 1.0 | 5 votes |
/** * Creates a single action. */ protected Action createAction(String text, int style, String tooltip, ImageDescriptor imageDescriptor, Runnable runnable) { final Action a = new Action(text, style) { @Override public void run() { if (runnable != null) runnable.run(); } }; a.setToolTipText(tooltip); a.setImageDescriptor(imageDescriptor); return a; }
Example #27
Source Project: EasyShell Author: anb0s File: Activator.java License: Eclipse Public License 2.0 | 5 votes |
/** * Returns an image descriptor for the image file at the given * plug-in relative path * * @param path the path * @return the image descriptor */ /* public static ImageDescriptor getImageDescriptor(String path) { return imageDescriptorFromPlugin(Constants.PLUGIN_ID, path); } */ public static ImageDescriptor getImageDescriptor(String id) { return getDefault().getImageRegistry().getDescriptor(id); }
Example #28
Source Project: tmxeditor8 Author: heartsome File: Activator.java License: GNU General Public License v2.0 | 5 votes |
/** * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。 * @param path * the path * @return the icon descriptor */ public static ImageDescriptor getIconDescriptor(String path) { ImageDescriptor image = getImageDescriptor(path); ImageData data = image.getImageData(); data = data.scaledTo(16, 16); image = ImageDescriptor.createFromImageData(data); return image; }
Example #29
Source Project: translationstudio8 Author: heartsome File: ObjectImageRenderer.java License: GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public ICellRenderer createPrintRenderer(Printer printer) { ObjectImageRenderer renderer = new ObjectImageRenderer(printer); for (Object o : _keyMap.keySet()) { String key = _keyMap.get(o); ImageDescriptor imageDesc = getImageRegistry().getDescriptor(key); renderer.addObjectImageDescriptorMapping(o, key, imageDesc); } return renderer; }
Example #30
Source Project: sarl Author: sarl File: AbstractSarlUiTest.java License: Apache License 2.0 | 5 votes |
/** Assert the given image descriptor is for an image in a bundle. * * @param filename the name of the image file. * @param desc the image descriptor to test. */ protected static void assertBundleImage(String filename, ImageDescriptor desc) { assertNotNull(desc); String s = desc.toString(); String regex = Pattern.quote("URLImageDescriptor(bundleentry://") //$NON-NLS-1$ + "[^/]+" //$NON-NLS-1$ + Pattern.quote("/icons/") //$NON-NLS-1$ + "([^/]+[/])*" //$NON-NLS-1$ + Pattern.quote(filename + ")"); //$NON-NLS-1$ if (!Pattern.matches(regex, s)) { if (desc instanceof JavaElementImageDescriptor) { JavaElementImageDescriptor jeid = (JavaElementImageDescriptor) desc; try { Field field = JavaElementImageDescriptor.class.getDeclaredField("fBaseImage"); boolean isAcc = field.isAccessible(); field.setAccessible(true); try { ImageDescriptor id = (ImageDescriptor) field.get(jeid); s = id.toString(); assertTrue("Invalid image: " + filename //$NON-NLS-1$ + ". Actual: " + s, Pattern.matches(regex, s)); //$NON-NLS-1$ } finally { field.setAccessible(isAcc); } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { fail("Invalid background image descriptor: " + jeid.getClass().getName()); } } } }