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

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

Introduction

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

Prototype

String HEADER_FONT

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

Click Source Link

Document

The symbolic font name for the header font (value "org.eclipse.jface.headerfont").

Usage

From source file:com.bdaum.zoom.rcp.internal.ApplicationWorkbenchAdvisor.java

License:Open Source License

private static void createApplicationFonts() {
    FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    FontData fontData = fontRegistry.defaultFontDescriptor().getFontData()[0];
    fontRegistry.put(UiConstants.MESSAGEFONT,
            new FontData[] { new FontData(fontData.getName(), fontData.getHeight() + 4, fontData.getStyle()) });
    fontRegistry.put(UiConstants.SELECTIONFONT,
            new FontData[] { new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD) });
    fontRegistry.put(UiConstants.ITALICFONT,
            new FontData[] { new FontData(fontData.getName(), fontData.getHeight(), SWT.ITALIC) });
    fontRegistry.put(UiConstants.VIEWERFONT,
            new FontData[] { new FontData(fontData.getName(), 18, fontData.getStyle()) });
    fontRegistry.put(UiConstants.VIEWERTITLEFONT,
            new FontData[] { new FontData(fontData.getName(), 24, SWT.BOLD) });
    fontRegistry.put(UiConstants.VIEWERBANNERFONT,
            new FontData[] { new FontData(fontData.getName(), 36, SWT.BOLD) });
    fontData = fontRegistry.getDescriptor(JFaceResources.HEADER_FONT).getFontData()[0];
    fontRegistry.put(UiConstants.MESSAGETITLEFONT,
            new FontData[] { new FontData(fontData.getName(), fontData.getHeight() + 4, fontData.getStyle()) });
}

From source file:com.predic8.plugin.membrane.views.ProxyTableView.java

License:Apache License

private void createTitleLabel(Composite composite) {
    Label lb = new Label(composite, SWT.NONE);
    lb.setText("List of currently available Proxis");
    lb.setFont(JFaceResources.getFontRegistry().get(JFaceResources.HEADER_FONT));
}

From source file:com.predic8.plugin.membrane.views.RuleTableView.java

License:Apache License

private void createTitleLabel(Composite dummyComposite) {
    Label titleLabel = new Label(dummyComposite, SWT.NONE);
    titleLabel.setText("List of currently available Rules");
    titleLabel.setFont(JFaceResources.getFontRegistry().get(JFaceResources.HEADER_FONT));
}

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

License:Open Source License

protected FontData fontWithHeight(int height) {
    return new FontData(JFaceResources.HEADER_FONT, height, SWT.BOLD);
}

From source file:org.eclipse.mylyn.internal.commons.ui.screenshots.SelectToolAction.java

License:Open Source License

private void setToolAction(int tool) {
    if (tool == CAPTURE_DROP_DOWN_MENU) {
        selectedItemID = CAPTURE_DESKTOP;
        initMenu(tool, new ToolActionItem[] {
                new ToolActionItem(CAPTURE_DESKTOP, Messages.SelectToolAction_Desktop,
                        ScreenshotImages.MONITOR_OBJ), //
                new ToolActionItem(CAPTURE_DESKTOP_DELAYED, Messages.SelectToolAction_Desktop_Delayed,
                        ScreenshotImages.MONITOR__DELAY_OBJ), //
                new ToolActionItem(CAPTURE_CLIPBOARD, Messages.SelectToolAction_Clipboard,
                        ScreenshotImages.CLIPBOARD_OBJ), //
                new ToolActionItem(CAPTURE_FILE, Messages.SelectToolAction_File, ScreenshotImages.FILE_OBJ),
                new ToolActionItem(CAPTURE_RECTANGLE, Messages.SelectToolAction_Selected_Rectangle,
                        ScreenshotImages.SEL_RECT) });
        return;//  w w w  .  ja va  2 s .co m
    }

    if (tool == ZOOM_DROP_DOWN_MENU) {
        selectedItemID = ZOOM_FIT;
        initMenu(tool,
                new ToolActionItem[] { new ToolActionItem(ZOOM_FIT, Messages.SelectToolAction_Fit, null),
                        new ToolActionItem(50, Messages.SelectToolAction_ZoomHalf, null),
                        new ToolActionItem(100, Messages.SelectToolAction_Zoom1X, null),
                        new ToolActionItem(200, Messages.SelectToolAction_Zoom2X, null),
                        new ToolActionItem(400, Messages.SelectToolAction_Zoom4X, null),
                        new ToolActionItem(800, Messages.SelectToolAction_Zoom8X, null) });
        return;
    }

    if (tool == LINETYPE_TOOLBAR) {
        selectedItemID = SWT.LINE_SOLID;
        initBar(tool,
                new ToolActionItem[] {
                        new ToolActionItem(SWT.LINE_SOLID, Messages.SelectToolAction_Solid_Line,
                                ScreenshotImages.LINE_SOLD),
                        new ToolActionItem(SWT.LINE_DOT, Messages.SelectToolAction_Dotted_Line,
                                ScreenshotImages.LINE_DOT),
                        new ToolActionItem(SWT.LINE_DASH, Messages.SelectToolAction_Dashed_Line,
                                ScreenshotImages.LINE_DASH),
                        new ToolActionItem(SWT.LINE_DASHDOT, Messages.SelectToolAction_Dashed_Line_1_dot,
                                ScreenshotImages.LINE_DASH1D),
                        new ToolActionItem(SWT.LINE_DASHDOTDOT, Messages.SelectToolAction_Dashed_Line_2_dots,
                                ScreenshotImages.LINE_DASH2D) });
        return;
    }

    if (tool == DRAWLINE_TOOLBAR) {
        showSelection = true;
        selectedItemID = DRAW_FREE;
        initBar(tool, new ToolActionItem[] {
                new ToolActionItem(DRAW_FREE, Messages.SelectToolAction_Free, ScreenshotImages.EDIT_FREE),
                new ToolActionItem(DRAW_LINE, Messages.SelectToolAction_Line, ScreenshotImages.EDIT_LINE) });
        return;
    }
    if (tool == DRAWARROW_TOOLBAR) {
        showSelection = true;
        selectedItemID = DRAW_ARROW1;
        initBar(tool,
                new ToolActionItem[] {
                        new ToolActionItem(DRAW_ARROW1, Messages.SelectToolAction_Single_Side_Arrow,
                                ScreenshotImages.EDIT_ARROW1),
                        new ToolActionItem(DRAW_ARROW2, Messages.SelectToolAction_Both_Side_Arrow,
                                ScreenshotImages.EDIT_ARROW2) });
        selectedItemID = -1;
        return;
    }
    if (tool == DRAWBOX_TOOLBAR) {
        showSelection = true;
        selectedItemID = DRAW_RBOX;
        initBar(tool, new ToolActionItem[] {
                new ToolActionItem(DRAW_BOX, Messages.SelectToolAction_Rectangle, ScreenshotImages.EDIT_BOX),
                new ToolActionItem(DRAW_RBOX, Messages.SelectToolAction_Round_Rectangle,
                        ScreenshotImages.EDIT_RBOX),
                new ToolActionItem(DRAW_OVAL, Messages.SelectToolAction_Oval, ScreenshotImages.EDIT_OVAL),
                new ToolActionItem(DRAW_FILL_BOX, Messages.SelectToolAction_Fill_Rectangle,
                        ScreenshotImages.EDIT_FILL_BOX),
                new ToolActionItem(DRAW_FILL_RBOX, Messages.SelectToolAction_Fill_Round_Rectangle,
                        ScreenshotImages.EDIT_FILL_RBOX),
                new ToolActionItem(DRAW_FILL_OVAL, Messages.SelectToolAction_Fill_Oval,
                        ScreenshotImages.EDIT_FILL_OVAL) });
        selectedItemID = -1;
        return;
    }
    if (tool == DRAWTEXT_TOOLBAR) {
        showSelection = true;
        selectedItemID = DRAW_TEXT;
        // Bug:266123 Set initial font as HEADER_FONT
        FontData fontData = JFaceResources.getFont(JFaceResources.HEADER_FONT).getFontData()[0];
        stringCustom = fontData.toString();
        intgerCustom = rgb2int(255, 0, 0);
        selectedItemID = intgerCustom;
        initFont(tool);
        selectedItemID = -1;
        return;
    }

    if (tool == LINEBOLD_TOOLBAR) {
        selectedItemID = 4;
        initBar(tool,
                new ToolActionItem[] {
                        new ToolActionItem(1, Messages.SelectToolAction_1dot, ScreenshotImages.LINE_BOLD1),
                        new ToolActionItem(2, Messages.SelectToolAction_2dots, ScreenshotImages.LINE_BOLD2),
                        new ToolActionItem(4, Messages.SelectToolAction_4dots, ScreenshotImages.LINE_BOLD4),
                        new ToolActionItem(8, Messages.SelectToolAction_8dots, ScreenshotImages.LINE_BOLD8) });
        return;
    }

    if (tool == COLOR_TOOLBAR) {
        intgerCustom = rgb2int(255, 85, 85);
        selectedItemID = intgerCustom;
        initColor(tool);
        return;
    }
}

From source file:org.eclipse.ui.internal.ide.dialogs.WelcomeEditor.java

License:Open Source License

/**
 * Creates the wizard's title area./* ww  w  . j  av  a 2s  . c  o  m*/
 *
 * @param parent the SWT parent for the title area composite
 * @return the created title area composite
 */
private Composite createTitleArea(Composite parent) {
    // Get the background color for the title area
    Display display = parent.getDisplay();
    Color background = JFaceColors.getBannerBackground(display);
    Color foreground = JFaceColors.getBannerForeground(display);

    // Create the title area which will contain
    // a title, message, and image.
    Composite titleArea = new Composite(parent, SWT.NONE | SWT.NO_FOCUS);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    layout.horizontalSpacing = 0;
    layout.numColumns = 2;
    titleArea.setLayout(layout);
    titleArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    titleArea.setBackground(background);

    // Message label
    final CLabel messageLabel = new CLabel(titleArea, SWT.LEFT) {
        protected String shortenText(GC gc, String text, int width) {
            if (gc.textExtent(text, SWT.DRAW_MNEMONIC).x <= width) {
                return text;
            }
            final String ellipsis = "..."; //$NON-NLS-1$
            int ellipseWidth = gc.textExtent(ellipsis, SWT.DRAW_MNEMONIC).x;
            int length = text.length();
            int end = length - 1;
            while (end > 0) {
                text = text.substring(0, end);
                int l1 = gc.textExtent(text, SWT.DRAW_MNEMONIC).x;
                if (l1 + ellipseWidth <= width) {
                    return text + ellipsis;
                }
                end--;
            }
            return text + ellipsis;
        }
    };
    JFaceColors.setColors(messageLabel, foreground, background);
    messageLabel.setText(getBannerTitle());
    messageLabel.setFont(JFaceResources.getHeaderFont());

    final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (JFaceResources.HEADER_FONT.equals(event.getProperty())) {
                messageLabel.setFont(JFaceResources.getHeaderFont());
            }
        }
    };

    messageLabel.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            JFaceResources.getFontRegistry().removeListener(fontListener);
        }
    });

    JFaceResources.getFontRegistry().addListener(fontListener);

    GridData gd = new GridData(GridData.FILL_BOTH);
    messageLabel.setLayoutData(gd);

    // Title image
    Label titleImage = new Label(titleArea, SWT.LEFT);
    titleImage.setBackground(background);
    titleImage.setImage(PlatformUI.getWorkbench().getSharedImages()
            .getImage(IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_BANNER));
    gd = new GridData();
    gd.horizontalAlignment = GridData.END;
    titleImage.setLayoutData(gd);

    return titleArea;
}

From source file:org.eclipse.ui.tests.decorators.FontDecorator.java

License:Open Source License

/**
 * Setup the font used by this decorator.
 */
public static void setUpFont() {
    font = JFaceResources.getFont(JFaceResources.HEADER_FONT);
}

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

License:Open Source License

private static boolean isDefaultKey(String key) {
    return JFaceResources.DEFAULT_FONT.equals(key) || JFaceResources.DIALOG_FONT.equals(key)
            || JFaceResources.HEADER_FONT.equals(key) || JFaceResources.TEXT_FONT.equals(key)
            || JFaceResources.BANNER_FONT.equals(key);
}