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

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

Introduction

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

Prototype

public static Font getBannerFont() 

Source Link

Document

Returns the JFace's banner font.

Usage

From source file:org.eclipse.osee.framework.ui.skynet.widgets.XStackedWidget.java

License:Open Source License

private void createToolBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = 0;//from ww  w .  jav a2  s .  co  m
    layout.marginLeft = 5;
    layout.marginWidth = 2;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    composite.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));

    currentPageLabel = new StyledText(composite, SWT.READ_ONLY | SWT.SINGLE | SWT.WRAP);
    currentPageLabel.setAlignment(SWT.RIGHT);
    currentPageLabel.setFont(JFaceResources.getBannerFont());
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.minimumWidth = 10;
    currentPageLabel.setLayoutData(gd);
    currentPageLabel.setText("0 of 0");

    Composite filler = new Composite(composite, SWT.NONE);
    GridLayout layout1 = new GridLayout(1, false);
    filler.setLayout(layout1);
    filler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    ToolBar toolbar = new ToolBar(composite, SWT.FLAT | SWT.HORIZONTAL);
    toolbar.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
    ToolBarManager manager = new ToolBarManager(toolbar);
    manager.add(new Separator());
    manager.add(new Back());
    manager.add(new Forward());
    manager.add(new Separator());
    manager.add(new AddPage());
    manager.add(new RemovePage());
    manager.update(true);
}

From source file:org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog.java

License:Open Source License

/**
* Creates the dialog's title area./*from   w  w w.j a  va 2s  .c o m*/
*
* @param parent the SWT parent for the title area composite
* @return the created title area composite
*/
private Composite createMessageArea(Composite parent) {

    // Create the title area which will contain
    // a title, message, and image.
    fTitleArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    layout.horizontalSpacing = 0;
    layout.numColumns = 2;

    // Get the colors for the title area
    Display display = parent.getDisplay();
    Color bg = JFaceColors.getBannerBackground(display);
    Color fg = JFaceColors.getBannerForeground(display);

    GridData layoutData = new GridData(GridData.FILL_BOTH);
    fTitleArea.setLayout(layout);
    fTitleArea.setLayoutData(layoutData);
    fTitleArea.setBackground(bg);

    // Message label
    fMessageLabel = new CLabel(fTitleArea, SWT.LEFT);
    fMessageLabel.setBackground(bg);
    fMessageLabel.setForeground(fg);
    fMessageLabel.setText(" ");//$NON-NLS-1$
    fMessageLabel.setFont(JFaceResources.getBannerFont());

    final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (JFaceResources.BANNER_FONT.equals(event.getProperty())
                    || JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
                updateMessage();
            }
        }
    };

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

    JFaceResources.getFontRegistry().addListener(fontListener);

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

    // Title image
    fTitleImage = new Label(fTitleArea, SWT.LEFT);
    fTitleImage.setBackground(bg);
    fTitleImage.setImage(TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_TITLE_IMG));
    gd = new GridData();
    gd.horizontalAlignment = GridData.END;
    fTitleImage.setLayoutData(gd);
    updateMessage();
    return fTitleArea;
}

From source file:org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog.java

License:Open Source License

/**
 * @see IPreferencePageContainer#updateMessage()
 *//* w ww .  jav a  2s  . com*/
public void updateMessage() {
    if (currentPage != null) {
        String pageMessage = currentPage.getMessage();
        String pageErrorMessage = currentPage.getErrorMessage();

        // Adjust the font
        if (pageMessage == null && pageErrorMessage == null)
            fMessageLabel.setFont(JFaceResources.getBannerFont());
        else
            fMessageLabel.setFont(JFaceResources.getDialogFont());

        // Set the message and error message   
        if (pageMessage == null) {
            if (isSinglePage()) {
                setMessage(TeamUIMessages.PreferencePageContainerDialog_6);
            } else {
                //remove mnemonic see bug 75886
                String title = currentPage.getTitle();
                title = title.replaceAll("&", "");//$NON-NLS-1$ //$NON-NLS-2$
                setMessage(title);
            }
        } else {
            setMessage(pageMessage);
        }
        setErrorMessage(pageErrorMessage);
    }
}

From source file:org.eclipse.team.svn.ui.dialog.DefaultDialog.java

License:Open Source License

protected Control createInfoPanel(Composite parent) {
    Color bgColor = new Color(null, 255, 255, 255);

    GridLayout layout = null;/* w  ww  .  jav  a  2  s. c o m*/
    GridData data = null;

    Composite infoPanel = new Composite(parent, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 1;
    layout.marginWidth = 1;
    layout.numColumns = 2;
    infoPanel.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    Point pt = this.panel.getPrefferedSize();
    data.widthHint = pt.x;
    infoPanel.setLayoutData(data);
    infoPanel.setBackground(bgColor);

    Composite leftSide = new Composite(infoPanel, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 1;
    leftSide.setLayout(layout);
    data = new GridData(GridData.FILL_BOTH);
    leftSide.setLayoutData(data);
    leftSide.setBackground(bgColor);

    Label iconLabel = new Label(infoPanel, SWT.NONE);
    this.infoImage = this.findImage(this.panel.getImagePath());
    iconLabel.setImage(this.infoImage);

    Font defaultFont = JFaceResources.getBannerFont();
    FontData[] fData = defaultFont.getFontData();
    this.mainLabelFont = new Font(UIMonitorUtility.getDisplay(), fData);

    Label description = new Label(leftSide, SWT.WRAP);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    description.setLayoutData(data);
    String text = this.panel.getDialogDescription();
    description.setText(text != null ? text : ""); //$NON-NLS-1$
    description.setFont(this.mainLabelFont);
    description.setBackground(bgColor);

    this.icon = new Label(leftSide, SWT.NONE);
    data = new GridData();
    data.verticalAlignment = SWT.BEGINNING;
    this.icon.setLayoutData(data);
    this.icon.setBackground(bgColor);

    this.message = new Label(leftSide, SWT.WRAP);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalIndent = 3;
    this.message.setLayoutData(data);
    this.message.setBackground(bgColor);

    this.setMessage(IDialogManager.LEVEL_OK, null);

    return infoPanel;
}

From source file:org.eclipse.ui.examples.presentation.baretittle.BareTitleStackPresentation.java

License:Open Source License

public BareTitleStackPresentation(Composite parent, IStackPresentationSite stackSite) {
    super(stackSite);

    // Create a top-level control for the presentation.
    presentationControl = new Composite(parent, SWT.NONE);
    titleArea = new Composite(presentationControl, SWT.NONE);
    contentArea = new Composite(presentationControl, SWT.NONE);
    titleArea.addMouseListener(mouseListener);
    PresentationUtil.addDragListener(titleArea, dragListener);

    // Add a dispose listener. This will call the presentationDisposed()
    // method when the widget is destroyed.
    presentationControl.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            presentationDisposed();/*from   ww w  .ja  v a 2  s  .c  o m*/
        }
    });

    presentationControl.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
            Rectangle clientArea = presentationControl.getClientArea();
            e.gc.setLineWidth(1);
            e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_DARK_GRAY));
            e.gc.drawRectangle(clientArea.x, clientArea.y, clientArea.width - 1, clientArea.height - 1);
            Rectangle contentAreaBounds = contentArea.getBounds();
            int ypos = contentAreaBounds.y - 1;
            e.gc.drawLine(clientArea.x, ypos, clientArea.x + clientArea.width - 1, ypos);
        }
    });

    titleArea.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
            Rectangle titleRect = titleArea.getClientArea();
            GC gc = e.gc;
            e.gc.setBackground(e.display.getSystemColor(SWT.COLOR_GRAY));
            if (activeFocus)
                e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_BLUE));
            else
                e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_WHITE));
            e.gc.fillGradientRectangle(titleRect.x, titleRect.y, titleRect.x + titleRect.width,
                    titleRect.y + titleRect.height, true);

            if (current != null) {
                int textWidth = titleRect.width - 1;
                if (textWidth > 0) {
                    Font gcFont = gc.getFont();
                    gc.setFont(presentationControl.getFont());
                    String text = current.getTitle();

                    Point extent = gc.textExtent(text, SWT.DRAW_TRANSPARENT | SWT.DRAW_MNEMONIC);
                    int textY = titleRect.y + (titleRect.height - extent.y) / 2;

                    if (activeFocus)
                        gc.setForeground(e.display.getSystemColor(SWT.COLOR_WHITE));
                    else
                        gc.setForeground(e.display.getSystemColor(SWT.COLOR_BLACK));
                    gc.setFont(JFaceResources.getBannerFont());
                    gc.drawText(text, titleRect.x + 3, textY, SWT.DRAW_TRANSPARENT | SWT.DRAW_MNEMONIC);
                }
            }
        }
    });
    layout();
}

From source file:org.eclipse.ui.internal.intro.impl.swt.PageStyleManager.java

License:Open Source License

public static Font getBannerFont() {
    return JFaceResources.getBannerFont();
}

From source file:org.eclipse.ui.texteditor.InfoForm.java

License:Open Source License

/**
* Handles the property change.//from   ww  w .  ja  va 2  s. c om
*
* @param event the property change event object describing which property changed and how
*/
protected void handlePropertyChange(PropertyChangeEvent event) {

    if (fHeader != null)
        fHeader.setFont(JFaceResources.getHeaderFont());

    if (fBanner != null)
        fBanner.setFont(JFaceResources.getBannerFont());

    Control control = fScrolledComposite.getContent();
    fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    fScrolledComposite.setContent(control);

    fScrolledComposite.layout(true);
    fScrolledComposite.redraw();
}

From source file:org.eclipse.ui.texteditor.InfoForm.java

License:Open Source License

private Label createBanner(Composite parent, String text) {
    Label label = new Label(parent, SWT.NONE);
    if (text != null)
        label.setText(text);/*from  w w w  .ja  v  a  2 s .c om*/
    label.setBackground(fBackgroundColor);
    label.setForeground(fForegroundColor);
    label.setFont(JFaceResources.getBannerFont());
    return label;
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewDetectServerComposite.java

License:Open Source License

protected Label createHeadingLabel(Composite parent, String text, int span) {
    Label label = createLabel(parent, text, span, true, false);
    label.setFont(JFaceResources.getBannerFont());
    return label;
}

From source file:org.elbe.relations.internal.forms.AbstractEditForm.java

License:Open Source License

protected Font createBoldFont() {
    final FontData[] lBoldData = JFaceResources.getBannerFont().getFontData();
    for (int i = 0; i < lBoldData.length; i++) {
        lBoldData[i].setHeight(lBoldData[i].getHeight() - 2);
    }/*from   ww  w.jav a 2 s .c om*/
    return new Font(Display.getCurrent(), lBoldData);
}