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:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for checked out state.
 * //from w w  w.  ja va  2  s  . c o m
 * @param decoration
 */
private static void decorateCheckedOut(IDecoration decoration, String version) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateCheckedOut"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    decoration.addOverlay(IMG_DESC_CHECKED_OUT);
    if (ClearCaseUIPreferences.decorateElementStatesWithTextPrefix()) {
        decoration.addPrefix(ClearCaseUI.getTextPrefixDirty());
    }

    if (ClearCaseUIPreferences.decorateElementsWithVersionInfo() && null != version) {
        decoration.addSuffix("  " + version); //$NON-NLS-1$
    }
}

From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for dirty state.//from  w  w w  .  j a  v  a2 s .c  o m
 * 
 * @param decoration
 */
private static void decorateDirty(IDecoration decoration) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateDirty"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    decoration.addOverlay(IMG_DESC_DIRTY);
    if (ClearCaseUIPreferences.decorateElementStatesWithTextPrefix()) {
        decoration.addPrefix(ClearCaseUI.getTextPrefixDirty());
    }
}

From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for edited state./*from   w w  w  . j  a v  a2 s.co m*/
 * 
 * @param decoration
 */
private static void decorateEdited(IDecoration decoration) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateEdited"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    if (ClearCaseUIPreferences.decorateEditedElements()) {
        decoration.addOverlay(IMG_DESC_EDITED);
    }
    if (ClearCaseUIPreferences.decorateElementStatesWithTextPrefix()) {
        decoration.addPrefix(ClearCaseUI.getTextPrefixEdited());
    }
}

From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for hijaced state.//from   ww w .j  av a  2 s  . c o  m
 * 
 * @param decoration
 */
private static void decorateHijacked(IDecoration decoration, String version) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateHijacked"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    if (ClearCaseUIPreferences.decorateHijackedElements()) {
        decoration.addOverlay(IMG_DESC_HIJACKED);
    }
    if (ClearCaseUIPreferences.decorateElementStatesWithTextPrefix()) {
        decoration.addPrefix(ClearCaseUI.getTextPrefixHijacked());
    }
    if (ClearCaseUIPreferences.decorateElementsWithVersionInfo() && null != version) {
        decoration.addSuffix("  " + version); //$NON-NLS-1$
    }
}

From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for links.//  w  w w  . ja va2 s.  co  m
 * 
 * @param decoration
 * @param isLinkTargetCheckedOut
 */
private static void decorateLink(IDecoration decoration, String linkTarget, boolean isValidLinkTarget,
        boolean isLinkTargetCheckedOut) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateLink"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    if (isLinkTargetCheckedOut) {
        decoration.addOverlay(IMG_DESC_CHECKED_OUT);
    } else if (isValidLinkTarget) {
        decoration.addOverlay(IMG_DESC_LINK);
    } else {
        decoration.addOverlay(IMG_DESC_LINK_WARNING);
    }

    decoration.addSuffix(" --> " + linkTarget); //$NON-NLS-1$
}

From source file:net.sourceforge.taggerplugin.ui.TaggedLabelDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    try {/*from   w w  w.  j  a va 2  s.co  m*/
        final IResource resource = (IResource) element;
        if (resource.exists() && TaggedMarkerHelper.getMarker(resource) != null) {
            decoration.addOverlay(OVERLAY, TaggerActivator.getDefault().getPreferenceStore()
                    .getInt(PreferenceConstants.POSITION_LABEL_DECORATION.getKey()));
        }
    } catch (CoreException ce) {
        TaggerLog.error("Unable to decorate resource: " + ce.getMessage(), ce);
    }
}

From source file:net.sourceforge.tagsea.core.ui.decorators.WaypointDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    /**//w w  w.ja v a  2  s  .  com
     * Checks that the element is an IResource with the 'Read-only' attribute
     * and adds the decorator based on the specified image description and the
     * integer representation of the placement option.
     */
    IResource resource = (IResource) element;
    try {
        IMarker[] markers = resource.findMarkers(TagSEAPlugin.MARKER_ID, true, IResource.DEPTH_ZERO);
        if (markers.length > 0) {
            decoration.addOverlay(descriptor, quadrant);
        } else {
            markers = resource.findMarkers(TagSEAPlugin.MARKER_ID, true, IResource.DEPTH_INFINITE);
            if (markers.length > 0) {
                decoration.addOverlay(parentDescriptor, quadrant);
            }
        }
    } catch (CoreException e) {
    }
}

From source file:org.absmodels.abs.plugin.decorators.ModuleDecorator.java

License:Open Source License

private void addErrorOverlay(IDecoration decoration) {
    decoration.addOverlay(ERROR_MARKER_DESCRIPTOR, IDecoration.BOTTOM_LEFT);
}

From source file:org.apache.directory.studio.ldapbrowser.ui.views.browser.BrowserViewLabelDecorator.java

License:Apache License

/**
 * {@inheritDoc}/*from w  w  w. ja va 2  s . com*/
 */
public void decorate(Object element, IDecoration decoration) {
    IEntry entry = null;
    if (element instanceof ISearchResult) {
        entry = ((ISearchResult) element).getEntry();
        decoration.addOverlay(
                BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_OVR_SEARCHRESULT),
                IDecoration.BOTTOM_RIGHT);
    } else if (element instanceof IEntry) {
        entry = (IEntry) element;
        if (entry.getChildrenFilter() != null) {
            decoration.addOverlay(
                    BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_OVR_FILTERED),
                    IDecoration.BOTTOM_RIGHT);
        }
    }

    if (entry instanceof IContinuation || element instanceof IContinuation) {
        decoration.addOverlay(BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_OVR_REF),
                IDecoration.TOP_LEFT);
    }
}

From source file:org.apache.directory.studio.schemaeditor.view.SchemaEditorSchemaCheckerLabelDecorator.java

License:Apache License

/**
 * Decorates the element from the value of its state.
 *
 * @param state// w ww. ja v a 2s  .  com
 *      the state
 * @param decoration
 *      the decoration
 */
private void decorateState(ElementState state, IDecoration decoration) {
    switch (state) {
    case WARNING:
        decoration.addOverlay(Activator.getDefault().getImageDescriptor(PluginConstants.IMG_OVERLAY_WARNING),
                IDecoration.BOTTOM_LEFT);
        break;
    case ERROR:
        decoration.addOverlay(Activator.getDefault().getImageDescriptor(PluginConstants.IMG_OVERLAY_ERROR),
                IDecoration.BOTTOM_LEFT);
        break;
    default:
        break;
    }
}