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

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

Introduction

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

Prototype

String DIALOG_FONT

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

Click Source Link

Document

The symbolic font name for the dialog font (value "org.eclipse.jface.dialogfont").

Usage

From source file:de.sebastianbenz.xgherkin.ui.highlighting.HighlightingConfiguration.java

License:Open Source License

protected FontData fontWithHeight(int height, int style) {
    return new FontData(JFaceResources.DIALOG_FONT, height, style);
}

From source file:de.walware.ecommons.ui.components.WidgetToolsButton.java

License:Open Source License

static Font getToolButtonFont() {
    final FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    if (!fontRegistry.hasValueFor(FONT_SYMBOLIC_NAME)) {
        fontRegistry.addListener(new IPropertyChangeListener() {
            @Override//from   w  ww  . j a va  2s .  c  o m
            public void propertyChange(final PropertyChangeEvent event) {
                if (event.getProperty().equals(JFaceResources.DIALOG_FONT)) {
                    updateFont();
                }
            }
        });
        updateFont();
    }
    return fontRegistry.get(FONT_SYMBOLIC_NAME);
}

From source file:de.walware.ecommons.ui.components.WidgetToolsButton.java

License:Open Source License

private static void updateFont() {
    final FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    final Font dialogFont = fontRegistry.get(JFaceResources.DIALOG_FONT);
    final int size = 1 + Math.max(dialogFont.getFontData()[0].getHeight() * 3 / 5, 6);
    final FontDescriptor descriptor = fontRegistry.getDescriptor(JFaceResources.TEXT_FONT).setHeight(size);
    final Font toolFont = descriptor.createFont(Display.getCurrent());
    fontRegistry.put(FONT_SYMBOLIC_NAME, toolFont.getFontData());
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

private static DialogValues getDialogValues() {
    if (gDialogValues == null) {
        JFaceResources.getFontRegistry().addListener(new IPropertyChangeListener() {
            @Override/*from   w  w w.j ava  2s .  c o m*/
            public void propertyChange(final PropertyChangeEvent event) {
                if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
                    UIAccess.getDisplay().asyncExec(new Runnable() {
                        @Override
                        public void run() {
                            gDialogValues = new DialogValues();
                        }
                    });
                }
            }
        });
        gDialogValues = new DialogValues();
    }
    return gDialogValues;
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static int hintWidth(final Button button) {
    button.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT));
    final PixelConverter converter = new PixelConverter(button);
    final int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static int hintWidth(final Text text, final int numChars) {
    return hintWidth(text, JFaceResources.DIALOG_FONT, numChars);
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static GridData hintWidth(final GridData gd, final Text text, final int numChars) {
    gd.widthHint = hintWidth(text, JFaceResources.DIALOG_FONT, numChars);
    return gd;// ww w .  j  a  v a 2  s  .c om
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static int hintWidth(final Combo combo, final int numChars) {
    return hintWidth(combo, JFaceResources.DIALOG_FONT, numChars);
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static GridData hintWidth(final GridData gd, final Combo combo, final int numChars) {
    return hintWidth(gd, combo, JFaceResources.DIALOG_FONT, numChars);
}

From source file:de.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static int hintWidth(final Combo combo, final Collection<String> items) {
    int max = 0;/* www.  jav a2s. co  m*/
    for (final String s : items) {
        max = Math.max(max, s.length());
    }
    return hintWidth(combo, JFaceResources.DIALOG_FONT, max);
}