Example usage for org.eclipse.jface.viewers ViewerLabel getFont

List of usage examples for org.eclipse.jface.viewers ViewerLabel getFont

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ViewerLabel getFont.

Prototype

public Font getFont() 

Source Link

Document

Get the font.

Usage

From source file:org.eclipse.jubula.client.ui.provider.DecoratingCellLabelProvider.java

License:Open Source License

/**
 * {@inheritDoc}//from   w  ww .j a  v  a 2 s .com
 */
public void update(ViewerCell cell) {

    ViewerLabel label = new ViewerLabel(cell.getText(), cell.getImage());

    // Set up the initial settings from the label provider
    label.setBackground(getBackground(cell.getElement()));
    label.setForeground(getForeground(cell.getElement()));
    label.setFont(getFont(cell.getElement()));

    updateLabel(label, cell.getElement());

    cell.setBackground(label.getBackground());
    cell.setForeground(label.getForeground());
    cell.setFont(label.getFont());

    if (label.hasNewText()) {
        cell.setText(label.getText());
    }

    if (label.hasNewImage()) {
        cell.setImage(label.getImage());
    }
}

From source file:org.neuro4j.studio.debug.ui.views.StructuredViewer.java

License:Apache License

/**
 * Build a label up for the element using the supplied label provider.
 * /*from   w ww . j ava2 s .c  om*/
 * @param updateLabel
 *        The ViewerLabel to collect the result in
 * @param element
 *        The element being decorated.
 */
protected void buildLabel(ViewerLabel updateLabel, Object element) {

    if (getLabelProvider() instanceof IViewerLabelProvider) {
        IViewerLabelProvider itemProvider = (IViewerLabelProvider) getLabelProvider();
        itemProvider.updateLabel(updateLabel, element);

        colorAndFontCollector.setUsedDecorators();

        if (updateLabel.hasNewBackground()) {
            colorAndFontCollector.setBackground(updateLabel.getBackground());
        }

        if (updateLabel.hasNewForeground()) {
            colorAndFontCollector.setForeground(updateLabel.getForeground());
        }

        if (updateLabel.hasNewFont()) {
            colorAndFontCollector.setFont(updateLabel.getFont());
        }
        return;

    }

    if (getLabelProvider() instanceof ILabelProvider) {
        ILabelProvider labelProvider = (ILabelProvider) getLabelProvider();
        updateLabel.setText(labelProvider.getText(element));
        updateLabel.setImage(labelProvider.getImage(element));
    }

}

From source file:org.neuro4j.studio.debug.ui.views.StructuredViewer.java

License:Apache License

/**
 * Build a label up for the element using the supplied label provider.
 * /* w ww  . jav  a 2  s .c o m*/
 * @param updateLabel
 *        The ViewerLabel to collect the result in
 * @param element
 *        The element being decorated.
 * @param labelProvider
 *        ILabelProvider the labelProvider for the receiver.
 */
void buildLabel(ViewerLabel updateLabel, Object element, IViewerLabelProvider labelProvider) {

    labelProvider.updateLabel(updateLabel, element);

    colorAndFontCollector.setUsedDecorators();

    if (updateLabel.hasNewBackground()) {
        colorAndFontCollector.setBackground(updateLabel.getBackground());
    }

    if (updateLabel.hasNewForeground()) {
        colorAndFontCollector.setForeground(updateLabel.getForeground());
    }

    if (updateLabel.hasNewFont()) {
        colorAndFontCollector.setFont(updateLabel.getFont());
    }

}

From source file:org.neuro4j.studio.debug.ui.views.StructuredViewer.java

License:Apache License

/**
 * Build a label up for the element using the supplied label provider.
 * //www  . j a  v  a  2  s  . com
 * @param updateLabel
 *        The ViewerLabel to collect the result in
 * @param elementPath
 *        The path of the element being decorated.
 * @param labelProvider
 *        ILabelProvider the labelProvider for the receiver.
 */
void buildLabel(ViewerLabel updateLabel, TreePath elementPath, ITreePathLabelProvider labelProvider) {

    labelProvider.updateLabel(updateLabel, elementPath);

    colorAndFontCollector.setUsedDecorators();

    if (updateLabel.hasNewBackground()) {
        colorAndFontCollector.setBackground(updateLabel.getBackground());
    }

    if (updateLabel.hasNewForeground()) {
        colorAndFontCollector.setForeground(updateLabel.getForeground());
    }

    if (updateLabel.hasNewFont()) {
        colorAndFontCollector.setFont(updateLabel.getFont());
    }

}