Search in sources :

Example 36 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project archi by archimatetool.

the class ImageFactory method getImage.

/**
 * Returns the shared image represented by the given key.
 *
 * @param imageName
 *          the logical name of the image to retrieve
 * @return the shared image represented by the given key
 */
public Image getImage(String imageName) {
    if (imageName == null) {
        // $NON-NLS-1$
        throw new IllegalArgumentException("Image name cannot be null");
    }
    ImageRegistry registry = fPlugin.getImageRegistry();
    Image image = registry.get(imageName);
    if (image == null) {
        // Image will be created in registry.get(imageName) after image descriptor is put into registry
        getImageDescriptor(imageName);
        image = registry.get(imageName);
    }
    return image;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) Image(org.eclipse.swt.graphics.Image)

Example 37 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project archi by archimatetool.

the class ImageFactory method getCompositeImage.

/**
 * Return a composite image consisting of many images
 *
 * @param imageNames
 * @return
 */
public Image getCompositeImage(String[] imageNames) {
    // Make a registry name, cached
    // $NON-NLS-1$
    String key_name = "@";
    for (String name : imageNames) {
        key_name += name;
    }
    ImageRegistry registry = fPlugin.getImageRegistry();
    Image image = registry.get(key_name);
    if (image == null) {
        // Image will be created in registry.get(imageName) after image descriptor is put into registry
        getCompositeImageDescriptor(imageNames);
        image = registry.get(key_name);
    }
    return image;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) Image(org.eclipse.swt.graphics.Image)

Example 38 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project archi by archimatetool.

the class ImageFactory method getOverlayImage.

/**
 * Return a composite image with overlay image
 *
 * @param underlay The underlay image
 * @param overlayName Name of the overlay image
 * @param quadrant the quadrant (one of {@link IDecoration}
 * ({@link IDecoration#TOP_LEFT}, {@link IDecoration#TOP_RIGHT},
 * {@link IDecoration#BOTTOM_LEFT}, {@link IDecoration#BOTTOM_RIGHT}
 * or {@link IDecoration#UNDERLAY})
 * @return The image
 */
public Image getOverlayImage(Image underlay, String overlayName, int quadrant) {
    String key = underlay.hashCode() + overlayName + quadrant;
    Image newImage = getImage(key);
    if (newImage == null) {
        ImageDescriptor overlayDescripter = getImageDescriptor(overlayName);
        if (overlayDescripter != null) {
            newImage = new DecorationOverlayIcon(underlay, overlayDescripter, quadrant).createImage();
            if (newImage != null) {
                ImageRegistry registry = fPlugin.getImageRegistry();
                registry.put(key, newImage);
            }
        }
    }
    return newImage != null ? newImage : underlay;
}
Also used : DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) ImageRegistry(org.eclipse.jface.resource.ImageRegistry) CompositeImageDescriptor(org.eclipse.jface.resource.CompositeImageDescriptor) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) CompositeMultiImageDescriptor(com.archimatetool.editor.ui.components.CompositeMultiImageDescriptor) Image(org.eclipse.swt.graphics.Image)

Example 39 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project xtext-eclipse by eclipse.

the class XtextPluginImages method initialize.

/* package */
private static final void initialize() {
    PLUGIN_REGISTRY = new ImageRegistry();
    manage(OBJ_DESC_SERVICE_LOADED, DESC_SERVICE_LOADED_OBJ);
    manage(OBJ_DESC_SERVICE_NOT_LOADED, DESC_SERVICE_NOT_LOADED_OBJ);
    manage(OBJ_DESC_LANGUAGE, DESC_LANGUAGE_OBJ);
    manage(OBJ_CORRECTION_CHANGE, DESC_CORRECTION_CHANGE);
    manage(OBJ_FIXABLE_ERROR, DESC_FIXABLE_ERROR);
    manage(OBJ_FIXABLE_WARNING, DESC_FIXABLE_WARNING);
    manage(OBJ_FIXABLE_INFO, DESC_FIXABLE_INFO);
    initializeImageMaps();
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry)

Example 40 with ImageRegistry

use of org.eclipse.jface.resource.ImageRegistry in project translationstudio8 by heartsome.

the class TableExample method getImageRegistry.

public static ImageRegistry getImageRegistry() {
    if (_imageRegistry == null) {
        _imageRegistry = new ImageRegistry();
        ImageDescriptor imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/splash.bmp");
        _imageRegistry.put("splash", imgDesc);
        imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/keyboard.png");
        _imageRegistry.put("keyboard", imgDesc);
    }
    return _imageRegistry;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) ResourceImageDescriptor(de.jaret.util.ui.ResourceImageDescriptor) ResourceImageDescriptor(de.jaret.util.ui.ResourceImageDescriptor) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Aggregations

ImageRegistry (org.eclipse.jface.resource.ImageRegistry)63 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)25 Image (org.eclipse.swt.graphics.Image)22 URL (java.net.URL)4 ResourceBundle (java.util.ResourceBundle)4 Before (org.junit.Before)4 CoreRuntimePlugin (org.talend.core.runtime.CoreRuntimePlugin)4 CompositeMultiImageDescriptor (com.archimatetool.editor.ui.components.CompositeMultiImageDescriptor)3 ResourceImageDescriptor (de.jaret.util.ui.ResourceImageDescriptor)3 CompositeImageDescriptor (org.eclipse.jface.resource.CompositeImageDescriptor)3 Label (org.eclipse.swt.widgets.Label)3 RepositoryContext (org.talend.core.context.RepositoryContext)3 Project (org.talend.core.model.general.Project)3 User (org.talend.core.model.properties.User)3 IRepositoryFactory (org.talend.core.repository.model.IRepositoryFactory)3 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)3 XmiResourceManager (org.talend.core.repository.utils.XmiResourceManager)3 IRepositoryNodeConfiguration (org.talend.mdm.repository.core.IRepositoryNodeConfiguration)3 IRepositoryNodeResourceProvider (org.talend.mdm.repository.core.IRepositoryNodeResourceProvider)3 RecycleBinNodeConfiguration (org.talend.mdm.repository.core.impl.recyclebin.RecycleBinNodeConfiguration)3