Example usage for org.eclipse.jface.viewers DecorationOverlayIcon DecorationOverlayIcon

List of usage examples for org.eclipse.jface.viewers DecorationOverlayIcon DecorationOverlayIcon

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers DecorationOverlayIcon DecorationOverlayIcon.

Prototype

public DecorationOverlayIcon(ImageDescriptor baseImageDescriptor, ImageDescriptor overlayImageDescriptor,
        int quadrant) 

Source Link

Document

Create a decoration overlay icon that will place the given overlay icon in the given quadrant of the base image descriptor.

Usage

From source file:org.eclipse.m2m.internal.qvt.oml.debug.ui.QVTODebugUIPlugin.java

License:Open Source License

private final ImageDescriptor overlayImage(String overImagePath, Image base, int quadrant) {
    ImageDescriptor decorator = imageDescriptor(overImagePath);
    return new DecorationOverlayIcon(base, decorator, quadrant);
}

From source file:org.eclipse.m2m.internal.qvt.oml.editor.ui.completion.CompletionProposalUtil.java

License:Open Source License

public static final Image getImage(String imageKey, String decoratorKey) {
    String key = imageKey + decoratorKey;
    Image image = getImageRegistry().get(key);
    if (image == null) {
        Image baseImage = getImage(imageKey);
        ImageDescriptor decoratorId = imageDescriptorFromPlugin("icons/" + decoratorKey + ".gif"); //$NON-NLS-1$ //$NON-NLS-2$
        DecorationOverlayIcon decoratedIconId = new DecorationOverlayIcon(baseImage, decoratorId,
                IDecoration.BOTTOM_RIGHT);
        getImageRegistry().put(key, decoratedIconId);
        return getImageRegistry().get(key);
    }/*from   w ww  .  j a va2  s . c o  m*/
    return image;
}

From source file:org.eclipse.m2m.internal.qvt.oml.runtime.ui.trace.TraceViewLabelProvider.java

License:Open Source License

private Image getDecoratedImage(Image baseImage, String decoratorKey) {
    ImageDescriptor decoratorId = CommonPluginImages.getInstance().getImageDescriptor(decoratorKey);
    DecorationOverlayIcon decoratedIconId = new DecorationOverlayIcon(baseImage, decoratorId,
            IDecoration.TOP_LEFT);//from  w w w  .  j av a 2  s. co  m
    Image decoratedImage = decoratedIconId.createImage();
    myImageCache.add(decoratedImage);
    return decoratedImage;
}

From source file:org.eclipse.n4js.ui.N4JSEditor.java

License:Open Source License

/**
 * This method is expected to add all applicable overlays for the title image to the given image descriptor. If no
 * overlays are to be added, then the given image descriptor should be returned (this method should never return
 * <code>null</code>).//from  w w  w .  ja v a  2s  .  c  o  m
 * <p>
 * This method should never add overlays to indicate errors/warnings, as this is taken care of by the default
 * implementation of {@link XtextEditorErrorTickUpdater}.
 */
public ImageDescriptor applyTitleImageOverlays(ImageDescriptor titleImageDesc) {
    if (isReconciling()) {
        final Image image = imageHelper.getImage(titleImageDesc);
        titleImageDesc = new DecorationOverlayIcon(image, ImageRef.TINY_CLOCK.asImageDescriptor().get(),
                IDecoration.TOP_RIGHT);
    }
    return titleImageDesc;
}

From source file:org.eclipse.oomph.launches.LaunchConfigLabelDecorator.java

License:Open Source License

public Image decorateImage(Image image, Object element) {
    if (image != null) {
        if (isLocal(element)) {
            DecorationOverlayIcon icon = new DecorationOverlayIcon(image, LOCAL_OVERLAY, IDecoration.TOP_LEFT);
            return (Image) resourceManager.get(icon);
        }//from   w  w  w  .  j av  a  2  s. c  o m

        if (isExampleCopy(element)) {
            DecorationOverlayIcon icon = new DecorationOverlayIcon(image, EXAMPLE_OVERLAY,
                    IDecoration.TOP_LEFT);
            return (Image) resourceManager.get(icon);
        }
    }

    return null;
}

From source file:org.eclipse.osee.ote.ui.define.viewers.data.ArtifactItem.java

License:Open Source License

private void initializeImages() {
    Artifact artifact = getData();/* ww w.j  a v a2s .c  om*/
    Image defaultImage = ArtifactImageManager.getImage(artifact);
    DecorationOverlayIcon overlay = null;
    if (FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE == null) {
        OverlayImage overlayImage = new OverlayImage(defaultImage,
                ImageManager.getImageDescriptor(OteDefineImage.ADDITION), Location.BOT_RIGHT);
        FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE = overlayImage.createImage();
    }
    if (FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE == null) {
        overlay = new DecorationOverlayIcon(defaultImage,
                ImageManager.getImageDescriptor(OteDefineImage.CONFAUTO_OV), IDecoration.BOTTOM_RIGHT);
        FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE = overlay.createImage();
    }
    if (FROM_DATABASE_IMAGE == null) {
        overlay = new DecorationOverlayIcon(defaultImage,
                ImageManager.getImageDescriptor(OteDefineImage.VERSION_CONTROLLED), IDecoration.BOTTOM_RIGHT);
        FROM_DATABASE_IMAGE = overlay.createImage();
    }
    if (INVALID_SCRIPT_IMAGE == null) {
        overlay = new DecorationOverlayIcon(defaultImage,
                ImageManager.getImageDescriptor(OteDefineImage.OBSTRUCTED), IDecoration.BOTTOM_RIGHT);
        INVALID_SCRIPT_IMAGE = overlay.createImage();
    }
}

From source file:org.eclipse.papyrus.modelexplorer.MoDiscoLabelProvider.java

License:Open Source License

/**
 * Return a DecoratedImage, thanks to Torkild U. Resheim (Trondheim, Norway)
 * @param baseImage the base image to decorate
 * @param severity the severity of the error
 * @return the decorated image// w  w w .j a v  a2s. c  o  m
 */
private Image getDecoratedImage(Image baseImage, int severity) {
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
    ImageDescriptor overlay = null;
    switch (severity) {
    case IMarker.SEVERITY_ERROR:
        overlay = sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR);
        break;
    case IMarker.SEVERITY_WARNING:
        overlay = sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING);
        break;
    default:
        return baseImage;
    }
    // Construct a new image identifier
    String decoratedImageId = baseImage.toString().concat(String.valueOf(severity));
    // Return the stored image if we have one
    if (registry.get(decoratedImageId) == null) {
        // Otherwise create a new image and store it
        DecorationOverlayIcon decoratedImage = new DecorationOverlayIcon(baseImage,
                new ImageDescriptor[] { null, null, null, overlay, null }, size16) {
        };
        registry.put(decoratedImageId, decoratedImage);
    }
    return registry.get(decoratedImageId);
}

From source file:org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ModelExplorerDecorationAdapter.java

License:Open Source License

/**
 * Sets the decorated image./*from   w ww. ja v  a 2  s.c o  m*/
 *
 * @param baseImage the base image
 * @param decoration the decoration
 * @param decorationPosition the decoration position
 */
public void setDecoratedImage(Image baseImage, ImageDescriptor decoration, int decorationPosition) {

    if (decoration == null || baseImage == null) {
        return;
    }

    DecorationOverlayIcon decoratedImage = null;

    // Construct a new image identifier
    String decoratedImageId = baseImage.toString().concat(decoration.toString() + decorationPosition);

    // Return the stored image if we have one
    if (Activator.getDefault().getImageRegistry().get(decoratedImageId) == null) {
        // Otherwise create a new image and store it
        switch (decorationPosition) {

        case IDecoration.TOP_LEFT:
            decoratedImage = new DecorationOverlayIcon(baseImage,
                    new ImageDescriptor[] { decoration, null, null, null, null }, size16);
            break;
        case IDecoration.TOP_RIGHT:
            decoratedImage = new DecorationOverlayIcon(baseImage,
                    new ImageDescriptor[] { null, decoration, null, null, null }, size16);
            break;
        case IDecoration.BOTTOM_LEFT:
            decoratedImage = new DecorationOverlayIcon(baseImage,
                    new ImageDescriptor[] { null, null, decoration, null, null }, size16);
            break;
        case IDecoration.BOTTOM_RIGHT:
            decoratedImage = new DecorationOverlayIcon(baseImage,
                    new ImageDescriptor[] { null, null, null, decoration, null }, size16);
            break;
        case IDecoration.UNDERLAY:
            decoratedImage = new DecorationOverlayIcon(baseImage,
                    new ImageDescriptor[] { null, null, null, null, decoration }, size16);
            break;
        default:
            decoratedImage = new DecorationOverlayIcon(baseImage,
                    new ImageDescriptor[] { null, null, decoration, null, null }, size16);
            break;
        }
        Activator.getDefault().getImageRegistry().put(decoratedImageId, decoratedImage);
    }

}

From source file:org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ModelExplorerDecorationAdapter.java

License:Open Source License

/**
 * Sets the decorated image./*from ww  w. ja  va  2  s  . co  m*/
 *
 * @param baseImage the base image
 * @param decorationArray the decoration array
 * @param imageSize the image size
 */
public void setDecoratedImage(Image baseImage, ImageDescriptor[] decorationArray, Point imageSize) {
    DecorationOverlayIcon decoratedImage = null;

    // Construct a new image identifier
    String decoratedImageId = baseImage.toString().concat(decorationArray.toString());

    // Return the stored image if we have one
    if (Activator.getDefault().getImageRegistry().get(decoratedImageId) == null) {
        // Otherwise create a new image and store it
        decoratedImage = new DecorationOverlayIcon(baseImage, decorationArray, imageSize);

        Activator.getDefault().getImageRegistry().put(decoratedImageId, decoratedImage);
    }
}

From source file:org.eclipse.pde.internal.ds.ui.SharedImages.java

License:Open Source License

public static Image getImage(String key, int flags) {
    // TODO crufty code
    Image image = Activator.getDefault().getImageRegistry().get(key);
    if ((flags & F_DYNAMIC) != 0) {
        Image o = Activator.getDefault().getImageRegistry().get(key + OVR_DYNAMIC);
        if (o != null)
            return o;
        Image i = new DecorationOverlayIcon(image, SharedImages.getImageDescriptor(OVR_DYNAMIC),
                IDecoration.TOP_RIGHT).createImage();
        Activator.getDefault().getImageRegistry().put(key + OVR_DYNAMIC, i);
        return i;
    }/*from  www  .j  a v  a 2s . c o  m*/
    return image;
}