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

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

Introduction

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

Prototype

void addOverlay(ImageDescriptor overlay, int quadrant);

Source Link

Document

Adds an overlay to the element's image.

Usage

From source file:com.google.gdt.eclipse.managedapis.ui.ManageApiInfoDecorator.java

License:Open Source License

/**
 * Checks if classpath entry will cause error. If it does, it will add error
 * icon to Managed Api container and return true. Else will return false.
 *///from ww w . j a  va2s  .c o m
private boolean checkAndApplyErrorDecoration(IDecoration decoration, ManagedApiProject managedApiProject,
        IClasspathEntry entry) {
    if (!JavaConventions.validateClasspathEntry(managedApiProject.getJavaProject(), entry, false).isOK()) {
        ImageDescriptor overlay = JFaceResources.getImageRegistry()
                .getDescriptor("org.eclipse.jface.fieldassist.IMG_DEC_FIELD_ERROR");
        decoration.addOverlay(overlay, IDecoration.BOTTOM_LEFT);
        return true;
    }
    return false;
}

From source file:com.google.gdt.eclipse.managedapis.ui.ManagedApiContainerDecorator.java

License:Open Source License

private void applyApiSpecificContainerIcon(Object element, IDecoration decoration)
        throws MalformedURLException {
    ImageDescriptor replacementIcon = null;

    ManagedApi managedApi = ManagedApiContainer
            .getManagedApiForClassPathContainer((ClassPathContainer) element);
    if (managedApi != null && managedApi.hasClasspathContainerIcon()) {
        replacementIcon = managedApi.getClasspathContainerIconImageDescriptor();
    }/* ww  w . ja  va  2  s.  co  m*/
    if (replacementIcon == null) {
        replacementIcon = resources.getGoogleAPIContainerIcon16ImageDescriptor();
    }
    decoration.addOverlay(replacementIcon, IDecoration.REPLACE);
}

From source file:com.liferay.ide.project.ui.LiferayPluginProjectDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IProject) {
        IProject project = (IProject) element;

        ImageDescriptor overlay = null;//from   w  ww.j a  va  2s. c  o  m

        if (hasFacet(project, PORTLET_FACET)) {
            overlay = getLiferay();
        } else if (hasFacet(project, HOOK_FACET)) {
            overlay = getLiferay();
        } else if (hasFacet(project, EXT_FACET)) {
            overlay = getLiferay();
        } else if (hasFacet(project, LAYOUTTPL_FACET)) {
            overlay = getLiferay();
        } else if (hasFacet(project, THEME_FACET)) {
            overlay = getLiferay();
        } else if (hasFacet(project, WEB_FACET)) {
            overlay = getLiferay();
        } else if (hasNature(project, LiferayNature.NATURE_ID)) {
            overlay = getLiferay();
        }

        if (overlay != null) {
            // next two lines dangerous!
            // DecorationContext ctx = (DecorationContext) decoration.getDecorationContext();
            // ctx.putProperty( IDecoration.ENABLE_REPLACE, true );

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

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);/*  w w w.j ava2 s . com*/
    }
}

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);
    }//from w w w .  j a v a  2 s  . c o m
}

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.  j a va  2s. com*/
    }
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.LighthouseOperationsDecorator.java

License:Apache License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof Deployment) {
        Deployment deployment = (Deployment) element;
        Integer installedCounter = decoratedDeployments.get(deployment);
        if (installedCounter == null) {
            installedCounter = OperationBase.getOperationInstallationService().findAtDeployment(deployment)
                    .size();/* w w w  . j a v a2 s .com*/
            decoratedDeployments.put(deployment, installedCounter);
        }
        if (installedCounter > 0) {
            decoration.addOverlay(image, IDecoration.TOP_LEFT);
        }
    }
}

From source file:com.mountainminds.eclemma.internal.ui.decorators.CoverageDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    final ICoverageNode coverage = CoverageTools.getCoverageInfo(element);
    if (coverage == null) {
        // no coverage data
        return;// w w w  .  j a v a 2 s.  com
    }
    // TODO obtain counter from preferences
    ICounter counter = coverage.getInstructionCounter();
    ImageDescriptor overlay = EclEmmaUIPlugin.getCoverageOverlay(counter.getCoveredRatio());
    decoration.addOverlay(overlay, IDecoration.TOP_LEFT);
    decoration.addSuffix(SUFFIX_FORMAT.format(Double.valueOf(counter.getCoveredRatio())));
}

From source file:com.nextep.designer.dbgm.ui.decorators.ForeignKeyColumnsDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IBasicColumn) {
        final IBasicColumn column = (IBasicColumn) element;
        final IColumnable parent = ((IBasicColumn) element).getParent();
        if (parent instanceof IBasicTable) {
            boolean needsDecoration = false;
            for (IKeyConstraint key : ((IBasicTable) parent).getConstraints()) {
                switch (key.getConstraintType()) {
                case FOREIGN:
                    if (key.getConstrainedColumnsRef().contains(column.getReference())) {
                        needsDecoration = true;
                        break;
                    }/*from   ww w. j a v  a  2 s  .  c  om*/
                }
            }
            if (needsDecoration) {
                decoration.addOverlay(descriptor, quadrant);
            }
        }
    }
}

From source file:com.nextep.designer.synch.ui.decorators.DataSynchronizationDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {

    if (element instanceof IBasicTable) {
        if (descriptor == null) {
            descriptor = SynchUIPlugin.imageDescriptorFromPlugin(SynchUIPlugin.PLUGIN_ID,
                    "/resource/datasync-deco.png"); //$NON-NLS-1$
        }// ww w . j  a  va  2  s.c o m
        quadrant = IDecoration.TOP_RIGHT;
        Collection<IVersionable<?>> tables = SynchUIPlugin.getService(ISynchronizationUIService.class)
                .getDataSynchronizationTables();
        if (tables.contains(element)) {
            decoration.addOverlay(descriptor, quadrant);
        }

    }
}