Search in sources :

Example 1 with StrikeoutStyler

use of org.bndtools.utils.jface.StrikeoutStyler in project bndtools by bndtools.

the class PluginDeclarationLabelProvider method update.

@Override
public void update(ViewerCell cell) {
    IConfigurationElement element = (IConfigurationElement) cell.getElement();
    boolean deprecated = element.getAttribute("deprecated") != null;
    Styler mainStyler = deprecated ? new StrikeoutStyler(null) : null;
    StyledString label = new StyledString(element.getAttribute("name"), mainStyler);
    Styler classStyle = deprecated ? new StrikeoutStyler(StyledString.QUALIFIER_STYLER) : StyledString.QUALIFIER_STYLER;
    label.append(" [" + element.getAttribute("class") + "]", classStyle);
    cell.setText(label.toString());
    cell.setStyleRanges(label.getStyleRanges());
    String iconPath = element.getAttribute("icon");
    if (iconPath != null) {
        ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor().getName(), iconPath);
        if (descriptor != null) {
            Image image = descriptor.createImage();
            images.add(image);
            cell.setImage(image);
        }
    }
}
Also used : StrikeoutStyler(org.bndtools.utils.jface.StrikeoutStyler) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) Styler(org.eclipse.jface.viewers.StyledString.Styler) StrikeoutStyler(org.bndtools.utils.jface.StrikeoutStyler) Image(org.eclipse.swt.graphics.Image) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Aggregations

StrikeoutStyler (org.bndtools.utils.jface.StrikeoutStyler)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 StyledString (org.eclipse.jface.viewers.StyledString)1 Styler (org.eclipse.jface.viewers.StyledString.Styler)1 Image (org.eclipse.swt.graphics.Image)1