Example usage for org.eclipse.jface.resource ImageRegistry get

List of usage examples for org.eclipse.jface.resource ImageRegistry get

Introduction

In this page you can find the example usage for org.eclipse.jface.resource ImageRegistry get.

Prototype

public Image get(String key) 

Source Link

Document

Returns the image associated with the given key in this registry, or null if none.

Usage

From source file:ac.soton.eventb.classdiagrams.diagram.navigator.ClassdiagramsNavigatorLabelProvider.java

License:Open Source License

/**
 * @generated/*from w w  w  .j  a v  a2 s . co m*/
 */
private Image getImage(String key, IElementType elementType) {
    ImageRegistry imageRegistry = ClassdiagramsDiagramEditorPlugin.getInstance().getImageRegistry();
    Image image = imageRegistry.get(key);
    if (image == null && elementType != null && ClassdiagramsElementTypes.isKnownElementType(elementType)) {
        image = ClassdiagramsElementTypes.getImage(elementType);
        imageRegistry.put(key, image);
    }

    if (image == null) {
        image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
        imageRegistry.put(key, image);
    }
    return image;
}

From source file:ac.soton.eventb.statemachines.diagram.navigator.StatemachinesNavigatorLabelProvider.java

License:Open Source License

/**
 * @generated/*from   w w  w . j  ava2s.c o m*/
 */
private Image getImage(String key, IElementType elementType) {
    ImageRegistry imageRegistry = StatemachinesDiagramEditorPlugin.getInstance().getImageRegistry();
    Image image = imageRegistry.get(key);
    if (image == null && elementType != null && StatemachinesElementTypes.isKnownElementType(elementType)) {
        image = StatemachinesElementTypes.getImage(elementType);
        imageRegistry.put(key, image);
    }

    if (image == null) {
        image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
        imageRegistry.put(key, image);
    }
    return image;
}

From source file:ac.soton.fmusim.components.diagram.navigator.ComponentsNavigatorLabelProvider.java

License:Open Source License

/**
 * @generated//from   www.j  a  va 2s  .  c om
 */
private Image getImage(String key, IElementType elementType) {
    ImageRegistry imageRegistry = ComponentsDiagramEditorPlugin.getInstance().getImageRegistry();
    Image image = imageRegistry.get(key);
    if (image == null && elementType != null && ComponentsElementTypes.isKnownElementType(elementType)) {
        image = ComponentsElementTypes.getImage(elementType);
        imageRegistry.put(key, image);
    }

    if (image == null) {
        image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
        imageRegistry.put(key, image);
    }
    return image;
}

From source file:ac.soton.multisim.diagram.navigator.MultisimNavigatorLabelProvider.java

License:Open Source License

/**
 * @generated/*w  w w . j a va  2 s. c  o m*/
 */
private Image getImage(String key, IElementType elementType) {
    ImageRegistry imageRegistry = MultisimDiagramEditorPlugin.getInstance().getImageRegistry();
    Image image = imageRegistry.get(key);
    if (image == null && elementType != null && MultisimElementTypes.isKnownElementType(elementType)) {
        image = MultisimElementTypes.getImage(elementType);
        imageRegistry.put(key, image);
    }

    if (image == null) {
        image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
        imageRegistry.put(key, image);
    }
    return image;
}

From source file:ac.soton.xeventb.ui.AbstractXEventBNavigatorLabelProvider.java

License:Open Source License

/**
 * Returns the image corresponding to the image key.
 * //from   ww  w  .ja  v a  2  s. c o m
 * @param element
 *          The input element.
 * @return the image corresponding to the image key.
 */
@Override
public Image getImage(final Object element) {
    if ((element instanceof IXEventBNavigatorObject)) {
        final ImageRegistry registry = XEventBUIPlugin.getDefault().getImageRegistry();
        return registry.get(this.getImageKey());
    }
    return null;
}

From source file:at.spardat.xma.gui.mapper.MapperPlugin.java

License:Open Source License

/**
 * Returns a cached image for a key/*from  w  w w.  ja v a2 s  .c o  m*/
 */
public static Image getImage(String key) {
    ImageRegistry reg = getDefault().getImageRegistry();
    return reg.get(key);
}

From source file:ca.maestrosoft.eclipse.cdt.plugin.studio.option.ui.MaestroFileListControl.java

License:Open Source License

private static Image getImage(String imgFilelistRelpath) {

    URL urlImage = FileLocator.find(Activator.getDefault().getBundle(), new Path(imgFilelistRelpath), null);
    ImageDescriptor imageDesc = ImageDescriptor.createFromURL(urlImage);

    ImageRegistry registry = Activator.getDefault().getImageRegistry();
    Image image = registry.get(imgFilelistRelpath);
    if (image == null) {
        registry.put(imgFilelistRelpath, imageDesc);
    }/*from   w  ww.j av  a2s.com*/
    return registry.get(imgFilelistRelpath);
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.DockerFoundryImages.java

License:Open Source License

/**
 * Lazily initializes image map./*from   w  ww .j  av  a  2  s  .  c o  m*/
 */
public static Image getImage(ImageDescriptor imageDescriptor) {
    ImageRegistry imageRegistry = getImageRegistry();

    Image image = imageRegistry.get("" + imageDescriptor.hashCode()); //$NON-NLS-1$
    if (image == null) {
        image = imageDescriptor.createImage();
        imageRegistry.put("" + imageDescriptor.hashCode(), image); //$NON-NLS-1$
    }
    return image;
}

From source file:co.turnus.widgets.Images.java

License:Open Source License

/**
 * Get an {@link Image} by defining its name. All the images available are
 * defined by the constants available in {@link Image}
 * /* w  w w  . j  a  va  2 s  .co  m*/
 * @param image
 *            identifier
 * @return an {@link Image} or <code>null</code> if the image does not exist
 */
public static Image get(String identifier) {
    String path = _IMAGES_FOLDER_ + identifier;
    ImageRegistry ir = Activator.getDefault().getImageRegistry();
    Image image = ir.get(path);
    if (image == null) {
        ImageDescriptor id = Activator.getImageDescriptor(path);
        image = id.createImage();
        ir.put(path, image);
    }
    return image;
}

From source file:com.agynamix.simidude.clipboard.FileClipboardItem.java

License:Open Source License

public Image getImage() {
    boolean isDownloadContent = sourceDataManager.isRetrieveContentsNeeded(this);
    if (sourceData.isImage()) {
        ImageRegistry imReg = ApplicationBase.getContext().getImageRegistry();
        if (isDownloadContent) {
            if (downloadNeededThumbnail == null) {
                if (sourceData != null) {
                    ImageData imageData = sourceData.getThumbnail();
                    if (imageData != null) {
                        Image img = imReg.get(sourceData.getSourceId().toString() + "-download-needed");
                        if (img == null) {
                            img = new Image(Display.getDefault(), imageData);
                            downloadNeededThumbnail = new Image(Display.getDefault(), img, SWT.IMAGE_GRAY);
                            img.dispose();
                            imReg.put(sourceData.getSourceId().toString() + "-download-needed",
                                    downloadNeededThumbnail);
                        } else {
                            downloadNeededThumbnail = img;
                        }/*from  w  w w. j a  v a  2s  .c om*/
                    }
                }
            }
            return downloadNeededThumbnail;
        } else {
            if (thumbnail == null) {
                if (sourceData != null) {
                    ImageData imageData = sourceData.getThumbnail();
                    if (imageData != null) {
                        thumbnail = imReg.get(sourceData.getSourceId().toString());
                        if (thumbnail == null) {
                            thumbnail = new Image(Display.getDefault(), imageData);
                            imReg.put(sourceData.getSourceId().toString(), thumbnail);
                        }
                    }
                }
            }
            return thumbnail;
        }
    }
    if (isDirectory()) {
        if (isDownloadContent) {
            return PlatformIcons.get(PlatformIcons.COLIMG_DOWNLOAD_NEEDED_FOLDER);
        } else {
            return PlatformIcons.get(PlatformIcons.COLIMG_FOLDER);
        }
    } else {
        if (isDownloadContent) {
            return PlatformIcons.get(PlatformIcons.COLIMG_DOWNLOAD_NEEDED_FILE);
        } else {
            return PlatformIcons.get(PlatformIcons.COLIMG_FILE);
        }
    }
}