Example usage for org.eclipse.jface.viewers IDecoration BOTTOM_LEFT

List of usage examples for org.eclipse.jface.viewers IDecoration BOTTOM_LEFT

Introduction

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

Prototype

int BOTTOM_LEFT

To view the source code for org.eclipse.jface.viewers IDecoration BOTTOM_LEFT.

Click Source Link

Document

Constant for the bottom left quadrant.

Usage

From source file:com.google.gwt.eclipse.oophm.Activator.java

License:Open Source License

/**
 * Returns the image with the specified Java image decorated added in the
 * lower left quadrant of the image./*from   w  ww.  jav  a2  s.c  o m*/
 */
private static ImageDescriptor decorateImageDescriptor(Image baseImage, ImageDescriptor overlayDescriptor) {
    return new DecorationOverlayIcon(baseImage, overlayDescriptor, IDecoration.BOTTOM_LEFT);
}

From source file:com.mentor.nucleus.bp.ui.explorer.decorators.DanglingReferenceDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (!CorePlugin.getProblemMarkerDecorationRequestsDisabled() && needsDecoration(element)) {
        decoration.addOverlay(ERROR, IDecoration.BOTTOM_LEFT);
        postLabelEvent(element);/*from   w w w .  j ava2s. c o  m*/
    }
}

From source file:com.mentor.nucleus.bp.ui.explorer.decorators.SynchronizationDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    // rather than check the class for the isSynchronizedMethod through
    // reflection, only consider the known classes
    if (!isSynchronized(element)) {
        decoration.addOverlay(SYNC_OVERLAY, IDecoration.BOTTOM_LEFT);
    }/*w w  w  .  j  a va2s  . c  om*/
}

From source file:com.mercatis.lighthouse3.status.ui.LighthouseStatusDecorator.java

License:Apache License

public void decorate(Object element, IDecoration decoration) {
    LighthouseDomain lighthouseDomain = CommonBaseActivator.getPlugin().getDomainService()
            .getLighthouseDomainByEntity(element);
    if (element instanceof StatusCarrier) {
        StatusHistogram sh = CommonBaseActivator.getPlugin().getStatusService()
                .getStatusHistogramForObject(lighthouseDomain, element);
        if (sh.getError() > 0) {
            decoration.addOverlay(getImageDescriptorForStatus(Status.ERROR, Size.x8), IDecoration.BOTTOM_LEFT);
            decoration.addSuffix(" " + sh.getError() + " status erroneous");
        } else if (sh.getStale() > 0) {
            decoration.addOverlay(getImageDescriptorForStatus(Status.STALE, Size.x8), IDecoration.BOTTOM_LEFT);
            decoration.addSuffix(" " + sh.getStale() + " status stale");
        } else if (sh.getOk() > 0) {
            decoration.addOverlay(getImageDescriptorForStatus(Status.OK, Size.x8), IDecoration.BOTTOM_LEFT);
            decoration.addSuffix(" " + sh.getOk() + " status ok");
        } else if (sh.getNone() > 0) {
            decoration.addOverlay(getImageDescriptorForStatus(Status.NONE, Size.x8), IDecoration.BOTTOM_LEFT);
        }/*from  w  w  w . java 2 s .c o m*/
    }
}

From source file:com.nokia.tools.vct.confml.editor.view.viewers.ViewTreeViewerLabelDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {

    if (element instanceof ESetting) {
        if (((ESetting) element).isReadOnly()) {
            decoration.addOverlay(readOnlyDescriptor, IDecoration.TOP_RIGHT);
        }/*from  w w  w  . ja  v a2 s. c om*/
    } else if (element instanceof ESettingEntryImpl) {
        if (((ESettingEntryImpl) element).getValue().isReadOnly()) {
            decoration.addOverlay(readOnlyDescriptor, IDecoration.TOP_RIGHT);
            decoration.addOverlay(warningDescriptor, IDecoration.BOTTOM_LEFT);
        }
    } else if (hasMarker(element, ERROR, null)) {
        decoration.addOverlay(errorDescriptor, IDecoration.BOTTOM_LEFT);
    } else if (hasMarker(element, WARNING, null)) {
        decoration.addOverlay(warningDescriptor, IDecoration.BOTTOM_LEFT);
    }

    if (element instanceof ESettingRef) {
        ESettingRef ref = (ESettingRef) element;
        if (ref.getTarget() instanceof ESetting) {
            if (((ESetting) ref.getTarget()).isReadOnly()) {
                decoration.addOverlay(readOnlyDescriptor, IDecoration.TOP_RIGHT);
            }
        }
    }

    if (element instanceof EAppFeature) {
        EAppFeature feature = (EAppFeature) element;
        if (isDefaultValue(feature)) {
            decoration.setFont(DEFAULT_FONT);
        } else {
            decoration.setFont(BOLD_FONT);
        }
    }
}

From source file:com.puppetlabs.geppetto.pp.dsl.ui.jdt_ersatz.AggregateErrorLabelDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    if (useJDT)/*w w w .  ja  v  a2s .c  om*/
        return;
    if (element instanceof IResource == false)
        return;

    // // should be installed for IFolder and IProject, but better check
    // if(!(element instanceof IFolder || element instanceof IProject))
    // return;

    // get the max severity from markers
    IResource resource = (IResource) element;
    if (!resource.isAccessible())
        return;

    int severity = -1;
    try {
        severity = resource.findMaxProblemSeverity(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
    } catch (CoreException e) {
        // TODO should be logged - (should not really happen)
        e.printStackTrace();
    }
    if (severity < IMarker.SEVERITY_WARNING) {
        decoration.addOverlay(null, IDecoration.BOTTOM_LEFT);
        return;
    }

    ImageDescriptor overlay = null;
    if (severity == IMarker.SEVERITY_ERROR)
        overlay = getErrorImageDescriptor();
    else
        overlay = getWarningImageDescriptor();

    decoration.addOverlay(overlay, IDecoration.BOTTOM_LEFT);
}

From source file:com.rcpcompany.uibindings.internal.decorators.extenders.ViewerSpecificLabelDecoratorExtender.java

License:Open Source License

@Override
public void extend(final IUIBindingDecoratorExtenderContext context) {
    final ValidationLabelDecorator labelDecorator = getLabelDecorator(context.getBinding());

    if (labelDecorator == null)
        return;/* ww w . j ava2  s .c o m*/

    /*
     * We want to be notified next time the decorator changes...
     * 
     * Note that we expect the decorator to conform to the comment of #addListener(): "Adds a
     * listener to this label provider. Has no effect if an identical listener is already
     * registered.".
     * 
     * This is done this way to avoid any references from the extender to the decorator, as
     * these can be problematic when garbage collecting...
     */
    labelDecorator.addListener(this);

    final EObject element = context.getBinding().getModelObject();

    final IDecoration decoration = new IDecoration() {
        @Override
        public void addPrefix(String prefix) {
            // TODO
        }

        @Override
        public void addSuffix(String suffix) {
            // TODO
        }

        @Override
        public void addOverlay(ImageDescriptor overlay) {
            final DecorationPosition pos = IManager.Factory.getManager().getMessageDecorationPosition();
            switch (pos) {
            case TOP_LEFT:
            case CENTER_LEFT:
                addOverlay(overlay, IDecoration.TOP_LEFT);
                break;
            case BOTTOM_LEFT:
                addOverlay(overlay, IDecoration.BOTTOM_LEFT);
                break;
            case TOP_RIGHT:
            case CENTER_RIGHT:
                addOverlay(overlay, IDecoration.TOP_RIGHT);
                break;
            case BOTTOM_RIGHT:
                addOverlay(overlay, IDecoration.BOTTOM_RIGHT);
                break;
            default:
                LogUtils.error(this, "Unknown position: " + pos);
                addOverlay(overlay, IDecoration.TOP_LEFT);
                break;
            }
        }

        @Override
        public void addOverlay(ImageDescriptor overlay, int quadrant) {
            final Image image = getResourceManager().createImage(overlay);
            switch (quadrant) {
            case IDecoration.BOTTOM_LEFT:
                context.setDecoratingImage(DecorationPosition.BOTTOM_LEFT, false, image, null);
                break;
            case IDecoration.TOP_LEFT:
                context.setDecoratingImage(DecorationPosition.TOP_LEFT, false, image, null);
                break;
            case IDecoration.BOTTOM_RIGHT:
                context.setDecoratingImage(DecorationPosition.BOTTOM_RIGHT, false, image, null);
                break;
            case IDecoration.TOP_RIGHT:
                context.setDecoratingImage(DecorationPosition.TOP_RIGHT, false, image, null);
                break;
            case IDecoration.REPLACE:
                context.setImage(image);
                break;
            default:
                LogUtils.error(this, "Unknown quadrant: " + quadrant);
                break;
            }
        }

        @Override
        public void setForegroundColor(Color color) {
            context.setForegound(color);
        }

        @Override
        public void setBackgroundColor(Color color) {
            context.setBackgound(color);
        }

        @Override
        public void setFont(Font font) {
            context.setFont(font);
        }

        @Override
        public IDecorationContext getDecorationContext() {
            return DecorationContext.DEFAULT_CONTEXT;
        }
    };
    labelDecorator.decorate(element, decoration);
}

From source file:com.redhat.ceylon.eclipse.code.preferences.ResourceListLabelProvider.java

License:Open Source License

@Override
public Image getImage(Object element) {
    if (element instanceof CPListElement) {
        CPListElement cpentry = (CPListElement) element;
        return getCPListElementBaseImage(cpentry);
        //            ImageDescriptor imageDescriptor= getCPListElementBaseImage(cpentry);
        //            if (imageDescriptor != null) {
        //                if (cpentry.isMissing() || cpentry.hasMissingChildren()) {
        //                    imageDescriptor= new JavaElementImageDescriptor(imageDescriptor, JavaElementImageDescriptor.ERROR, JavaElementImageProvider.SMALL_SIZE);
        //                }
        //                return fRegistry.get(imageDescriptor);
        //            }
    } else if (element instanceof CPListElementAttribute) {
        CPListElementAttribute attribute = (CPListElementAttribute) element;
        String key = (attribute).getKey();
        if (key.equals(CPListElement.SOURCEATTACHMENT)) {
            return fRegistry.get(JavaPluginImages.DESC_OBJS_SOURCE_ATTACH_ATTRIB);
        } else if (key.equals(CPListElement.OUTPUT)) {
            return fRegistry.get(JavaPluginImages.DESC_OBJS_OUTPUT_FOLDER_ATTRIB);
        } else if (key.equals(CPListElement.EXCLUSION)) {
            return fRegistry.get(JavaPluginImages.DESC_OBJS_EXCLUSION_FILTER_ATTRIB);
        } else if (key.equals(CPListElement.INCLUSION)) {
            return fRegistry.get(JavaPluginImages.DESC_OBJS_INCLUSION_FILTER_ATTRIB);
        } else if (key.equals(CPListElement.ACCESSRULES)) {
            return fRegistry.get(JavaPluginImages.DESC_OBJS_ACCESSRULES_ATTRIB);
        } else if (key.equals(CPListElement.IGNORE_OPTIONAL_PROBLEMS)) {
            Image image = getCPListElementBaseImage(attribute.getParent());
            if (image != null) {
                ImageDescriptor overlay = JavaPluginImages.DESC_OVR_IGNORE_OPTIONAL_PROBLEMS;
                ImageDescriptor imageDescriptor = new DecorationOverlayIcon(image, overlay,
                        IDecoration.BOTTOM_LEFT);
                return fRegistry.get(imageDescriptor);
            }/*  w  ww  .  j a v  a  2s.  c o  m*/
        } else {
            ClasspathAttributeConfiguration config = fAttributeDescriptors.get(key);
            if (config != null) {
                return fRegistry.get(config.getImageDescriptor(attribute.getClasspathAttributeAccess()));
            }
        }
        return fSharedImages.getImage(ISharedImages.IMG_OBJS_CLASSPATH_VAR_ENTRY);
    } else if (element instanceof CPUserLibraryElement) {
        if (((CPUserLibraryElement) element).hasMissingChildren()) {
            ImageDescriptor descriptor = fSharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_LIBRARY);
            if (descriptor != null) {
                return fRegistry.get(new JavaElementImageDescriptor(descriptor,
                        JavaElementImageDescriptor.ERROR, JavaElementImageProvider.SMALL_SIZE));
            }
        }
        return fSharedImages.getImage(ISharedImages.IMG_OBJS_LIBRARY);
    } else if (element instanceof IAccessRule) {
        IAccessRule rule = (IAccessRule) element;
        return AccessRulesLabelProvider.getResolutionImage(rule.getKind());
    }
    return null;
}

From source file:com.safi.workshop.navigator.DirtyDecorator.java

License:Open Source License

private void doDecorate(IDecoration decoration, DirtyMode mode) {
    String iconPath = null;// ww w .j  a va2s.c om
    switch (mode) {

    case NOT_COMMITTED:
        decoration.addPrefix(">");
    case COMMITTED:
        iconPath = syncedIcon;
        break;
    case NOT_PERSISTED:
        iconPath = nonPersistedIcon;

    }
    ImageDescriptor descriptor = imageMap.get(iconPath);
    if (descriptor == null) {
        URL url = Platform.find(Platform.getBundle("AsteriskSafletDesigner.diagram"), new Path(iconPath)); // NON-NLS-1
        if (url == null)
            return;
        descriptor = ImageDescriptor.createFromURL(url);
        imageMap.put(iconPath, descriptor);
    }
    decoration.addOverlay(descriptor, IDecoration.BOTTOM_LEFT);
}

From source file:eclox.core.ui.DoxyfileDecorator.java

License:Open Source License

/**
 * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
 *//* w  w  w .j a va 2s. c o m*/
public void decorate(Object element, IDecoration decoration) {
    if (Doxyfile.isDoxyfile(element)) {
        Doxyfile doxyfile = new Doxyfile((IFile) element, null);
        BuildJob job = BuildJob.findJob(doxyfile);
        if (job != null && job.getState() == BuildJob.RUNNING) {
            decoration.addOverlay(ImageDescriptor.createFromFile(this.getClass(), "build_co.gif"),
                    IDecoration.BOTTOM_LEFT);
            decoration.addSuffix(" (building...)");
        }
    }
}