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

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

Introduction

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

Prototype

String DIALOG_FONT

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

Click Source Link

Document

The symbolic font name for the dialog font (value "org.eclipse.jface.dialogfont").

Usage

From source file:org.eclipse.php.internal.debug.core.preferences.AbstractDebuggerConfigurationDialog.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.
 * //  w  ww  .  j a  va  2  s  . co 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,
        int horizontalSpan) {
    Composite messageComposite = new Composite(composite, SWT.NONE);
    GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;
    messageLayout.marginWidth = 0;
    messageLayout.marginHeight = 0;
    messageLayout.marginTop = 10;
    messageComposite.setLayout(messageLayout);
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = horizontalSpan;
    gridData.widthHint = convertWidthInCharsToPixels(title.length() + message.length() + 1);
    messageComposite.setLayoutData(gridData);
    messageComposite.setFont(font);

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

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

From source file:org.eclipse.rcptt.ui.editors.ecl.EclInformationContol.java

License:Open Source License

public EclInformationContol(Shell parent, boolean resizeable) {
    super(parent, JFaceResources.DIALOG_FONT, resizeable);
}

From source file:org.eclipse.sirius.ui.tools.internal.views.common.navigator.filter.FilteredCommonTree.java

License:Open Source License

/**
 * Return a bold font if the given element matches the given pattern.
 * Clients can opt to call this method from a Viewer's label provider to get
 * a bold font for which to highlight the given element in the tree.
 * //from www  .  j a va 2 s.c om
 * @param element
 *            element for which a match should be determined
 * @param tree
 *            FilteredTree in which the element resides
 * @param filter
 *            PatternFilter which determines a match
 * 
 * @return bold font
 */
public static Font getBoldFont(Object element, FilteredCommonTree tree, PatternFilter filter) {
    Font result = null;

    String filterText = tree.getFilterString();

    if (filterText != null) {
        // Do nothing if it's empty string
        String initialText = tree.getInitialText();
        if (!filterText.equals("") && !filterText.equals(initialText)) { //$NON-NLS-1$
            if (tree.getPatternFilter() != filter) {
                boolean initial = initialText != null && initialText.equals(filterText);
                if (initial) {
                    filter.setPattern(null);
                } else if (filterText != null) {
                    filter.setPattern(filterText);
                }
            }
            if (filter.isElementVisible(tree.getViewer(), element)
                    && filter.isLeafMatch(tree.getViewer(), element)) {
                result = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
            }
        }
    }
    return result;
}

From source file:org.eclipse.tcf.te.ui.forms.CustomFormToolkit.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 parent The parent composite. Must not be <code>null</code>.
 * @param title The note title. Must not be <code>null</code>.
 * @param message The note message Must not be <code>null</code>.
 * @param widthHint The note message width hint in pixel or <code>SWT.DEFAULT</code>.
* @param overwriteBackground If <code>true</code>, the parent background color and image are applied to the note composite.
 *
 * @return The note composite./*from w w w.  j a  v  a2  s  .co  m*/
 */
public final Composite createNoteComposite(Composite parent, String title, String message, int widthHint,
        boolean overwriteBackground) {
    Assert.isNotNull(parent);
    Assert.isNotNull(title);
    Assert.isNotNull(message);

    Composite composite = getFormToolkit().createComposite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    composite.setFont(parent.getFont());

    Label noteLabel = getFormToolkit().createLabel(composite, title, SWT.BOLD);
    noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

    Label messageLabel = getFormToolkit().createLabel(composite, message);
    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.widthHint = widthHint;
    messageLabel.setLayoutData(layoutData);
    messageLabel.setFont(parent.getFont());

    // Overwrite background color and image if requested
    if (overwriteBackground) {
        composite.setBackground(parent.getBackground());
        composite.setBackgroundImage(parent.getBackgroundImage());

        noteLabel.setBackground(parent.getBackground());
        noteLabel.setBackgroundImage(parent.getBackgroundImage());

        messageLabel.setBackground(parent.getBackground());
        messageLabel.setBackgroundImage(parent.getBackgroundImage());
    }

    return composite;
}

From source file:org.eclipse.tcf.te.ui.notifications.delegates.DefaultFormTextFactoryDelegate.java

License:Open Source License

/**
 * Set the fonts used by the form./* w ww . ja va2 s .  c om*/
 *
 * @param toolkit The form toolkit. Must not be <code>null</code>.
 * @param widget The form text widget. Must not be <code>null</code>.
 */
protected void setFormTextFonts(FormToolkit toolkit, FormText widget) {
    Assert.isNotNull(toolkit);
    Assert.isNotNull(widget);

    widget.setFont("header", JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); //$NON-NLS-1$
    widget.setFont("text", JFaceResources.getTextFont()); //$NON-NLS-1$
}

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  v  a  2s . c  om
*
* @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.ui.internal.editors.text.QuickDiffConfigurationBlock.java

License:Open Source License

private Composite createNoteComposite(Font font, Composite composite, String title, String message) {
    Composite messageComposite = new Composite(composite, SWT.NONE);
    GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;//www  . j  a v  a 2s.c  o  m
    messageLayout.marginWidth = 0;
    messageLayout.marginHeight = 0;
    messageComposite.setLayout(messageLayout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    messageComposite.setFont(font);

    final Label noteLabel = new Label(messageComposite, SWT.BOLD);
    noteLabel.setText(title);
    noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    noteLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

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

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

License:Open Source License

/**
 * Creates information messages./*w ww  .  j ava  2  s  .c  om*/
 */
private void createMessagesPart() {
    resetMessage = new Label(autoSaveGroup, SWT.WRAP);
    resetMessage.setText(IDEWorkbenchMessages.AutoSavePreferencPage_resetMessage);
    final GridData resetMessageLayoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
    resetMessageLayoutData.widthHint = 350;
    resetMessage.setLayoutData(resetMessageLayoutData);

    final Composite noteComposite = new Composite(autoSaveGroup, SWT.NONE);
    final GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;
    messageLayout.marginWidth = 0;
    messageLayout.marginHeight = 0;
    noteComposite.setLayout(messageLayout);
    final GridData noteCompositeData = new GridData(SWT.FILL, SWT.FILL, true, false);
    noteComposite.setLayoutData(noteCompositeData);

    noteLabel = new Label(noteComposite, SWT.NONE);
    noteLabel.setText(IDEWorkbenchMessages.AutoSavePreferencPage_noteLabel);
    noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    noteLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    noteMessage = new Label(noteComposite, SWT.WRAP);
    noteMessage.setText(IDEWorkbenchMessages.AutoSavePreferencPage_noteMessage);
    final GridData noteMessageData = new GridData(SWT.FILL, SWT.FILL, true, false);
    noteMessageData.widthHint = 350;
    noteMessage.setLayoutData(noteMessageData);
}

From source file:org.eclipse.ui.internal.themes.ColorsAndFontsPreferencePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.preference.PreferencePage#performApply()
 *///ww w .  j a va 2 s.  c o m
protected void performApply() {
    super.performApply();

    //Apply the default font to the dialog.
    Font oldFont = appliedDialogFont;
    FontDefinition fontDefinition = themeRegistry.findFont(JFaceResources.DIALOG_FONT);
    if (fontDefinition == null)
        return;
    FontData[] newData = getFontValue(fontDefinition);

    appliedDialogFont = new Font(getControl().getDisplay(), newData);

    updateForDialogFontChange(appliedDialogFont);
    getApplyButton().setFont(appliedDialogFont);
    getDefaultsButton().setFont(appliedDialogFont);

    if (oldFont != null)
        oldFont.dispose();
}

From source file:org.eclipse.virgo.ide.ui.editors.text.BundleTypeCompletionProposal.java

License:Open Source License

public IInformationControlCreator getInformationControlCreator() {
    Shell shell = JavaPlugin.getActiveWorkbenchShell();
    if (shell == null || !BrowserInformationControl.isAvailable(shell)) {
        return null;
    }//from   w w  w  .  j a  va  2s . com

    if (this.fCreator == null) {
        this.fCreator = new AbstractReusableInformationControlCreator() {

            /*
             * @seeorg.eclipse.jdt.internal.ui.text.java.hover. AbstractReusableInformationControlCreator
             * #doCreateInformationControl(org.eclipse.swt.widgets.Shell)
             */
            @Override
            public IInformationControl doCreateInformationControl(Shell parent) {
                return new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT,
                        EditorsUI.getTooltipAffordanceString());
            }
        };
    }
    return this.fCreator;
}