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;
}
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;
}
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;
}
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();
}
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;
}
Aggregations