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

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

Introduction

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

Prototype

String BANNER_FONT

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

Click Source Link

Document

The symbolic font name for the banner font (value "org.eclipse.jface.bannerfont").

Usage

From source file:com.android.ide.eclipse.adt.internal.wizards.templates.ActivityPage.java

License:Open Source License

@SuppressWarnings("unused") // SWT constructors have side effects and aren't unused
private void onEnter() {
    Composite container = (Composite) getControl();
    container.setLayout(new GridLayout(3, false));

    if (mAskCreate) {
        mCreateToggle = new Button(container, SWT.CHECK);
        mCreateToggle.setSelection(true);
        mCreateToggle.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
        mCreateToggle.setText("Create Activity");
        mCreateToggle.addSelectionListener(this);
    }/*  w  w  w.j a va  2 s  .  co m*/

    mList = new List(container, SWT.BORDER | SWT.V_SCROLL);
    mList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

    TemplateManager manager = mValues.template.getManager();
    java.util.List<File> templates = manager.getTemplates(CATEGORY_ACTIVITIES);

    if (!mOnlyActivities) {
        templates.addAll(manager.getTemplates(CATEGORY_OTHER));
    }
    java.util.List<String> names = new ArrayList<String>(templates.size());
    File current = mValues.activityValues.getTemplateLocation();
    mTemplates = Lists.newArrayListWithExpectedSize(templates.size());
    int index = -1;
    for (int i = 0, n = templates.size(); i < n; i++) {
        File template = templates.get(i);
        TemplateMetadata metadata = manager.getTemplate(template);
        if (metadata == null) {
            continue;
        }
        if (mLauncherActivitiesOnly) {
            Parameter parameter = metadata.getParameter(IS_LAUNCHER);
            if (parameter == null) {
                continue;
            }
        }
        mTemplates.add(template);
        names.add(metadata.getTitle());
        if (template.equals(current)) {
            index = names.size();
        }
    }
    String[] items = names.toArray(new String[names.size()]);
    mList.setItems(items);
    if (index == -1 && !mTemplates.isEmpty()) {
        mValues.activityValues.setTemplateLocation(mTemplates.get(0));
        index = 0;
    }
    if (index >= 0) {
        mList.setSelection(index);
        mList.addSelectionListener(this);
    }

    // Preview
    mPreview = new ImageControl(container, SWT.NONE, null);
    mPreview.setDisposeImage(false); // Handled manually in this class
    GridData gd_mImage = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
    gd_mImage.widthHint = PREVIEW_WIDTH + 2 * PREVIEW_PADDING;
    mPreview.setLayoutData(gd_mImage);
    new Label(container, SWT.NONE);

    mHeading = new Label(container, SWT.NONE);
    mHeading.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    new Label(container, SWT.NONE);

    mDescription = new Label(container, SWT.WRAP);
    mDescription.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));

    Font font = JFaceResources.getFontRegistry().getBold(JFaceResources.BANNER_FONT);
    if (font != null) {
        mHeading.setFont(font);
    }

    updatePreview();
}

From source file:com.android.ide.eclipse.auidt.internal.wizards.templates.ActivityPage.java

License:Open Source License

@SuppressWarnings("unused") // SWT constructors have side effects and aren't unused
private void onEnter() {
    Composite container = (Composite) getControl();
    container.setLayout(new GridLayout(3, false));

    if (mAskCreate) {
        mCreateToggle = new Button(container, SWT.CHECK);
        mCreateToggle.setSelection(true);
        mCreateToggle.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
        mCreateToggle.setText("Create Activity");
        mCreateToggle.addSelectionListener(this);
    }/*  w w w .  j  a  v a 2 s.co m*/

    mList = new List(container, SWT.BORDER | SWT.V_SCROLL);
    mList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

    TemplateManager manager = mValues.template.getManager();
    mTemplates = manager.getTemplates(CATEGORY_ACTIVITIES);
    if (!mOnlyActivities) {
        mTemplates.addAll(manager.getTemplates(CATEGORY_OTHER));
    }
    java.util.List<String> names = new ArrayList<String>(mTemplates.size());
    File current = mValues.activityValues.getTemplateLocation();
    int index = -1;
    for (int i = 0, n = mTemplates.size(); i < n; i++) {
        File template = mTemplates.get(i);
        names.add(template.getName());
        if (template.equals(current)) {
            index = i;
        }
    }
    String[] items = names.toArray(new String[names.size()]);
    mList.setItems(items);
    if (index == -1 && !mTemplates.isEmpty()) {
        mValues.activityValues.setTemplateLocation(mTemplates.get(0));
        index = 0;
    }
    if (index >= 0) {
        mList.setSelection(index);
        mList.addSelectionListener(this);
    }

    // Preview
    mPreview = new ImageControl(container, SWT.NONE, null);
    GridData gd_mImage = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
    gd_mImage.widthHint = PREVIEW_WIDTH + 2 * PREVIEW_PADDING;
    mPreview.setLayoutData(gd_mImage);
    new Label(container, SWT.NONE);

    mHeading = new Label(container, SWT.NONE);
    mHeading.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    new Label(container, SWT.NONE);

    mDescription = new Label(container, SWT.WRAP);
    mDescription.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));

    Font font = JFaceResources.getFontRegistry().getBold(JFaceResources.BANNER_FONT);
    if (font != null) {
        mHeading.setFont(font);
    }

    updatePreview();
}

From source file:com.iw.plugins.spindle.ui.SectionWidget.java

License:Mozilla Public License

public final Control createControl(Composite parent) {

    Composite section = new Composite(parent, SWT.NULL);
    SectionLayout slayout = new SectionLayout();
    section.setLayout(slayout);/*from   www.  j a va 2s . c  om*/
    section.setData(this);

    if (headerPainted) {

        header = new Label(section, SWT.WRAP);
        header.setText(getHeaderText());
        header.setFont(JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT));

    }

    if (addSeparator) {

        separator = new Composite(section, SWT.NONE);
        separator.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));

    }

    if (descriptionPainted && description != null) {

        descriptionLabel = new Label(section, SWT.WRAP);
        descriptionLabel.setText(description);

    }
    client = createClient(section);
    section.setData(this);
    control = section;
    return section;
}

From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java

License:Open Source License

/**
 * Creates the wizard's title area./*  ww  w  .java 2s  .  c o  m*/
 * 
 * @param parent the SWT parent for the title area composite.
 * @return the created title area composite.
 */
protected Composite createTitleArea(Composite parent) {
    // Create the title area which will contain
    // a title, message, and image.
    int margins = 2;
    titleArea = new Composite(parent, SWT.NONE);
    FormLayout layout = new FormLayout();
    layout.marginHeight = 0;
    layout.marginWidth = margins;
    titleArea.setLayout(layout);

    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.verticalAlignment = SWT.TOP;
    titleArea.setLayoutData(layoutData);

    // Message label
    messageArea = new DialogMessageArea();
    messageArea.createContents(titleArea);

    titleArea.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            updateMessage();
        }
    });

    final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (JFaceResources.BANNER_FONT.equals(event.getProperty())) {
                updateMessage();
            }
            if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
                updateMessage();
                Font dialogFont = JFaceResources.getDialogFont();
                updateTreeFont(dialogFont);
                Control[] children = ((Composite) buttonBar).getChildren();
                for (int i = 0; i < children.length; i++) {
                    children[i].setFont(dialogFont);
                }
            }
        }
    };

    titleArea.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            JFaceResources.getFontRegistry().removeListener(fontListener);
        }
    });
    JFaceResources.getFontRegistry().addListener(fontListener);
    messageArea.setTitleLayoutData(createMessageAreaData());
    messageArea.setMessageLayoutData(createMessageAreaData());
    return titleArea;
}

From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.java

License:Open Source License

/**
 * Creates the wizard's title area./*www.  j  a  v  a2  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) {
    // Create the title area which will contain
    // a title, message, and image.
    int margins = 2;
    titleArea = new Composite(parent, SWT.NONE);
    FormLayout layout = new FormLayout();
    layout.marginHeight = 0;
    layout.marginWidth = margins;
    titleArea.setLayout(layout);

    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.verticalAlignment = SWT.TOP;
    titleArea.setLayoutData(layoutData);

    // Message label
    messageArea = new DialogMessageArea();
    messageArea.createContents(titleArea);

    titleArea.addControlListener(new ControlAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
         */
        @Override
        public void controlResized(ControlEvent e) {
            updateMessage();
        }
    });

    final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (JFaceResources.BANNER_FONT.equals(event.getProperty()))
                updateMessage();
            if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
                updateMessage();
                Font dialogFont = JFaceResources.getDialogFont();
                updateTreeFont(dialogFont);
                Control[] children = ((Composite) buttonBar).getChildren();
                for (int i = 0; i < children.length; i++)
                    children[i].setFont(dialogFont);
            }
        }
    };

    titleArea.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            JFaceResources.getFontRegistry().removeListener(fontListener);
        }
    });
    JFaceResources.getFontRegistry().addListener(fontListener);
    messageArea.setTitleLayoutData(createMessageAreaData());
    messageArea.setMessageLayoutData(createMessageAreaData());
    return titleArea;
}

From source file:net.sourceforge.eclipsetrader.core.ui.PluginPreferencePage.java

License:Open Source License

/**
 * Creates a composite with a highlighted Note entry and a message text.
 * This is designed to take up the full width of the page.
 * //from   w w  w.  j  a v  a  2 s . c o  m
 * @param font the font to use
 * @param composite the parent composite
 * @param title the title of the note
 * @param message the message for the note
 * @return the composite for the note
 */
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;
    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() {
        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() {
        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.birt.report.designer.ui.viewer.StaticHTMLViewer.java

License:Open Source License

public Control createUI(Composite parent) {
    if (parent == null) {
        return null;
    }/*from ww  w . j a  v  a 2 s  .co  m*/
    toolkit = new FormToolkit(parent.getDisplay());
    form = toolkit.createForm(parent);

    form.setFont(JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT));
    form.setImage(
            StaticHTMLPrviewPlugin.getDefault().getImageRegistry().get(StaticHTMLPrviewPlugin.IMG_FORM_TITLE));

    toolkit.decorateFormHeading(form);
    form.setLayoutData(new GridData(GridData.FILL_BOTH));

    GridLayout layout = new GridLayout();
    layout.horizontalSpacing = layout.verticalSpacing = 0;
    layout.marginWidth = layout.marginHeight = 0;
    form.getBody().setLayout(layout);

    // Re-run the report action
    reRunReportAction = new Action("Re-run the report", //$NON-NLS-1$
            Action.AS_PUSH_BUTTON) {

        public void run() {
            render();
        }
    };
    reRunReportAction.setToolTipText("Re-run the report"); //$NON-NLS-1$
    reRunReportAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_RE_RUN));
    form.getToolBarManager().add(reRunReportAction);

    // paramAction
    paramAction = new Action("Enter parameter", Action.AS_PUSH_BUTTON) { //$NON-NLS-1$

        public void run() {
            render();
        }
    };
    paramAction.setToolTipText("Open Parameters Dialog"); //$NON-NLS-1$
    paramAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_PARAMS));
    form.getToolBarManager().add(paramAction);

    // tocAction
    tocAction = new Action("TOC", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$

        public void run() {
            if (sashForm.getMaximizedControl() != null) {
                sashForm.setMaximizedControl(null);
                setChecked(true);
            } else {
                sashForm.setMaximizedControl(browserContainer);
                setChecked(false);
            }
        }
    };
    tocAction.setToolTipText("Show TOC"); //$NON-NLS-1$
    tocAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_TOC));
    tocAction.setChecked(false);
    form.getToolBarManager().add(tocAction);

    form.getToolBarManager().add(new Separator());

    // navFirstAction
    navFirstAction = new Action("First", Action.AS_PUSH_BUTTON) { //$NON-NLS-1$

        public void run() {
            currentPageNum = 1;
            renderWithoutAskingForParams();
        }
    };
    navFirstAction.setToolTipText("First"); //$NON-NLS-1$
    navFirstAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_NAV_FIRST));
    form.getToolBarManager().add(navFirstAction);

    // navPreAction
    navPreAction = new Action("Previous", Action.AS_PUSH_BUTTON) { //$NON-NLS-1$

        public void run() {
            if (currentPageNum > 1) {
                currentPageNum--;
                renderWithoutAskingForParams();
            }
        }
    };

    navPreAction.setToolTipText("Previous"); //$NON-NLS-1$
    navPreAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_NAV_PRE));
    form.getToolBarManager().add(navPreAction);

    // navNextAction
    navNextAction = new Action("Next", Action.AS_PUSH_BUTTON) { //$NON-NLS-1$

        public void run() {
            if (currentPageNum < totalPageNum) {
                currentPageNum++;
                renderWithoutAskingForParams();
            }
        }
    };

    navNextAction.setToolTipText("Next"); //$NON-NLS-1$
    navNextAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_NAV_NEXT));
    form.getToolBarManager().add(navNextAction);

    // navLastAction
    navLastAction = new Action("Last", Action.AS_PUSH_BUTTON) { //$NON-NLS-1$

        public void run() {
            currentPageNum = totalPageNum;
            renderWithoutAskingForParams();
        }
    };

    navLastAction.setToolTipText("Last"); //$NON-NLS-1$
    navLastAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_NAV_LAST));
    form.getToolBarManager().add(navLastAction);

    form.getToolBarManager().add(new Separator());

    ContributionItem inputText = new ContributionItem() {

        public void fill(ToolBar parent, int index) {
            ToolItem toolitem = new ToolItem(parent, SWT.SEPARATOR, index);
            Composite container = new Composite(parent, SWT.NULL);
            // container.setFont( JFaceResources.getFontRegistry( )
            // .get( JFaceResources.TEXT_FONT ) );
            GridLayout layout = new GridLayout();
            layout.numColumns = 2;
            layout.marginWidth = layout.marginHeight = 1;
            container.setLayout(layout);
            Label label = new Label(container, SWT.NULL);
            label.setFont(container.getFont());
            label.setText("Go to page:"); //$NON-NLS-1$

            goPageInput = toolkit.createText(container, "", SWT.BORDER); //$NON-NLS-1$
            goPageInput.setFont(container.getFont());

            goPageInput.setLayoutData(new GridData(GridData.FILL_BOTH));
            goPageInput.addKeyListener(new KeyAdapter() {

                public void keyPressed(KeyEvent e) {
                    if (e.character == SWT.LF || e.character == SWT.CR) {
                        if (navGoAction.isEnabled()) {
                            currentPageNum = Long.parseLong(goPageInput.getText());
                            renderWithoutAskingForParams();
                        }
                    }
                }

            });

            goPageInput.addModifyListener(new ModifyListener() {

                /**
                 * last valid status
                 */
                private boolean isValid = true;

                public void modifyText(ModifyEvent e) {
                    if (!"".equals(goPageInput.getText())) //$NON-NLS-1$
                    {
                        try {
                            long page = Long.parseLong(goPageInput.getText());
                            if (page > 0 && page <= totalPageNum) {
                                if (!isValid) {
                                    form.setMessage(null);
                                    isValid = true;
                                }
                                navGoAction.setEnabled(true);
                            } else {
                                form.setMessage("Page Number '" //$NON-NLS-1$
                                        + page + "' is invalid!", //$NON-NLS-1$
                                        IMessageProvider.ERROR);
                                isValid = false;
                                navGoAction.setEnabled(false);
                            }
                        } catch (NumberFormatException e1) {
                            form.setMessage("Page Number '" //$NON-NLS-1$
                                    + goPageInput.getText() + "' is invalid!", //$NON-NLS-1$
                                    IMessageProvider.ERROR);
                            isValid = false;
                            navGoAction.setEnabled(false);
                        }
                    } else {
                        form.setMessage(null);
                        isValid = true;
                    }
                }
            });

            toolitem.setWidth(label.computeSize(SWT.DEFAULT, SWT.DEFAULT).x + 40);
            toolitem.setControl(container);
        }

    };
    inputText.setVisible(true);
    form.getToolBarManager().add(inputText);

    // navSelectAction
    navGoAction = new Action("Go to page", Action.AS_PUSH_BUTTON) { //$NON-NLS-1$

        public void run() {
            if (goPageInput != null && !goPageInput.isDisposed()) {
                currentPageNum = Long.parseLong(goPageInput.getText());
                // render( );
                renderWithoutAskingForParams();
            }
        }
    };

    navGoAction.setToolTipText("Go to page"); //$NON-NLS-1$
    navGoAction.setImageDescriptor(StaticHTMLPrviewPlugin.getDefault().getImageRegistry()
            .getDescriptor(StaticHTMLPrviewPlugin.IMG_NAV_GO));
    form.getToolBarManager().add(navGoAction);

    form.updateToolBar();

    sashForm = new SashForm(form.getBody(), SWT.NULL);
    sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    sashForm.setLayout(layout);
    toolkit.adapt(sashForm, false, false);

    createTOCSection(sashForm);
    createBrowserSection(sashForm);

    sashForm.setWeights(new int[] { 2, 8 });

    toolkit.paintBordersFor(form.getBody());

    return this.form;
}

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  w w  .j  av a 2s  .c  om*/
    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.cdt.utils.ui.controls.ControlFactory.java

License:Open Source License

/**
 * Creates a composite with a highlighted Note entry and a message text.
 * This is designed to take up the full width of the page.
 *
 * @param font the font to use/*from  ww  w.  j  av a  2 s .  c  o  m*/
 * @param composite the parent composite
 * @param title the title of the note
 * @param message the message for the note
 * @return the composite for the note
 */
public static Composite createNoteComposite(Font font, Composite composite, String title, String message) {
    Composite messageComposite = new Composite(composite, SWT.NONE);
    GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;
    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.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    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.tcf.internal.debug.ui.launch.TestErrorsDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Label label = new Label(composite, SWT.WRAP);
    label.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT));
    label.setText("Connection diagnostics ended with errors:");

    text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    text.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    text.setEditable(false);/*from   ww  w.  ja  v a  2  s .  co  m*/
    text.setText(createText());
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = SIZING_TEXT_WIDTH;
    data.heightHint = SIZING_TEXT_HEIGHT;
    text.setLayoutData(data);

    return composite;
}