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.walware.ecommons.ui.util.LayoutUtil.java

License:Open Source License

public static int hintWidth(final Combo combo, final java.util.List<Object> input,
        final ILabelProvider labelProvider) {
    combo.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT));
    final GC gc = new GC(combo);
    int widthHint = 0;
    for (final Object o : input) {
        final String s = labelProvider.getText(o);
        if (s != null) {
            widthHint = Math.max(widthHint, gc.stringExtent(s).x);
        }/*from www.  ja  v  a  2  s  .c o  m*/
    }
    gc.dispose();

    final Rectangle trim = combo.computeTrim(0, 0, widthHint, 0);
    if (trim.width > widthHint) {
        widthHint = trim.width;
    }

    return widthHint;
}

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

License:Open Source License

public static int hintWidth(final Table table, final int numChars) {
    return hintWidth(table, JFaceResources.DIALOG_FONT, false, numChars);
}

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

License:Open Source License

public static int hintColWidth(final Table table, final int numChars) {
    table.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT));
    final PixelConverter converter = new PixelConverter(table);
    final int width = converter.convertWidthInCharsToPixels(numChars);
    return width;
}

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

License:Open Source License

public static int hintHeight(final List control, final int rows) {
    control.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT));
    return control.getItemHeight() * rows;
}

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

License:Open Source License

public static int hintHeight(final Tree control, final int rows, final boolean withScrollbar) {
    control.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT));

    int height = control.getHeaderHeight();
    height += control.getItemHeight() * rows;

    if (!withScrollbar && Platform.getWS().equals(Platform.WS_WIN32)) {
        final ScrollBar hBar = control.getHorizontalBar();
        if (hBar != null) {
            height -= hBar.getSize().y;/*from ww  w .ja  v  a 2  s  . com*/
        }
    } else if (Platform.getWS().equals(Platform.WS_WIN32)) {
        height += control.getBorderWidth() * 2;
    }

    return height;
}

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

License:Open Source License

public static int hintHeight(final Table control, final int rows, final boolean withScrollbar) {
    control.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT));

    int height = control.getHeaderHeight();
    height += control.getItemHeight() * rows;

    if (!withScrollbar && Platform.getWS().equals(Platform.WS_WIN32)) {
        final ScrollBar hBar = control.getHorizontalBar();
        if (hBar != null) {
            height -= hBar.getSize().y;//from  w  w w.  j  av a 2s  .  com
        }
    } else if (Platform.getWS().equals(Platform.WS_WIN32)) {
        height += control.getBorderWidth() * 2;
    }

    return height;
}

From source file:de.walware.statet.r.internal.ui.datafilterview.ColumnLabelProvider.java

License:Open Source License

protected Font getInfoFont() {
    if (fInfoFont == null) {
        fInfoFont = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT);
    }
    return fInfoFont;
}

From source file:de.walware.statet.r.internal.ui.datafilterview.IntervalClient.java

License:Open Source License

@Override
protected void addWidgets() {
    fScaleControl = new WaScale(this, SWT.HORIZONTAL);
    fScaleControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1));

    fLowerBoundControl = new Text(this, SWT.BORDER);
    fLowerBoundControl.setLayoutData(//from w w w  .j a v  a 2s .  c  o  m
            LayoutUtil.hintWidth(new GridData(SWT.FILL, SWT.CENTER, true, false), fLowerBoundControl, 10));
    fLowerBoundControl.setToolTipText(Messages.Interval_LowerBound_tooltip);

    LayoutUtil.addGDDummy(this, true);

    fNAControl = new Button(this, SWT.CHECK);
    fNAControl.setText("NA"); //$NON-NLS-1$
    fNAControl.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT));
    fNAControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    LayoutUtil.addGDDummy(this, true);

    fUpperBoundControl = new Text(this, SWT.BORDER);
    fUpperBoundControl.setLayoutData(
            LayoutUtil.hintWidth(new GridData(SWT.FILL, SWT.CENTER, true, false), fLowerBoundControl, 10));
    fUpperBoundControl.setToolTipText(Messages.Interval_UpperBound_tooltip);
}

From source file:de.walware.statet.r.internal.ui.intable.PresentationConfig.java

License:Open Source License

public PresentationConfig(final Display display) {
    final FontRegistry jFaceFontRegistry = JFaceResources.getFontRegistry();
    final ColorRegistry jFaceColorRegistry = JFaceResources.getColorRegistry();

    fHeaderGridColor = display.getSystemColor(SWT.COLOR_DARK_GRAY);
    fHeaderBackgroundColor = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
    fHeaderForegroundColor = display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);

    fBodyGridColor = display.getSystemColor(SWT.COLOR_GRAY);
    fBodyBackgroundColor = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
    fBodyEvenRowBackgroundColor = fBodyBackgroundColor;
    fBodyOddRowBackgroundColor = new Color(display,
            ColorUtil.blend(display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW).getRGB(),
                    fBodyEvenRowBackgroundColor.getRGB(), 20));

    fBodyForegroundColor = display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);

    fHeaderSelectionBackgroundColor = new Color(display, ColorUtil.blend(
            display.getSystemColor(SWT.COLOR_LIST_SELECTION).getRGB(), fHeaderBackgroundColor.getRGB(), 25));
    fHeaderSelectionForegroundColor = fHeaderForegroundColor;

    fHeaderPlaceholderColor = new Color(display,
            ColorUtil.blend(fBodyGridColor.getRGB(), fHeaderBackgroundColor.getRGB(), 25));

    fHeaderFullSelectionBackgroundColor = new Color(display,
            ColorUtil.blend(display.getSystemColor(SWT.COLOR_LIST_SELECTION).getRGB(),
                    display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW).getRGB(), 25));
    fHeaderFullSelectionForegroundColor = display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);

    fBodySelectionBackgroundColor = display.getSystemColor(SWT.COLOR_LIST_SELECTION);
    fBodySelectionForegroundColor = display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);

    fBodyFreezeSeparatorColor = jFaceColorRegistry.get(JFacePreferences.DECORATIONS_COLOR);

    fHeaderLayerPainter = new GridLineCellLayerPainter(fHeaderGridColor);
    fHeaderLabelLayerPainter = new CornerGridLineCellLayerPainter(fHeaderGridColor);

    fBodyAnchorBorderStyle = new BorderStyle(2, fBodyForegroundColor, LineStyle.SOLID, -1);

    fBaseFont = jFaceFontRegistry.get(JFaceResources.DIALOG_FONT);
    fInfoFont = jFaceFontRegistry.getItalic(JFaceResources.DIALOG_FONT);

    {//from w w w . j av  a 2  s  . c  o  m
        final GC gc = new GC(display);
        gc.setFont(fBaseFont);
        final FontMetrics fontMetrics = gc.getFontMetrics();
        final int textHeight = fontMetrics.getHeight();
        final int charWidth = (gc.textExtent("1234567890.-120").x + 5) / 15;
        gc.dispose();
        final int textSpace = 3;

        fBaseSizeConfig = new LayoutSizeConfig(textSpace, textHeight, charWidth);
    }

    fBaseCellPainter = new LineBorderDecorator(new RTextPainter(fBaseSizeConfig.getDefaultSpace()));

    fHeaderCellPainter = new RTextPainter(fBaseSizeConfig.getDefaultSpace());
    fHeaderSortedCellPainter = new SortableHeaderTextPainter(
            new RTextPainter(fBaseSizeConfig.getDefaultSpace()), true, true);
    fHeaderCornerCellPainter = new DiagCellPainter(fHeaderGridColor);
}

From source file:de.walware.statet.r.internal.ui.rhelp.RHelpInfoHoverCreator.java

License:Open Source License

@Override
public Point computeSizeConstraints(final int widthInChars, final int heightInChars) {
    final int width = LayoutUtil.hintWidth(fTitleText, JFaceResources.DIALOG_FONT, widthInChars);
    final int lineHeight = fTitleText.getLineHeight();

    return new Point(width, lineHeight * heightInChars + LayoutUtil.defaultVSpacing());
}