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

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

Introduction

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

Prototype

public static Font getDialogFont() 

Source Link

Document

Returns the JFace's dialog font.

Usage

From source file:com.nokia.tools.variant.common.ui.wizards.dialogfields.StringButtonStatusDialogField.java

License:Open Source License

protected GridData gridDataForStatusLabel(Control aControl, int span) {
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.BEGINNING;
    gd.grabExcessHorizontalSpace = false;
    gd.horizontalIndent = 0;/*from  w w  w . j av  a2  s .c om*/
    if (fWidthHintString != null) {
        GC gc = new GC(aControl);
        gc.setFont(JFaceResources.getDialogFont());
        gd.widthHint = gc.textExtent(fWidthHintString).x;
        gc.dispose();
    } else if (fWidthHint != -1) {
        gd.widthHint = fWidthHint;
    } else {
        gd.widthHint = SWT.DEFAULT;
    }
    return gd;
}

From source file:com.redhat.ceylon.eclipse.code.browser.BrowserInformationControl.java

License:Open Source License

@Override
public Point computeSizeConstraints(int widthInChars, int heightInChars) {
    if (fSymbolicFontName == null)
        return null;

    GC gc = new GC(fBrowser);
    Font font = fSymbolicFontName == null ? JFaceResources.getDialogFont()
            : JFaceResources.getFont(fSymbolicFontName);
    gc.setFont(font);//from   w w  w. ja  v a2s . c o  m
    int width = gc.getFontMetrics().getAverageCharWidth();
    int height = gc.getFontMetrics().getHeight();
    gc.dispose();

    return new Point(widthInChars * width, heightInChars * height);
}

From source file:com.redhat.ceylon.eclipse.code.hover.AbstractInformationControl.java

License:Open Source License

private void createStatusLabel(final String statusFieldText, Color foreground, Color background) {
    fStatusLabel = new Label(fStatusComposite, SWT.RIGHT);
    fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    fStatusLabel.setText(statusFieldText);

    FontData[] fontDatas = JFaceResources.getDialogFont().getFontData();
    for (int i = 0; i < fontDatas.length; i++) {
        fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
    }/*from  w w w  .  j  a va2  s.com*/
    fStatusLabelFont = new Font(fStatusLabel.getDisplay(), fontDatas);
    fStatusLabel.setFont(fStatusLabelFont);

    fStatusLabelForeground = new Color(fStatusLabel.getDisplay(),
            Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f));
    setColor(fStatusLabel, fStatusLabelForeground, background);
    setColor(fStatusComposite, foreground, background);
}

From source file:com.sap.dirigible.ide.template.ui.html.wizard.HtmlForEntityTemplateTablePage.java

License:Open Source License

private void createTableField(Composite parent) {
    Composite upperPart = new Composite(parent, SWT.NONE);
    upperPart.setLayout(new GridLayout(3, false));
    upperPart.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    final Label label = new Label(upperPart, SWT.NONE);
    label.setText(AVAILABLE_FIELDS);// www. jav a2  s  . co m
    label.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false));

    Button selectButton = new Button(upperPart, SWT.PUSH);
    selectButton.setText(IDEWorkbenchMessages.WizardTransferPage_selectAll);
    selectButton.setLayoutData(new GridData(SWT.END, SWT.FILL, true, true));
    selectButton.setFont(JFaceResources.getDialogFont());
    selectButton.addSelectionListener(new SelectionAdapter() {
        /**
         * 
         */
        private static final long serialVersionUID = -7095187791495950403L;

        public void widgetSelected(SelectionEvent event) {
            selectAll(true);
        }
    });

    Button deselectButton = new Button(upperPart, SWT.PUSH);
    deselectButton.setText(IDEWorkbenchMessages.WizardTransferPage_deselectAll);
    deselectButton.setLayoutData(new GridData(SWT.END, SWT.FILL, false, false));
    deselectButton.setFont(JFaceResources.getDialogFont());
    deselectButton.addSelectionListener(new SelectionAdapter() {
        /**
         * 
         */
        private static final long serialVersionUID = 7117397741755265980L;

        public void widgetSelected(SelectionEvent event) {
            selectAll(false);
        }
    });

    typeViewer = new TableViewer(parent, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.CHECK);
    typeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    typeViewer.setContentProvider(new ArrayContentProvider());
    typeViewer.setLabelProvider(new HtmlForEntityTemplateTablePageLabelProvider());
    //typeViewer.setSorter(new ViewerSorter());
    createTableColumns();
    typeViewer.setInput(model.getOriginalTableColumns());
    typeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateTableColumns();
            checkPageStatus();
        }
    });
    updateTableColumns();

}

From source file:com.siteview.mde.internal.ui.SWTFactory.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 *//*from ww w .j  ava 2 s .  co  m*/
public static int getButtonWidthHint(Button button, int widthHint) {
    button.setFont(JFaceResources.getDialogFont());
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:com.siteview.mde.internal.ui.util.SWTUtil.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 *//*w  w  w  . j a  v  a  2s  . c  o  m*/
public static int getButtonWidthHint(Button button) {
    if (button.getFont().equals(JFaceResources.getDefaultFont()))
        button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:com.telink.tc32eclipse.ui.preferences.MainPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    Composite content = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//www .j a v a  2s.  com
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    content.setLayout(layout);
    content.setFont(parent.getFont());

    Label filler = new Label(content, SWT.NONE);
    filler.setText("");

    Label label = createDescriptionLabel(content);
    label.setText("Please select one of the sub-pages to change the settings for the TC32 plugin.");

    filler = new Label(content, SWT.NONE);
    filler.setText("");

    createNoteComposite(JFaceResources.getDialogFont(), content, "TCDB:",
            "Manage the configuration of TCDB Binary Loader.\n");

    createNoteComposite(JFaceResources.getDialogFont(), content, "Paths:",
            "Manage the paths to the external tools and files used by the plugin.\n");

    return content;

}

From source file:com.telink.tc32eclipse.ui.preferences.PathsPreferencePage.java

License:Open Source License

@Override
public void createFieldEditors() {

    // This page has two fields:
    // The first one to inhibit the startup search for changed system paths
    // The second to edit all paths.

    Composite parent = getFieldEditorParent();

    Label filler = new Label(parent, SWT.NONE);
    filler.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    // Startup search inhibit

    BooleanFieldEditor autoScanBoolean = new BooleanFieldEditor(TC32PathsPreferences.KEY_NOSTARTUPSCAN,
            "Disable search for system paths at startup", BooleanFieldEditor.DEFAULT, parent);
    addField(autoScanBoolean);//www .  j  a v a  2s.c o  m

    Composite note = createNoteComposite(JFaceResources.getDialogFont(), parent, "Note:",
            "If disabled, a manual rescan may be required when a new tc32-elf-tcctoolchain has been installed.\n");
    note.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    filler = new Label(parent, SWT.NONE);
    filler.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    // Path editor field control.

    TC32PathsFieldEditor pathEditor = new TC32PathsFieldEditor(parent);
    addField(pathEditor);

}

From source file:com.wdev91.eclipse.copyright.preferences.FormatsPanel.java

License:Open Source License

private int convertHorizontalDLUsToPixels(int dlus) {
    GC gc = new GC(this);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();//from  www  . j  a  va  2 s . c  o  m

    if (fontMetrics == null) {
        return 0;
    }
    return Dialog.convertHorizontalDLUsToPixels(fontMetrics, dlus);
}

From source file:de.innot.avreclipse.ui.preferences.MainPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    Composite content = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//from  w  ww. j a v  a2s .com
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    content.setLayout(layout);
    content.setFont(parent.getFont());

    Label filler = new Label(content, SWT.NONE);
    filler.setText("");

    Label label = createDescriptionLabel(content);
    label.setText("Please select one of the sub-pages to change the settings for the AVR plugin.");

    filler = new Label(content, SWT.NONE);
    filler.setText("");

    createNoteComposite(JFaceResources.getDialogFont(), content, "AVRDude:",
            "Manage the configuration of programmer devices for avrdude.\n");

    createNoteComposite(JFaceResources.getDialogFont(), content, "Paths:",
            "Manage the paths to the external tools and files used by the plugin.\n");

    return content;

}