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.birt.chart.ui.swt.wizard.TaskSelectType.java

License:Open Source License

private void createPreviewArea() {
    Composite cmpPreview = new Composite(foSashForm, SWT.NONE);
    cmpPreview.setLayout(new GridLayout());

    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;/*  w w w .  j  a v a2  s  . co m*/
    gridData.heightHint = 270;
    cmpPreview.setLayoutData(gridData);

    Label label = new Label(cmpPreview, SWT.NONE);
    {
        label.setText(Messages.getString("TaskSelectType.Label.Preview")); //$NON-NLS-1$
        label.setFont(JFaceResources.getBannerFont());
    }

    previewCanvas = new Canvas(cmpPreview, SWT.BORDER);
    previewCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));
    previewCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    previewPainter = createPreviewPainter();
}

From source file:org.eclipse.birt.core.ui.frameworks.taskwizard.TreeCompoundTask.java

License:Open Source License

/**
 * Creates the compound task's title area.
 * // w  ww .  ja  va2 s . c o m
 * @param parent
 *            the SWT parent for the title area composite.
 * @return the created title area composite.
 */
protected Composite createTitleArea(Composite parent) {
    Composite cmpTitle = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cmpTitle.setLayout(layout);

    GridData gridData = new GridData(GridData.FILL_BOTH);
    cmpTitle.setLayoutData(gridData);

    Label label = new Label(cmpTitle, SWT.NONE);
    {
        label.setFont(JFaceResources.getBannerFont());
        label.setText(getTitleAreaString());
    }

    if (needHistory) {
        ToolBar historyBar = new ToolBar(cmpTitle, SWT.HORIZONTAL | SWT.FLAT);
        {
            GridData gd = new GridData();
            gd.horizontalAlignment = SWT.END;
            historyBar.setLayoutData(gd);
            ToolBarManager historyManager = new ToolBarManager(historyBar);
            history.createHistoryControls(historyBar, historyManager);
            historyManager.update(false);
        }
    } else {
        new Label(cmpTitle, SWT.NONE);
    }
    return cmpTitle;
}

From source file:org.eclipse.birt.report.designer.data.ui.property.AbstractTitlePropertyDialog.java

License:Open Source License

private void createDialogTitleArea(Composite parent) {
    Composite contents = new Composite(parent, SWT.NONE);
    contents.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    FormLayout layout = new FormLayout();
    contents.setLayout(layout);//from   w  w w  . ja  v  a 2s.c  o m

    titleArea = new Composite(contents, SWT.NONE);
    initializeDialogUnits(titleArea);

    FormData titleAreaData = new FormData();
    titleAreaData.top = new FormAttachment(0, 0);
    titleAreaData.left = new FormAttachment(0, 0);
    titleAreaData.right = new FormAttachment(100, 0);
    titleArea.setLayoutData(titleAreaData);

    layout = new FormLayout();
    titleArea.setLayout(layout);

    // add a dispose listener
    titleArea.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            if (titleAreaColor != null) {
                titleAreaColor.dispose();
            }
        }
    });
    // Determine the background color of the title bar
    Display display = titleArea.getDisplay();
    Color background;
    Color foreground;
    if (titleAreaRGB != null) {
        titleAreaColor = new Color(display, titleAreaRGB);
        background = titleAreaColor;
        foreground = null;
    } else {
        background = JFaceColors.getBannerBackground(display);
        foreground = JFaceColors.getBannerForeground(display);
    }
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    titleArea.setBackground(background);
    // Dialog image @ right
    titleImageLabel = new Label(titleArea, SWT.CENTER);
    titleImageLabel.setBackground(background);
    if (titleImage == null || titleImage.isDisposed()) {
        titleImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER));
    } else {
        titleImageLabel.setImage(titleImage);
    }
    FormData imageData = new FormData();
    imageData.top = new FormAttachment(0, 0);
    // Note: do not use horizontalSpacing on the right as that would be a
    // regression from
    // the R2.x style where there was no margin on the right and images are
    // flush to the right
    // hand side. see reopened comments in 41172
    imageData.right = new FormAttachment(100, 0); // horizontalSpacing
    titleImageLabel.setLayoutData(imageData);
    // Title label @ top, left
    titleLabel = new Label(titleArea, SWT.LEFT);
    JFaceColors.setColors(titleLabel, foreground, background);
    titleLabel.setFont(JFaceResources.getBannerFont());
    titleLabel.setText(" ");//$NON-NLS-1$
    FormData titleData = new FormData();
    titleData.top = new FormAttachment(0, verticalSpacing);
    titleData.right = new FormAttachment(titleImageLabel);
    titleData.left = new FormAttachment(0, horizontalSpacing);
    titleLabel.setLayoutData(titleData);
    messageImageLabel = new Label(titleArea, SWT.CENTER);
    messageImageLabel.setBackground(background);
    messageLabel = new Text(titleArea, SWT.WRAP | SWT.READ_ONLY);
    JFaceColors.setColors(messageLabel, foreground, background);
    messageLabel.setText(" \n "); // two lines//$NON-NLS-1$
    messageLabel.setFont(JFaceResources.getDialogFont());
    messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    leftFillerLabel = new Label(titleArea, SWT.CENTER);
    leftFillerLabel.setBackground(background);
    setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    determineTitleImageLargest();

    Label titleBarSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}

From source file:org.eclipse.birt.report.designer.internal.ui.swt.custom.TabbedPropertyTitle.java

License:Open Source License

/**
 * Constructor for TabbedPropertyTitle./*from ww  w  .  ja  v  a2  s  .  co m*/
 * 
 * @param parent
 *            the parent composite.
 * @param factory
 *            the widget factory for the tabbed property sheet
 */
public TabbedPropertyTitle(Composite parent, FormWidgetFactory factory) {
    super(parent, SWT.NONE);
    this.factory = factory;

    bg = factory.getColors().getColor(FormColors.TB_BG);
    gbg = factory.getColors().getColor(FormColors.TB_GBG);
    border = factory.getColors().getColor(FormColors.TB_BORDER);

    this.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            if (image == null && (text == null || text.equals(BLANK))) {
                label.setVisible(false);
            } else {
                label.setVisible(true);
                drawTitleBackground(e);
            }
        }
    });

    this.addFocusListener(new FocusListener() {

        public void focusGained(FocusEvent e) {
            if (toolbar != null) {
                toolbar.setFocus();

            } else
                getParent().setFocus();
        }

        public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub

        }

    });

    factory.getColors().initializeSectionToolBarColors();
    setBackground(factory.getColors().getBackground());
    setForeground(factory.getColors().getForeground());

    FormLayout layout = new FormLayout();
    layout.marginWidth = ITabbedPropertyConstants.HSPACE + 6;
    layout.marginHeight = 5;
    setLayout(layout);

    label = new CLabel(this, SWT.NONE) {

        public Point computeSize(int wHint, int hHint, boolean changed) {
            Point p = super.computeSize(wHint, hHint, changed);
            p.y = p.y + 2;
            return p;
        }
    };
    label.setBackground(parent.getBackground());
    label.setText(BLANK);
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    label.setLayout(gl);

    // resetButton = new Button( label, SWT.FLAT );
    //      resetButton.setText( Messages.getString( "TabbedPropertyTitle.Button.Default.Text" ) ); //$NON-NLS-1$
    // GridData gd = new GridData( );
    // gd.grabExcessHorizontalSpace = true;
    // gd.horizontalAlignment = SWT.END;
    // gd.grabExcessVerticalSpace = true;
    // gd.verticalAlignment = SWT.CENTER;
    // resetButton.setLayoutData( gd );
    // resetButton.setVisible( false );
    // resetButton.addSelectionListener( new SelectionAdapter( ) {
    //
    // public void widgetSelected( SelectionEvent e )
    // {
    // Event event = new Event( );
    // event.widget = resetButton;
    // TabbedPropertyTitle.this.notifyListeners( SWT.SELECTED, event );
    // }
    //
    // } );
    //      resetButton.setToolTipText( Messages.getString( "TabbedPropertyTitle.Button.Default.TooltipText" ) ); //$NON-NLS-1$

    label.setBackground(new Color[] { factory.getColors().getColor(FormColors.TB_BG),
            factory.getColors().getColor(FormColors.TB_GBG) }, new int[] { 100 }, true);
    label.setFont(JFaceResources.getBannerFont());
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    label.setLayoutData(data);

    /*
     * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
     * ISharedImages.IMG_OBJ_ELEMENT));
     */

    new ToolBar(this, SWT.FLAT);
}

From source file:org.eclipse.birt.report.designer.ui.dialogs.StyleBuilder.java

License:Open Source License

private void createDialogTitleArea(Composite parent) {

    Composite contents = new Composite(parent, SWT.NONE);
    contents.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    FormLayout layout = new FormLayout();
    contents.setLayout(layout);/*from ww  w  .j a va  2  s.c  o m*/

    dialogTitleArea = new Composite(contents, SWT.NONE);
    initializeDialogUnits(dialogTitleArea);

    FormData titleAreaData = new FormData();
    titleAreaData.top = new FormAttachment(0, 0);
    titleAreaData.left = new FormAttachment(0, 0);
    titleAreaData.right = new FormAttachment(100, 0);
    dialogTitleArea.setLayoutData(titleAreaData);

    layout = new FormLayout();
    dialogTitleArea.setLayout(layout);

    // add a dispose listener
    dialogTitleArea.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            if (titleAreaColor != null) {
                titleAreaColor.dispose();
            }
        }
    });
    // Determine the background color of the title bar
    Display display = dialogTitleArea.getDisplay();
    Color background;
    Color foreground;
    if (titleAreaRGB != null) {
        titleAreaColor = new Color(display, titleAreaRGB);
        background = titleAreaColor;
        foreground = null;
    } else {
        background = JFaceColors.getBannerBackground(display);
        foreground = JFaceColors.getBannerForeground(display);
    }

    dialogTitleArea.setBackground(background);
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    // Dialog image @ right
    titleImageLabel = new Label(dialogTitleArea, SWT.CENTER);
    titleImageLabel.setBackground(background);
    if (titleAreaImage == null)
        titleImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER));
    else
        titleImageLabel.setImage(titleAreaImage);

    FormData imageData = new FormData();
    imageData.top = new FormAttachment(0, 0);
    // Note: do not use horizontalSpacing on the right as that would be a
    // regression from
    // the R2.x style where there was no margin on the right and images are
    // flush to the right
    // hand side. see reopened comments in 41172
    imageData.right = new FormAttachment(100, 0); // horizontalSpacing
    titleImageLabel.setLayoutData(imageData);
    // Title label @ top, left
    titleLabel = new Label(dialogTitleArea, SWT.LEFT);
    JFaceColors.setColors(titleLabel, foreground, background);
    titleLabel.setFont(JFaceResources.getBannerFont());
    titleLabel.setText(" ");//$NON-NLS-1$
    FormData titleData = new FormData();
    titleData.top = new FormAttachment(0, verticalSpacing);
    titleData.right = new FormAttachment(titleImageLabel);
    titleData.left = new FormAttachment(0, horizontalSpacing);
    titleLabel.setLayoutData(titleData);
    // Message image @ bottom, left
    messageImageLabel = new Label(dialogTitleArea, SWT.CENTER);
    messageImageLabel.setBackground(background);
    // Message label @ bottom, center
    messageLabel = new Text(dialogTitleArea, SWT.WRAP | SWT.READ_ONLY);
    JFaceColors.setColors(messageLabel, foreground, background);
    messageLabel.setText(" \n "); // two lines//$NON-NLS-1$
    messageLabel.setFont(JFaceResources.getDialogFont());
    messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    // Filler labels
    leftFillerLabel = new Label(dialogTitleArea, SWT.CENTER);
    leftFillerLabel.setBackground(background);
    bottomFillerLabel = new Label(dialogTitleArea, SWT.CENTER);
    bottomFillerLabel.setBackground(background);
    setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    determineTitleImageLargest();

    Label titleBarSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}

From source file:org.eclipse.birt.report.designer.ui.editors.ReportDocumentEditor.java

License:Open Source License

private Label createHeadingLabel(Composite parent, String text) {
    Label label = new Label(parent, SWT.NONE);
    if (text != null)
        label.setText(text);/*from ww  w . j a  v a  2 s.c  o  m*/
    label.setBackground(fBackgroundColor);
    label.setForeground(fForegroundColor);
    label.setFont(JFaceResources.getBannerFont());

    return label;
}

From source file:org.eclipse.cdt.make.ui.dialogs.SettingsBlock.java

License:Open Source License

protected Composite createNoteComposite(Font font, Composite composite, String title, String message) {
    Composite messageComposite = new Composite(composite, SWT.NONE);
    GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;//from  w ww  .  j  a  v a2s  . c o  m
    messageLayout.marginWidth = 0;
    messageLayout.marginHeight = 0;
    messageComposite.setLayout(messageLayout);
    messageComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    messageComposite.setFont(font);

    final Label noteLabel = new Label(messageComposite, SWT.BOLD);
    noteLabel.setText(title);
    noteLabel.setFont(JFaceResources.getBannerFont());
    noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

    final IPropertyChangeListener fontListener = new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (JFaceResources.BANNER_FONT.equals(event.getProperty())) {
                noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT));
            }
        }
    };
    JFaceResources.getFontRegistry().addListener(fontListener);
    noteLabel.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent event) {
            JFaceResources.getFontRegistry().removeListener(fontListener);
        }
    });

    Label messageLabel = new Label(messageComposite, SWT.WRAP);
    messageLabel.setText(message);
    messageLabel.setFont(font);
    return messageComposite;
}

From source file:org.eclipse.contribution.visualiser.internal.preference.VisualiserPreferencesDialog.java

License:Open Source License

/**
 * Creates the dialog's title area.// ww w  .  j  a  va 2 s.  c om
 *
 * @param parent the SWT parent for the title area composite
 * @return the created title area composite
 */
private Composite createTitleArea(Composite parent) {
    // Create the title area which will contain
    // a title, message, and image.
    titleArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 2;
    layout.marginWidth = 2;
    layout.verticalSpacing = 0;
    layout.horizontalSpacing = 0;
    layout.numColumns = 2;

    // Get the background color for the title area
    Display display = parent.getDisplay();
    Color background = JFaceColors.getBannerBackground(display);
    final Color foreground = JFaceColors.getBannerForeground(display);

    GridData layoutData = new GridData(GridData.FILL_BOTH);
    titleArea.setLayout(layout);
    titleArea.setLayoutData(layoutData);
    titleArea.setBackground(background);

    RGB rgb = new RGB(171, 168, 165);
    final Color borderColor = new Color(titleArea.getDisplay(), rgb);

    titleArea.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
            e.gc.setForeground(borderColor);
            Rectangle bounds = titleArea.getClientArea();
            bounds.height = bounds.height - 2;
            bounds.width = bounds.width - 1;
            e.gc.drawRectangle(bounds);
        }
    });

    // Add a dispose listener
    titleArea.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            if (titleAreaColor != null)
                titleAreaColor.dispose();
            if (errorMsgAreaBackground != null)
                errorMsgAreaBackground.dispose();
            borderColor.dispose();
        }
    });

    // Message label
    messageLabel = new CLabel(titleArea, SWT.LEFT);
    JFaceColors.setColors(messageLabel, foreground, background);
    messageLabel.setText(" "); //$NON-NLS-1$
    messageLabel.setFont(JFaceResources.getBannerFont());
    GridData gd = new GridData(GridData.FILL_BOTH);
    messageLabel.setLayoutData(gd);

    // Title image
    titleImage = new Label(titleArea, SWT.LEFT);
    titleImage.setBackground(background);
    titleImage.setImage(JFaceResources.getImage(PREF_DLG_TITLE_IMG));
    gd = new GridData();
    gd.horizontalAlignment = GridData.END;
    titleImage.setLayoutData(gd);

    return titleArea;
}

From source file:org.eclipse.contribution.visualiser.internal.preference.VisualiserPreferencesDialog.java

License:Open Source License

/**
 * Update the message/*from ww w. j  av  a2  s.  c  o m*/
 * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage()
 */
public void updateMessage() {
    String pageMessage = visPage.getMessage();
    int pageMessageType = IMessageProvider.NONE;
    if (pageMessage != null)
        pageMessageType = ((IMessageProvider) visPage).getMessageType();

    String pageErrorMessage = visPage.getErrorMessage();

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

    // Set the message and error message   
    if (pageMessage == null) {
        setMessage(visPage.getTitle());
    } else {
        setMessage(pageMessage, pageMessageType);
    }
    setErrorMessage(pageErrorMessage);
}

From source file:org.eclipse.e4.tools.ui.designer.dialogs.AbstractFindElementsDialog.java

License:Open Source License

protected Label createMessageArea(Composite composite) {
    Label msgLabel = super.createMessageArea(composite);
    msgLabel.setFont(JFaceResources.getBannerFont());
    return msgLabel;
}