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);

Source Link

Document

Adds an overlay to the element's image.

Usage

From source file:com.aptana.editor.decorator.ProblemsLabelDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    int adornmentFlags = computeAdornmentFlags(element);
    switch (adornmentFlags) {
    case ERROR:/*from w ww  .ja  va 2 s  . c o m*/
        decoration.addOverlay(EditorPluginImages.DESC_OVR_ERROR);
        break;
    case WARNING:
        decoration.addOverlay(EditorPluginImages.DESC_OVR_WARNING);
        break;
    }
}

From source file:com.aptana.git.ui.internal.GitLightweightDecorator.java

License:Open Source License

private void decorateFile(IDecoration decoration, final IResource resource) {
    IFile file = (IFile) resource;/*from   w w  w  .j  a v  a 2 s  .  c om*/
    GitRepository repo = getRepo(resource);
    if (repo == null)
        return;

    ChangedFile changed = repo.getChangedFileForResource(file);
    if (changed == null) {
        return;
    }

    ImageDescriptor overlay = null;
    // Unstaged trumps staged when decorating. One file may have both staged and unstaged changes.
    if (changed.hasUnstagedChanges()) {
        decoration.setForegroundColor(GitColors.redFG());
        decoration.setBackgroundColor(GitColors.redBG());
        if (changed.getStatus() == ChangedFile.Status.NEW) {
            overlay = untrackedImage();
        } else if (changed.getStatus() == ChangedFile.Status.UNMERGED) {
            overlay = conflictImage();
        }
    } else if (changed.hasStagedChanges()) {
        decoration.setForegroundColor(GitColors.greenFG());
        decoration.setBackgroundColor(GitColors.greenBG());
        if (changed.getStatus() == ChangedFile.Status.DELETED) {
            overlay = stagedRemovedImage();
        } else if (changed.getStatus() == ChangedFile.Status.NEW) {
            overlay = stagedAddedImage();
        }
    }
    decoration.addPrefix(DIRTY_PREFIX);
    if (overlay != null)
        decoration.addOverlay(overlay);
}

From source file:com.aptana.ide.debug.internal.ui.decorators.StartPageDecorator.java

License:Open Source License

/**
 * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object,
 *      org.eclipse.jface.viewers.IDecoration)
 *//*from   w  w  w  .j a  v  a  2  s.  c o m*/
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IFile) {
        if (StartPageManager.getDefault().isStartPage((IResource) element)) {
            decoration.addOverlay(START_PAGE);
        }
    }
}

From source file:com.aptana.ide.server.ui.decorators.StartPageDecorator.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 v a2  s .  c  o  m*/
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IResource == false) {
        return;
    }
    IResource resource = (IResource) element;
    IResource startPage = decoratedResource;
    if (startPage != null && startPage.equals(resource)) {
        decoration.addOverlay(START_PAGE);
    }

    // decoration.setFont(new Font(decoration.setFont(new Font(JFaceResources.getDefaultFont().getFontData());
}

From source file:com.aptana.ide.syncing.ui.decorators.CloakedLabelDecorator.java

License:Open Source License

protected void addDecoration(IDecoration decoration) {
    decoration.addOverlay(IMAGE);
}

From source file:com.aptana.js.debug.ui.internal.decorators.StartPageDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IFile) {
        if (StartPageManager.getDefault().isStartPage((IResource) element)) {
            decoration.addOverlay(START_PAGE);
        }//from  w ww  .j  a v a  2 s .  com
    }
}

From source file:com.codenvy.eclipse.ui.team.CodenvyLightweightLabelDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    final IResource resource = ResourceUtil.getResource(element);

    if (resource != null && resource.getType() != ROOT) {
        final CodenvyProvider provider = (CodenvyProvider) getProvider(resource.getProject(),
                CodenvyProvider.PROVIDER_ID);

        if (provider != null) {
            final CodenvyMetaResource metaResource = (CodenvyMetaResource) getAdapter(resource,
                    CodenvyMetaResource.class, true);

            if (metaResource != null && metaResource.isTracked()) {
                decoration.addOverlay(trackedImageDescriptor);

                if (resource.getType() == PROJECT) {
                    decoration.addSuffix(" [codenvy: " + provider.getProjectMetadata().url + "]");
                }//ww w.jav  a  2  s .  com
            }
        }
    }
}

From source file:com.google.dart.tools.ui.OverrideIndicatorLabelDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    int adornmentFlags = computeAdornmentFlags(element);
    if ((adornmentFlags & DartElementImageDescriptor.IMPLEMENTS) != 0) {
        if ((adornmentFlags & DartElementImageDescriptor.SYNCHRONIZED) != 0) {
            decoration.addOverlay(DartPluginImages.DESC_OVR_SYNCH_AND_IMPLEMENTS);
        } else {/*from www . jav a 2s.c o  m*/
            decoration.addOverlay(DartPluginImages.DESC_OVR_IMPLEMENTS);
        }
    } else if ((adornmentFlags & DartElementImageDescriptor.OVERRIDES) != 0) {
        if ((adornmentFlags & DartElementImageDescriptor.SYNCHRONIZED) != 0) {
            decoration.addOverlay(DartPluginImages.DESC_OVR_SYNCH_AND_OVERRIDES);
        } else {
            decoration.addOverlay(DartPluginImages.DESC_OVR_OVERRIDES);
        }
    }
}

From source file:com.google.dart.tools.ui.ProblemsLabelDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    int adornmentFlags = computeAdornmentFlags(element);
    if (adornmentFlags == ERRORTICK_ERROR) {
        decoration.addOverlay(DartPluginImages.DESC_OVR_ERROR);
    } else if (adornmentFlags == ERRORTICK_WARNING) {
        decoration.addOverlay(DartPluginImages.DESC_OVR_WARNING);
    }/*from  w  w  w.  j  a  v  a  2  s .c o  m*/
}

From source file:com.iw.plugins.spindle.ui.decorators.ContextRootDecorator.java

License:Mozilla Public License

public void decorate(Object element, IDecoration decoration) {

    if (decoration == null) {
        UIPlugin.log("ContextRootDecorator.decorate() called with null decoration");
        return;/*from ww w.jav  a 2  s  .c  om*/
    }

    IContainer container = (IContainer) ((IAdaptable) element).getAdapter(IContainer.class);
    if (container != null) {
        try {
            IProject project = container.getProject();
            ITapestryProject tproject = (ITapestryProject) project.getNature(TapestryCore.NATURE_ID);
            if (tproject != null) {
                IContainer projectWebContextRoot = tproject.getWebContextFolder();
                if (projectWebContextRoot == null)
                    return;
                if (container.equals(projectWebContextRoot)) {
                    decoration.addOverlay(Images.getImageDescriptor("project_ovr.gif"));
                } else if (projectWebContextRoot != null && onContextPath(container, projectWebContextRoot)) {
                    decoration.addOverlay(Images.getImageDescriptor("project_ovr_grey.gif"));
                }
            }
        } catch (CoreException e) {
        }
    }

}