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.wst.ws.internal.service.policy.ui.ServicePoliciesComposite.java

License:Open Source License

/**
 * Creates an expandable composite//  w  w  w.j  a va  2s  .c om
 * @param parent
 * @param nColumns
 * @return
 */
private ExpandableComposite createExpandableComposite(Composite parent, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setExpanded(false);
    excomposite.setVisible(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    makeScrollableCompositeAware(excomposite);
    return excomposite;
}

From source file:org.eclipse.wst.xsl.ui.internal.preferences.AbstractXSLPreferencePage.java

License:Open Source License

protected Composite createTwistie(Composite parent, String label, int cols) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);//from   ww w  . j a v  a  2  s . co  m
    excomposite.setExpanded(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, cols, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {
        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    fExpandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);

    Composite twistieCient = new Composite(excomposite, SWT.NONE);
    excomposite.setClient(twistieCient);

    GridLayout layout = new GridLayout(2, false);
    layout.marginRight = 5;
    twistieCient.setLayout(layout);

    GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
    twistieCient.setLayoutData(gd);

    return twistieCient;
}

From source file:org.eclipse.wst.xsl.ui.internal.preferences.XSLValidationPreferencePage.java

License:Open Source License

protected ExpandableComposite createTwistie(Composite parent, String label, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);/* w ww .  java 2  s  .  co m*/
    excomposite.setExpanded(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {
        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    Expandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    return excomposite;
}

From source file:org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);/*from   w  w w. jav a  2  s  .c o  m*/
    excomposite.setExpanded(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {
        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    expandedComposites.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    return excomposite;
}

From source file:org.eclipse.xtext.xbase.ui.hover.XbaseInformationControl.java

License:Open Source License

/**
 * Creates and initializes the text layout used to compute the size hint.
 * /*from  w w w .j  ava  2 s .c o  m*/
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout = new TextLayout(fSashForm.getDisplay());

    // Initialize fonts
    String symbolicFontName = fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    "); //$NON-NLS-1$
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] { tabWidth });
    fTextLayout.setText(""); //$NON-NLS-1$
}

From source file:org.emftext.language.xpath2.resource.xpath2.ui.Xpath2BrowserInformationControl.java

License:Open Source License

/**
 * Creates and initializes the text layout used to compute the size hint.
 * /*w  w  w  .  j  av  a 2s . c om*/
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout = new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName = fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] { tabWidth });

    fTextLayout.setText("");
}

From source file:org.erlide.ui.editors.erl.EditorConfiguration.java

License:Open Source License

@Override
public IInformationControlCreator getInformationControlCreator(final ISourceViewer sourceViewer) {
    return new IInformationControlCreator() {

        @Override/*from w ww.j a  v  a2 s  . c  o  m*/
        public IInformationControl createInformationControl(final Shell parent) {
            if (parent.getText().length() == 0 && BrowserInformationControl.isAvailable(parent)
                    && editor != null) {
                final BrowserInformationControl info = new BrowserInformationControl(parent,
                        JFaceResources.DIALOG_FONT, EditorsUI.getTooltipAffordanceString()) {
                    @Override
                    public IInformationControlCreator getInformationPresenterControlCreator() {
                        return new PresenterControlCreator(editor);
                    }
                };
                return info;
            } else {
                return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString(),
                        new ErlInformationPresenter(true));
            }
        }
    };
}

From source file:org.erlide.ui.information.PresenterControlCreator.java

License:Open Source License

@Override
protected IInformationControl doCreateInformationControl(final Shell parent) {
    if (BrowserInformationControl.isAvailable(parent)) {
        final ToolBarManager tbm = new ToolBarManager(SWT.FLAT);

        final String font = JFaceResources.DIALOG_FONT;
        final BrowserInformationControl iControl = new BrowserInformationControl(parent, font, tbm);

        final PresenterControlCreator.BackAction backAction = new PresenterControlCreator.BackAction(iControl);
        backAction.setEnabled(false);/*www  . j  ava2 s.  c  o  m*/
        tbm.add(backAction);
        final PresenterControlCreator.ForwardAction forwardAction = new PresenterControlCreator.ForwardAction(
                iControl);
        tbm.add(forwardAction);
        forwardAction.setEnabled(false);

        final PresenterControlCreator.ShowInEdocViewAction showInEdocViewAction = new PresenterControlCreator.ShowInEdocViewAction(
                iControl);
        tbm.add(showInEdocViewAction);
        final PresenterControlCreator.OpenDeclarationAction openDeclarationAction = new PresenterControlCreator.OpenDeclarationAction(
                iControl, editor);
        tbm.add(openDeclarationAction);

        final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
        // OpenExternalBrowserAction openExternalJavadocAction = new
        // OpenExternalBrowserAction(
        // parent.getDisplay(), selectionProvider);
        // selectionProvider
        // .addSelectionChangedListener(openExternalJavadocAction);
        // selectionProvider.setSelection(new
        // StructuredSelection());
        // tbm.add(openExternalJavadocAction);

        final IInputChangedListener inputChangeListener = new IInputChangedListener() {
            public void inputChanged(final Object newInput) {
                backAction.update();
                forwardAction.update();
                if (newInput == null) {
                    selectionProvider.setSelection(new StructuredSelection());
                } else if (newInput instanceof BrowserInformationControlInput) {
                    final BrowserInformationControlInput input = (BrowserInformationControlInput) newInput;
                    final Object inputElement = input.getInputElement();
                    selectionProvider.setSelection(new StructuredSelection(inputElement));
                    final boolean hasInputElement = inputElement != null;
                    showInEdocViewAction.setEnabled(hasInputElement);
                    openDeclarationAction.setEnabled(hasInputElement);
                }
            }
        };
        iControl.addInputChangeListener(inputChangeListener);

        tbm.update(true);

        return iControl;
    } else {
        return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString(),
                new ErlInformationPresenter(true));
    }
}

From source file:org.erlide.ui.internal.information.PresenterControlCreator.java

License:Open Source License

@Override
protected IInformationControl doCreateInformationControl(final Shell parent) {
    if (BrowserInformationControl.isAvailable(parent)) {
        final ToolBarManager tbm = new ToolBarManager(SWT.FLAT);

        final String font = JFaceResources.DIALOG_FONT;
        final BrowserInformationControl iControl = new BrowserInformationControl(parent, font, tbm);

        final PresenterControlCreator.BackAction backAction = new PresenterControlCreator.BackAction(iControl);
        backAction.setEnabled(false);//  w w w .jav a 2s. co m
        tbm.add(backAction);
        final PresenterControlCreator.ForwardAction forwardAction = new PresenterControlCreator.ForwardAction(
                iControl);
        tbm.add(forwardAction);
        forwardAction.setEnabled(false);

        final PresenterControlCreator.ShowInEdocViewAction showInEdocViewAction = new PresenterControlCreator.ShowInEdocViewAction(
                iControl);
        tbm.add(showInEdocViewAction);
        final PresenterControlCreator.OpenDeclarationAction openDeclarationAction = new PresenterControlCreator.OpenDeclarationAction(
                iControl, editor);
        tbm.add(openDeclarationAction);

        final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
        // OpenExternalBrowserAction openExternalJavadocAction = new
        // OpenExternalBrowserAction(
        // parent.getDisplay(), selectionProvider);
        // selectionProvider
        // .addSelectionChangedListener(openExternalJavadocAction);
        // selectionProvider.setSelection(new
        // StructuredSelection());
        // tbm.add(openExternalJavadocAction);

        final IInputChangedListener inputChangeListener = new IInputChangedListener() {
            @Override
            public void inputChanged(final Object newInput) {
                backAction.update();
                forwardAction.update();
                if (newInput == null) {
                    selectionProvider.setSelection(new StructuredSelection());
                } else if (newInput instanceof BrowserInformationControlInput) {
                    final BrowserInformationControlInput input = (BrowserInformationControlInput) newInput;
                    final Object inputElement = input.getInputElement();
                    selectionProvider.setSelection(new StructuredSelection(inputElement));
                    final boolean hasInputElement = inputElement != null;
                    showInEdocViewAction.setEnabled(hasInputElement);
                    openDeclarationAction.setEnabled(hasInputElement);
                }
            }
        };
        iControl.addInputChangeListener(inputChangeListener);

        tbm.update(true);

        return iControl;
    } else {
        return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString(),
                new ErlInformationPresenter(true));
    }
}

From source file:org.gemoc.execution.concurrent.ccsljavaxdsml.ui.dashboard.form.tree.FilteredTree.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.
 * /*w w  w.j  a v a2 s. c o m*/
 * @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, FilteredTree tree, PatternFilter filter) {
    String filterText = tree.getFilterString();

    if (filterText == null) {
        return null;
    }

    // Do nothing if it's empty string
    String initialText = tree.getInitialText();
    if (!("".equals(filterText) || initialText.equals(filterText))) {//$NON-NLS-1$
        boolean initial = (initialText != null) && initialText.equals(filterText);
        if (initial) {
            filter.setPattern(null);
        } else if (filterText != null) {
            filter.setPattern(filterText);
        }

        TreeViewer viewer = tree.getViewer();
        Object parent = ((ITreeContentProvider) viewer.getContentProvider()).getParent(element);
        if (filter.isElementVisible(viewer, parent, element) && filter.isLeafMatch(viewer, parent, element)) {
            return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
        }
    }
    return null;
}