Example usage for org.eclipse.jface.resource JFaceResources VIEWER_FONT

List of usage examples for org.eclipse.jface.resource JFaceResources VIEWER_FONT

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources VIEWER_FONT.

Prototype

String VIEWER_FONT

To view the source code for org.eclipse.jface.resource JFaceResources VIEWER_FONT.

Click Source Link

Document

The symbolic font name for the viewer font (value "org.eclipse.jface.viewerfont").

Usage

From source file:com.github.sdbg.debug.ui.internal.util.SWTUtil.java

License:Open Source License

/**
 * Sets size of the font in the given {@link Control} to the size specified in
 * {@link JFaceResources}.//from  w w w  .  j  a  v  a  2s.c o  m
 */
private static void updateFontSizeFromJFaceResources(Control control) {
    Font newFont = JFaceResources
            .getFont(JFaceResources.VIEWER_FONT/* &&&FontPreferencePage.VIEW_BASE_FONT_KEY*/);
    Font oldFont = control.getFont();
    Font font = SWTUtil.changeFontSize(oldFont, newFont);
    control.setFont(font);
    // set Table/Tree item height
    if (control instanceof Table || control instanceof Tree) {
        setItemHeightForFont(control);
    }
    // process Composite children
    if (control instanceof Composite) {
        Composite composite = (Composite) control;
        Control[] children = composite.getChildren();
        if (children != null) {
            for (Control child : children) {
                updateFontSizeFromJFaceResources(child);
            }
        }
        composite.layout();
    }
}