Search in sources :

Example 11 with DecorationOverlayIcon

use of org.eclipse.jface.viewers.DecorationOverlayIcon in project dsl-devkit by dsldevkit.

the class PreferenceRule method getImage.

/**
 * {@inheritDoc}
 */
@Override
public Image getImage() {
    if (isOptional()) {
        // No decoration
        return getUndecoratedImage();
    } else {
        final ImageDescriptor[] descriptors = new ImageDescriptor[ValidPreferenceConstants.DECORATION_QUADRANTS_COUNT];
        descriptors[IDecoration.BOTTOM_RIGHT] = ValidPreferenceConstants.LOCK_OVERLAY_IMAGE_DESCRIPTOR;
        // Overlay custom image over base image
        return getImageManager().createImage(new DecorationOverlayIcon(getUndecoratedImage(), descriptors));
    }
}
Also used : DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Example 12 with DecorationOverlayIcon

use of org.eclipse.jface.viewers.DecorationOverlayIcon in project tdq-studio-se by Talend.

the class PatternLabelProvider method getImage.

@Override
public Image getImage(Object element) {
    if (element instanceof IFolder) {
        return ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
    }
    if (element instanceof IFile) {
        Pattern findPattern = PatternResourceFileHelper.getInstance().findPattern((IFile) element);
        boolean validStatus = TaggedValueHelper.getValidStatus(findPattern);
        ImageDescriptor imageDescriptor = ImageLib.getImageDescriptor(ImageLib.PATTERN_REG);
        if (!validStatus) {
            ImageDescriptor warnImg = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_WARN_TSK);
            DecorationOverlayIcon icon = new DecorationOverlayIcon(imageDescriptor.createImage(), warnImg, IDecoration.BOTTOM_RIGHT);
            imageDescriptor = icon;
        }
        return imageDescriptor.createImage();
    }
    return null;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) IFile(org.eclipse.core.resources.IFile) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFolder(org.eclipse.core.resources.IFolder)

Example 13 with DecorationOverlayIcon

use of org.eclipse.jface.viewers.DecorationOverlayIcon in project tdq-studio-se by Talend.

the class DQRuleLabelProvider method getImage.

@Override
public Image getImage(Object element) {
    if (element instanceof IFolder) {
        return ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
    }
    if (element instanceof IFile && FactoriesUtil.DQRULE.equals(((IFile) element).getFileExtension())) {
        IFile file = (IFile) element;
        ModelElement me = DQRuleResourceFileHelper.getInstance().getModelElement(file);
        // add support for match rule
        ModelElement modelElement = DQRuleResourceFileHelper.getInstance().getModelElement(file);
        ModelElement rule = DQRuleResourceFileHelper.getInstance().doSwitch(modelElement);
        if (rule != null && rule instanceof MatchRuleDefinition) {
            ImageDescriptor imageDescriptor = ImageLib.getImageDescriptor(ImageLib.MATCH_RULE_ICON);
            return imageDescriptor.createImage();
        }
        // ~
        ImageDescriptor imageDescriptor = ImageLib.getImageDescriptor(ImageLib.DQ_RULE);
        if (rule != null && rule instanceof WhereRule) {
            boolean validStatus = TaggedValueHelper.getValidStatus(rule);
            if (!validStatus) {
                ImageDescriptor warnImg = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_WARN_TSK);
                DecorationOverlayIcon icon = new DecorationOverlayIcon(imageDescriptor.createImage(), warnImg, IDecoration.BOTTOM_RIGHT);
                imageDescriptor = icon;
            }
        }
        return imageDescriptor.createImage();
    }
    return null;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) IFile(org.eclipse.core.resources.IFile) WhereRule(org.talend.dataquality.rules.WhereRule) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFolder(org.eclipse.core.resources.IFolder)

Example 14 with DecorationOverlayIcon

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

the class ABSEditor method updateEditorIcon.

/**
 * Throws a {@link SWTException} if the display is disposed
 * @param editorres the resource of the editor input
 */
private void updateEditorIcon(IResource editorres) {
    try {
        int sev = editorres.findMaxProblemSeverity(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
        if (sev == IMarker.SEVERITY_INFO) {
            setTitleImage(getEditorInput().getImageDescriptor().createImage());
            return;
        }
        ISharedImages simages = PlatformUI.getWorkbench().getSharedImages();
        ImageDescriptor overlayIcon = null;
        switch(sev) {
            case IMarker.SEVERITY_WARNING:
                overlayIcon = simages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING);
                break;
            case IMarker.SEVERITY_ERROR:
                overlayIcon = simages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR);
                break;
        }
        Image resourceImage = getEditorInput().getImageDescriptor().createImage();
        final DecorationOverlayIcon icon = new DecorationOverlayIcon(resourceImage, overlayIcon, IDecoration.BOTTOM_LEFT);
        setTitleImage(icon.createImage());
    } catch (CoreException e) {
        standardExceptionHandling(e);
    }
}
Also used : DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) CoreException(org.eclipse.core.runtime.CoreException) ISharedImages(org.eclipse.ui.ISharedImages) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Image(org.eclipse.swt.graphics.Image)

Example 15 with DecorationOverlayIcon

use of org.eclipse.jface.viewers.DecorationOverlayIcon in project hale by halestudio.

the class InstanceValidationStatusAction method createImageDescriptors.

/**
 * Creates needed {@link ImageDescriptor}s.
 */
private void createImageDescriptors() {
    // load images
    noReportDescriptor = InstanceValidationUIPlugin.getImageDescriptor("icons/instance_validation_disabled.gif");
    Image noReportBaseImage = InstanceValidationUIPlugin.getDefault().getImageRegistry().get(InstanceValidationUIPlugin.IMG_INSTANCE_VALIDATION);
    reportOkDescriptor = new DecorationOverlayIcon(noReportBaseImage, InstanceValidationUIPlugin.getImageDescriptor("icons/signed_yes_ovr.gif"), IDecoration.BOTTOM_LEFT);
    reportWarningsDescriptor = new DecorationOverlayIcon(noReportBaseImage, PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING), IDecoration.BOTTOM_LEFT);
    reportErrorsDescriptor = new DecorationOverlayIcon(noReportBaseImage, PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR), IDecoration.BOTTOM_LEFT);
}
Also used : DecorationOverlayIcon(org.eclipse.jface.viewers.DecorationOverlayIcon) Image(org.eclipse.swt.graphics.Image)

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