Example usage for org.eclipse.jface.resource FontRegistry getItalic

List of usage examples for org.eclipse.jface.resource FontRegistry getItalic

Introduction

In this page you can find the example usage for org.eclipse.jface.resource FontRegistry getItalic.

Prototype

public Font getItalic(String symbolicName) 

Source Link

Document

Returns the italic font associated with the given symbolic font name.

Usage

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 . ja  v  a2  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:org.eclipse.koneki.ldt.debug.ui.internal.interpreters.AddLuaInterpreterDialog.java

License:Open Source License

private <T extends Control> T toItalic(final T control) {
    final FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    for (final FontData fontData : control.getFont().getFontData()) {
        final Font font = fontRegistry.getItalic(fontData.getName());
        control.setFont(font);/*from  ww w .j av a 2 s .c om*/
    }
    return control;
}

From source file:org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabItem.java

License:Open Source License

private void updateFont() {
    CTabItem tabItem = getItem();//from   www .  j a va2s.c  o  m

    // Set the font if necessary
    FontRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();

    // Determine the parent font. We will set the tab's font
    Font targetFont = null;

    if (busy) {
        targetFont = registry.getItalic(IWorkbenchThemeConstants.TAB_TEXT_FONT);
    } else {

        if (bold) {
            targetFont = registry.getBold(IWorkbenchThemeConstants.TAB_TEXT_FONT);
        }
    }

    if (lastFont != targetFont) {
        tabItem.setFont(targetFont);
        lastFont = targetFont;
    }
}

From source file:org.kalypso.ogc.gml.outline.nodes.KalypsoThemeNode.java

License:Open Source License

@Override
public Font getFont(final Object element) {
    final IKalypsoTheme theme = getElement();

    final FontRegistry fontRegistry = JFaceResources.getFontRegistry();

    if (!theme.isLoaded())
        return fontRegistry.getItalic(JFaceResources.DIALOG_FONT);

    // falls aktiviert
    final IMapModell mapModell = theme.getMapModell();
    if (mapModell != null && mapModell.getActiveTheme() == theme)
        return fontRegistry.getBold(JFaceResources.DIALOG_FONT);

    return fontRegistry.get(JFaceResources.DIALOG_FONT);
}

From source file:org.rssowl.ui.internal.OwlUI.java

License:Open Source License

/**
 * @param key/* ww w. j  a  v  a  2s .c o m*/
 * @param style
 * @return Font
 */
public static Font getThemeFont(String key, int style) {
    FontRegistry fontRegistry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
    if (fontRegistry != null) {
        if (style == SWT.NORMAL)
            return fontRegistry.get(key);
        else if ((style & SWT.BOLD) != 0)
            return fontRegistry.getBold(key);
        else if ((style & SWT.ITALIC) != 0)
            return fontRegistry.getItalic(key);
    }

    return getFont(key);
}

From source file:org.xmind.ui.resources.FontUtils.java

License:Open Source License

/**
 * @deprecated Use {@link LocalResourceManager}
 *///  ww w . j  a  v a 2  s . c  o  m
public static Font getItalic(String key, FontData[] fontData) {
    if (key == null) {
        key = toString(fontData);
        if (key == null)
            return null;
    }

    FontRegistry reg = JFaceResources.getFontRegistry();
    if (!reg.hasValueFor(key) && !isDefaultKey(key)) {
        if (fontData == null) {
            fontData = toFontData(key);
            if (fontData == null)
                return null;
        }
        reg.put(key, fontData);
    }
    return reg.getItalic(key);
}