Search in sources :

Example 1 with ImageOverlayDescriptor

use of org.eclipse.wst.xsd.ui.internal.adt.design.ImageOverlayDescriptor in project webtools.sourceediting by eclipse.

the class XSDCommonUIUtils method getUpdatedImage.

public static Image getUpdatedImage(XSDConcreteComponent input, Image baseImage, boolean isReadOnly) {
    XSDAnnotation xsdAnnotation = getInputXSDAnnotation(input, false);
    if (xsdAnnotation != null) {
        if (xsdAnnotation.getApplicationInformation().size() > 0) {
            // Will use the class name appended by the read only state as the name of the image.
            // There is a disabled and an enabled version of each baseImage, so we can't simply
            // use the component name as the name of the image
            String imageName = input.getClass().getName() + isReadOnly;
            Image newImage = XSDEditorPlugin.getDefault().getImageRegistry().get(imageName);
            if (newImage == null) {
                ImageOverlayDescriptor ovr = new ImageOverlayDescriptor(baseImage, isReadOnly);
                newImage = ovr.getImage();
                XSDEditorPlugin.getDefault().getImageRegistry().put(imageName, newImage);
            }
            return newImage;
        }
    }
    return baseImage;
}
Also used : ImageOverlayDescriptor(org.eclipse.wst.xsd.ui.internal.adt.design.ImageOverlayDescriptor) XSDAnnotation(org.eclipse.xsd.XSDAnnotation) Image(org.eclipse.swt.graphics.Image)

Aggregations

Image (org.eclipse.swt.graphics.Image)1 ImageOverlayDescriptor (org.eclipse.wst.xsd.ui.internal.adt.design.ImageOverlayDescriptor)1 XSDAnnotation (org.eclipse.xsd.XSDAnnotation)1