Search in sources :

Example 16 with DecorationOverlayIcon

use of org.eclipse.jface.viewers.DecorationOverlayIcon in project xtext-xtend by eclipse.

the class XtendEditorErrorTickUpdater method updateEditorImage.

@Override
protected void updateEditorImage(XtextEditor xtextEditor) {
    if (xtextEditor != null && !xtextEditor.isEditable()) {
        Severity severity = getSeverity(xtextEditor);
        if (severity != null && severity != Severity.INFO) {
            ImageDescriptor descriptor = severity == Severity.ERROR ? XtextPluginImages.DESC_OVR_ERROR : XtextPluginImages.DESC_OVR_WARNING;
            // TODO replace with new constructor that takes an ImageDescription when on Oxygen+
            DecorationOverlayIcon decorationOverlayIcon = new DecorationOverlayIcon(pluginImageHelper.getImage(images.forReadonly()), descriptor, IDecoration.BOTTOM_LEFT);
            scheduleUpdateEditor(decorationOverlayIcon);
        } else {
            scheduleUpdateEditor(images.forReadonly());
        }
    } else {
        super.updateEditorImage(xtextEditor);
    }
}
Also used : DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) Severity(org.eclipse.xtext.diagnostics.Severity) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Example 17 with DecorationOverlayIcon

use of org.eclipse.jface.viewers.DecorationOverlayIcon 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 18 with DecorationOverlayIcon

use of org.eclipse.jface.viewers.DecorationOverlayIcon in project bndtools by bndtools.

the class ExtendedFormEditor method setOverlayTitleImage.

public void setOverlayTitleImage(ImageDescriptor overlay) {
    if (overlay == null) {
        overlaidTitleImage = null;
        firePropertyChange(PROP_TITLE);
        if (overlaidTitleImageDescriptor != null)
            JFaceResources.getResources().destroyImage(overlaidTitleImageDescriptor);
        overlaidTitleImageDescriptor = null;
    } else {
        DecorationOverlayIcon newOverlaidDesc = new DecorationOverlayIcon(titleImage, overlay, IDecoration.BOTTOM_LEFT);
        overlaidTitleImage = JFaceResources.getResources().createImage(newOverlaidDesc);
        firePropertyChange(PROP_TITLE);
        if (overlaidTitleImageDescriptor != null)
            JFaceResources.getResources().destroyImage(overlaidTitleImageDescriptor);
        overlaidTitleImageDescriptor = newOverlaidDesc;
    }
}
Also used : DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon)

Aggregations

DecorationOverlayIcon (org.eclipse.jface.viewers.DecorationOverlayIcon)18 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)14 Image (org.eclipse.swt.graphics.Image)9 IFile (org.eclipse.core.resources.IFile)3 IFolder (org.eclipse.core.resources.IFolder)3 ImageRegistry (org.eclipse.jface.resource.ImageRegistry)2 Severity (org.eclipse.xtext.diagnostics.Severity)2 CompositeMultiImageDescriptor (com.archimatetool.editor.ui.components.CompositeMultiImageDescriptor)1 Definition (eu.esdihumboldt.hale.common.schema.model.Definition)1 TreePathFilteredTree (eu.esdihumboldt.hale.ui.util.viewer.tree.TreePathFilteredTree)1 TreePathPatternFilter (eu.esdihumboldt.hale.ui.util.viewer.tree.TreePathPatternFilter)1 File (java.io.File)1 QName (javax.xml.namespace.QName)1 CoreException (org.eclipse.core.runtime.CoreException)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 Action (org.eclipse.jface.action.Action)1 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 IAction (org.eclipse.jface.action.IAction)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1