Java Code Examples for org.eclipse.jface.resource.ImageRegistry#get()
The following examples show how to use
org.eclipse.jface.resource.ImageRegistry#get() .
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: BusinessObjectPlugin.java From bonita-studio with 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 2
Source File: HTMLPlugin.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * getImage * * @param path * @return */ public static Image getImage(String path) { ImageRegistry registry = plugin.getImageRegistry(); Image image = registry.get(path); if (image == null) { ImageDescriptor id = getImageDescriptor(path); if (id != null) { registry.put(path, id); image = registry.get(path); } } return image; }
Example 3
Source File: BasicSymbolProviderPreferencePage.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override public Image getImage(Object element) { if (element instanceof IMappingFile) { // Add binary/mapping icons to the image registry if needed ImageRegistry registry = Activator.getDefault().getImageRegistry(); Image binImage = registry.get(BIN_ICON.toString()); if (binImage == null) { registry.put(BIN_ICON.toString(), BIN_ICON); binImage = registry.get(BIN_ICON.toString()); } Image txtImage = registry.get(TXT_ICON.toString()); if (txtImage == null) { registry.put(TXT_ICON.toString(), TXT_ICON); txtImage = registry.get(TXT_ICON.toString()); } return ((IMappingFile) element).isBinaryFile() ? binImage : txtImage; } return null; }
Example 4
Source File: JSPlugin.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * getImage * * @param path * @return */ public static Image getImage(String path) { ImageRegistry registry = PLUGIN.getImageRegistry(); Image image = registry.get(path); if (image == null) { ImageDescriptor id = getImageDescriptor(path); if (id == null) { return null; } registry.put(path, id); image = registry.get(path); } return image; }
Example 5
Source File: Pics.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * get the system image resized in 16x16 (only used in connectors label provider) * * @param id * @return */ public static Image getSystemImage(final int id) { final ImageRegistry reg = plugin.getImageRegistry(); final String imageName = id + ""; Image result = reg.get(imageName); if (result != null && !result.isDisposed()) {//prevent from bad dispose return result; } result = Display.getCurrent().getSystemImage(id); final Image scaled = new Image(Display.getDefault(), 16, 16); final GC gc = new GC(scaled); gc.setAntialias(SWT.ON); gc.setInterpolation(SWT.HIGH); gc.drawImage(result, 0, 0, result.getBounds().width, result.getBounds().height, 0, 0, 16, 16); gc.dispose(); result = scaled; reg.remove(imageName); reg.put(imageName, result); return result; }
Example 6
Source File: BosArchiveImporterPlugin.java From bonita-studio with 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 File: XMLPlugin.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public static Image getImage(String path) { ImageRegistry registry = plugin.getImageRegistry(); Image image = registry.get(path); if (image == null) { ImageDescriptor id = getImageDescriptor(path); if (id == null) { return null; } registry.put(path, id); image = registry.get(path); } return image; }
Example 8
Source File: UIHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * This is a convenience method to get an imgIcon from a URL. * * @param sPluginRelativePath * The URL for the imgIcon. * @return The imgIcon represented by the given URL. * @throws IOException * @see #setImageCached(boolean ) */ public static Image getImage( String sPluginRelativePath ) throws IOException { ImageRegistry registry = JFaceResources.getImageRegistry( ); Image image = registry.get( sPluginRelativePath ); if ( image == null ) { image = createImage( sPluginRelativePath ); registry.put( sPluginRelativePath, image ); } return image; }
Example 9
Source File: UIHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * This is a convenience method to get an imgIcon from a URL. * * @param sPluginRelativePath * The URL for the imgIcon. * @return The imgIcon represented by the given URL. * @see #setImageCached( boolean ) */ public static Image getImage( String sPluginRelativePath ) { ImageRegistry registry = JFaceResources.getImageRegistry( ); Image image = registry.get( sPluginRelativePath ); if ( image == null ) { image = createImage( sPluginRelativePath ); registry.put( sPluginRelativePath, image ); } return image; }
Example 10
Source File: CPVariableElementLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public CPVariableElementLabelProvider(boolean highlightReadOnly) { ImageRegistry reg= JavaPlugin.getDefault().getImageRegistry(); fJARImage= reg.get(JavaPluginImages.IMG_OBJS_EXTJAR); fFolderImage= PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER); fDeprecatedJARImage= new DecorationOverlayIcon(fJARImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage(); fDeprecatedFolderImage= new DecorationOverlayIcon(fFolderImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage(); fHighlightReadOnly= highlightReadOnly; }
Example 11
Source File: UIHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
public static Image getImage( String imgKey, ImageDescriptor descriptor ) { ImageRegistry registry = JFaceResources.getImageRegistry( ); Image image = registry.get( imgKey ); if ( image == null ) { image = descriptor.createImage( ); if ( image != null ) { registry.put( imgKey, image ); } } return image; }
Example 12
Source File: ProcessNavigatorLabelProvider.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ private Image getImage(String key, IElementType elementType) { ImageRegistry imageRegistry = ProcessDiagramEditorPlugin.getInstance().getImageRegistry(); Image image = imageRegistry.get(key); if (image == null && elementType != null && ProcessElementTypes.isKnownElementType(elementType)) { image = ProcessElementTypes.getImage(elementType); imageRegistry.put(key, image); } if (image == null) { image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$ imageRegistry.put(key, image); } return image; }
Example 13
Source File: CrosstabUIHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * This is a convenience method to get an imgIcon from a URL. * * @param sPluginRelativePath * The URL for the imgIcon. * @return The imgIcon represented by the given URL. * @see #setImageCached( boolean ) */ public static Image getImage( String sPluginRelativePath ) { ImageRegistry registry = JFaceResources.getImageRegistry( ); Image image = registry.get( sPluginRelativePath ); if ( image == null ) { image = createImage( sPluginRelativePath ); registry.put( sPluginRelativePath, image ); } return image; }
Example 14
Source File: SdkTable.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
@Override public Image getColumnImage(Object element, int columnIndex) { switch (columnIndex) { case 0: IStatus validationStatus = ((Sdk) element).validate(); if (!validationStatus.isOK()) { ImageRegistry imageRegistry = CorePlugin.getDefault().getImageRegistry(); return imageRegistry.get(CoreImages.INVALID_SDK_ICON); } return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_LIBRARY); default: return null; } }
Example 15
Source File: JsniMethodBodyCompletionProposalComputerTest.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * Test that the icons that we depend on are included in the registry. */ public void testIcons() { // TODO: This should really be a test of GWTImages. GWTPlugin plugin = GWTPlugin.getDefault(); ImageRegistry imageRegistry = plugin.getImageRegistry(); for (String imageId : IMAGE_IDS) { Image image = imageRegistry.get(imageId); assertNotNull("ImageId: " + imageId + " was not in the ImageRegistry", image); } }
Example 16
Source File: PathToImageResolver.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public static Image toImage(URL path) { if (path == null) return null; ImageRegistry imageRegistry = GenmodelActivator.getInstance().getImageRegistry(); Image image = imageRegistry.get(path.toString()); if (image == null) imageRegistry.put(path.toString(), ImageDescriptor.createFromURL(path).createImage()); return imageRegistry.get(path.toString()); }
Example 17
Source File: UIHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * This is a convenience method to get an imgIcon from a URL. * * @param sPluginRelativePath * The URL for the imgIcon. * @return The imgIcon represented by the given URL. * @see #setImageCached( boolean ) */ public static Image getImage( String sPluginRelativePath ) { ImageRegistry registry = JFaceResources.getImageRegistry( ); Image image = registry.get( sPluginRelativePath ); if ( image == null ) { image = createImage( sPluginRelativePath ); registry.put( sPluginRelativePath, image ); } return image; }
Example 18
Source File: UIHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * This is a convenience method to get an imgIcon from a URL. * * @param sPluginRelativePath * The URL for the imgIcon. * @return The imgIcon represented by the given URL. * @see #setImageCached( boolean ) */ public static Image getImage( String sPluginRelativePath ) { ImageRegistry registry = JFaceResources.getImageRegistry( ); String resourcePath = ChartUIPlugin.ID + "/" + sPluginRelativePath; //$NON-NLS-1$ Image image = registry.get( resourcePath ); if ( image == null ) { image = createImage( sPluginRelativePath ); registry.put( resourcePath, image ); } return image; }
Example 19
Source File: BugResolution.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public Image getImage() { ImageRegistry registry = FindbugsPlugin.getDefault().getImageRegistry(); return registry.get(FindbugsPlugin.ICON_DEFAULT); }
Example 20
Source File: TypeScriptImagesRegistry.java From typescript.java with MIT License | 2 votes |
/** * Returns the image from the image registry with the given key. * * @param key * of the image * @return the image from the image registry with the given key. */ public static Image getImage(String key) { ImageRegistry imageRegistry = JFaceResources.getImageRegistry(); return imageRegistry.get(key); }