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.css.ui.internal.contentassist.CompletionProposal.java

License:Open Source License

public IInformationControlCreator getInformationControlCreator() {
    if (fCreator == null) {
        fCreator = new AbstractReusableInformationControlCreator() {

            protected IInformationControl doCreateInformationControl(Shell parent) {
                if (BrowserInformationControl.isAvailable(parent)) {
                    BrowserInformationControl control = new BrowserInformationControl(parent,
                            JFaceResources.DIALOG_FONT, false);
                    return control;
                } else {
                    return new DefaultInformationControl(parent, true);
                }/*from   ww w.  java2s.c  o  m*/
            }
        };
    }
    return fCreator;
}

From source file:org.eclipse.wst.html.webresources.internal.ui.hover.WebResourcesHoverControlCreator.java

License:Open Source License

@Override
public IInformationControl doCreateInformationControl(Shell parent) {
    String tooltipAffordanceString = "Press F2 for focus";
    if (BrowserInformationControl.isAvailable(parent)) {
        String font = JFaceResources.DIALOG_FONT;
        BrowserInformationControl iControl = new BrowserInformationControl(parent, font,
                tooltipAffordanceString) {
            /*//from   w ww. j  ava2  s  .  c  om
             * @see org.eclipse.jface.text.IInformationControlExtension5#
             * getInformationPresenterControlCreator()
             */
            @Override
            public IInformationControlCreator getInformationPresenterControlCreator() {
                return fInformationPresenterControlCreator;
            }
        };
        addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent, tooltipAffordanceString);
    }
}

From source file:org.eclipse.wst.html.webresources.internal.ui.utils.HTMLWebResourcesPrinter.java

License:Open Source License

/**
 * Returns the Javadoc hover style sheet with the current Javadoc font from
 * the preferences./*from   w  w w.ja v a  2  s.c  om*/
 * 
 * @return the updated style sheet
 * @since 3.4
 */
private static String getStyleSheet() {
    if (fgStyleSheet == null) {
        fgStyleSheet = loadStyleSheet("/WebResourcesStyleSheet.css"); //$NON-NLS-1$
    }
    String css = fgStyleSheet;
    if (css != null) {
        FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0];
        css = HTMLPrinter.convertTopLevelFont(css, fontData);
    }

    return css;
}

From source file:org.eclipse.wst.html.webresources.internal.ui.utils.HTMLWebResourcesPrinter.java

License:Open Source License

/**
 * Loads and returns the style sheet associated with either Javadoc hover or
 * the view.//from w  w  w  . j  a  v  a  2 s .  c om
 * 
 * @param styleSheetName
 *            the style sheet name of either the Javadoc hover or the view
 * @return the style sheet, or <code>null</code> if unable to load
 * @since 3.4
 */
private static String loadStyleSheet(String styleSheetName) {
    Bundle bundle = Platform.getBundle(WebResourcesUIPlugin.PLUGIN_ID);
    URL styleSheetURL = bundle.getEntry(styleSheetName);
    if (styleSheetURL == null)
        return null;

    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new InputStreamReader(styleSheetURL.openStream()));
        StringBuffer buffer = new StringBuffer(1500);
        String line = reader.readLine();
        while (line != null) {
            buffer.append(line);
            buffer.append('\n');
            line = reader.readLine();
        }

        FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0];
        return HTMLPrinter.convertTopLevelFont(buffer.toString(), fontData);
    } catch (IOException ex) {
        Trace.trace(Trace.SEVERE, "Error while loading style sheets", ex);
        return ""; //$NON-NLS-1$
    } finally {
        try {
            if (reader != null)
                reader.close();
        } catch (IOException e) {
            // ignore
        }
    }
}

From source file:org.eclipse.wst.json.ui.internal.text.hover.HTMLJSONPrinter.java

License:Open Source License

/**
 * Returns the Javadoc hover style sheet with the current JSON font from the
 * preferences.//from   ww  w .  ja v  a  2s. c  o  m
 * 
 * @return the updated style sheet
 */
private static String getStyleSheet() {
    if (fgStyleSheet == null) {
        fgStyleSheet = loadStyleSheet("/JSONHoverStyleSheet.css"); //$NON-NLS-1$
    }
    String css = fgStyleSheet;
    if (css != null) {
        FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0];
        css = HTMLPrinter.convertTopLevelFont(css, fontData);
    }

    return css;
}

From source file:org.eclipse.wst.json.ui.internal.text.hover.HTMLJSONPrinter.java

License:Open Source License

/**
 * Loads and returns the style sheet associated with either JSON hover or
 * the view.//from ww  w. j av a2 s  .  c  o m
 * 
 * @param styleSheetName
 *            the style sheet name of either the Javadoc hover or the view
 * @return the style sheet, or <code>null</code> if unable to load
 */
private static String loadStyleSheet(String styleSheetName) {
    Bundle bundle = Platform.getBundle(JSONUIPlugin.PLUGIN_ID);
    URL styleSheetURL = bundle.getEntry(styleSheetName);
    if (styleSheetURL == null)
        return null;

    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new InputStreamReader(styleSheetURL.openStream()));
        StringBuffer buffer = new StringBuffer(1500);
        String line = reader.readLine();
        while (line != null) {
            buffer.append(line);
            buffer.append('\n');
            line = reader.readLine();
        }

        FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0];
        return HTMLPrinter.convertTopLevelFont(buffer.toString(), fontData);
    } catch (IOException ex) {
        Logger.logException("Error while loading style sheets", ex);
        return ""; //$NON-NLS-1$
    } finally {
        try {
            if (reader != null)
                reader.close();
        } catch (IOException e) {
            // ignore
        }
    }
}

From source file:org.eclipse.wst.json.ui.internal.text.JSONHoverControlCreator.java

License:Open Source License

@Override
public IInformationControl doCreateInformationControl(Shell parent) {
    String tooltipAffordanceString = "Press F2 for focus";
    if (BrowserInformationControl.isAvailable(parent)) {
        String font = JFaceResources.DIALOG_FONT;
        BrowserInformationControl iControl = new BrowserInformationControl(parent, font,
                tooltipAffordanceString) {
            /*//w w w.  j av a  2s  .  co m
             * @see org.eclipse.jface.text.IInformationControlExtension5#
             * getInformationPresenterControlCreator()
             */
            @Override
            public IInformationControlCreator getInformationPresenterControlCreator() {
                return fInformationPresenterControlCreator;
            }
        };
        // addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent, tooltipAffordanceString);
    }
}

From source file:org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractValidationSettingsPage.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);//w  ww.  ja  va2  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() {
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    fExpandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    return excomposite;
}

From source file:org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractValidationSettingsPage.java

License:Open Source License

protected Composite createStyleSectionWithContentComposite(Composite parent, String label, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);/*ww w .j a  va 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() {
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    fExpandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);

    Composite inner = new Composite(excomposite, SWT.NONE);
    inner.setFont(excomposite.getFont());
    inner.setLayout(new GridLayout(nColumns, false));
    excomposite.setClient(inner);
    return inner;
}

From source file:org.eclipse.wst.validation.internal.ui.DelegatingValidatorPreferencesDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    super.createDialogArea(parent);

    getShell().setText(ValUIMessages.DelegatesDialogTitle);

    GridLayout layout = new GridLayout();
    parent.setLayout(layout);/*w  ww.j ava 2 s .c  o m*/

    Label label = new Label(parent, SWT.NONE);
    GridData labelData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    labelData.widthHint = 250;
    label.setLayoutData(labelData);
    label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    String delegatingValidatorName = delegatingValidatorDescriptor.getValidatorDisplayName();
    label.setText(delegatingValidatorName);

    Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridData separatorData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    separator.setLayoutData(separatorData);

    Composite group = new Composite(parent, SWT.NONE);
    GridData groupGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    group.setLayoutData(groupGridData);
    GridLayout groupLayout = new GridLayout(2, false);
    group.setLayout(groupLayout);

    Label comboLabel = new Label(group, SWT.NONE);
    comboLabel.setLayoutData(new GridData());
    comboLabel.setText(ValUIMessages.DelegatesComboLabel);

    Combo combo = new Combo(group, SWT.READ_ONLY);
    GridData comboGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    combo.setLayoutData(comboGridData);

    final ComboViewer comboViewer = new ComboViewer(combo);
    comboViewer.setContentProvider(new DelegatesContentProvider());
    comboViewer.setLabelProvider(new DelegatesLabelProvider());
    String targetID = delegatingValidatorDescriptor.getValidatorUniqueName();

    comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) comboViewer.getSelection();
            setDelegateID(((ValidatorDelegateDescriptor) selection.getFirstElement()).getId());
        }
    });

    comboViewer.setInput(targetID);

    ValidatorDelegateDescriptor selected = ValidatorDelegatesRegistry.getInstance().getDescriptor(targetID,
            delegateID);

    if (selected != null) {
        comboViewer.setSelection(new StructuredSelection(new Object[] { selected }));
    }

    Label endSeparator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridData endSeparatorData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    endSeparator.setLayoutData(endSeparatorData);
    Dialog.applyDialogFont(parent);

    return parent;
}