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:org.talend.updates.runtime.ui.feature.form.FeaturesUpdatesNotificationForm.java

License:Open Source License

private Font getInstallButtonFont() {
    final String installBtnFontKey = this.getClass().getName() + ".installButtonFont"; //$NON-NLS-1$
    FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    if (!fontRegistry.hasValueFor(installBtnFontKey)) {
        FontDescriptor fontDescriptor = FontDescriptor.createFrom(JFaceResources.getDialogFont())
                .setStyle(SWT.BOLD);/*w w w  .j  a  v  a  2 s .  c  o m*/
        fontRegistry.put(installBtnFontKey, fontDescriptor.getFontData());
    }
    return fontRegistry.get(installBtnFontKey);
}

From source file:org.talend.updates.runtime.ui.feature.form.item.AbstractControlListItem.java

License:Open Source License

protected Font getTitleFont() {
    final String titleFontKey = AbstractControlListItem.class.getName() + ".titleFont"; //$NON-NLS-1$
    FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    if (!fontRegistry.hasValueFor(titleFontKey)) {
        FontDescriptor fontDescriptor = FontDescriptor.createFrom(JFaceResources.getDialogFont()).setHeight(12)
                .setStyle(SWT.BOLD);//from ww w  .ja  va2 s  .c  om
        fontRegistry.put(titleFontKey, fontDescriptor.getFontData());
    }
    return fontRegistry.get(titleFontKey);
}

From source file:org.talend.updates.runtime.ui.feature.form.item.AbstractControlListItem.java

License:Open Source License

protected Font getInstallButtonFont() {
    final String installBtnFontKey = AbstractControlListItem.class.getName() + ".installButtonFont"; //$NON-NLS-1$
    FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    if (!fontRegistry.hasValueFor(installBtnFontKey)) {
        FontDescriptor fontDescriptor = FontDescriptor.createFrom(JFaceResources.getDialogFont())
                .setStyle(SWT.BOLD);//from  w w w.j  a  v  a  2s. com
        fontRegistry.put(installBtnFontKey, fontDescriptor.getFontData());
    }
    return fontRegistry.get(installBtnFontKey);
}

From source file:org.thanlwinsoft.languagetest.eclipse.search.TestItemSearchViewPage.java

License:Open Source License

protected void configureTableViewer(TableViewer viewer) {
    if (viewer.getTable().isDisposed())
        return;//w ww  .j a va  2  s .c  om
    //System.out.println(this + "ConfigureTableViewer " + viewer);
    if (viewer.getContentProvider() == null) {
        provider = new TableContentProvider();
        viewer.setContentProvider(provider);
        viewer.setLabelProvider(new TestItemTableLabelProvider());
        viewer.getTable().setHeaderVisible(true);
        FontData fd = JFaceResources.getDialogFont().getFontData()[0];
        // deliberately up the size because if the font size is too small
        // bigger table cell fonts are truncated
        FontData fdBig = new FontData(fd.getName(), TABLE_FONT_SIZE, fd.getStyle());
        Font font = LanguageTestPlugin.getFont(fdBig);
        viewer.getTable().setFont(font);

    }
    this.tableViewer = viewer;
    if (result != null) {
        //          for some reason this needs to be async to get anything displayed
        updateTableViewerInputs(true);
    }
}

From source file:org.universaal.tools.configurationEditor.dialogs.AttributeDialog.java

License:Apache License

protected Button createOkButton(Composite parent, int id, String label, boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);//from  w  ww . j  av a  2s .  co  m
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            //if (isValidInput()) {
            okPressed();
            // }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.universaal.tools.configurationEditor.dialogs.CategoryDialog.java

License:Apache License

protected Button createOkButton(Composite parent, int id, String label, boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);/*from   w  w  w .  ja  va 2  s  .c  om*/
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            // if (isValidInput()) {
            okPressed();
            // }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.universaal.tools.configurationEditor.dialogs.ValidatorDialog.java

License:Apache License

protected Button createOkButton(Composite parent, int id, String label, boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);//from  w  w  w .  j a v  a2  s . c  o  m
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            //if (isValidInput()) {
            okPressed();
            // }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.webcat.eclipse.importer.SWTUtil.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 * // w  w  w .  ja  v a2 s  . c  o m
 * @param button the button
 * @return a width hint
 */
public static int getButtonWidthHint(Button button) {
    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:org.webcat.eclipse.importer.SWTUtil.java

License:Open Source License

/**
 * Returns an estimate of the height in pixels of a table with the
 * specified number of rows.//from  ww w  .ja va2  s .  co m
 * 
 * @param table the Table whose height should be calculated
 * @param rows the number of rows that should be used to estimate the
 *     height of the table
 * @return the estimated height of the table, in pixels
 */
public static int getTableHeightHint(Table table, int rows) {
    if (table.getFont().equals(JFaceResources.getDefaultFont())) {
        table.setFont(JFaceResources.getDialogFont());
    }

    int result = table.getItemHeight() * rows + table.getHeaderHeight();

    if (table.getLinesVisible()) {
        result += table.getGridLineWidth() * (rows - 1);
    }

    return result;
}

From source file:org.whole.product.lw.launching.EnvironmentBlock.java

License:Open Source License

private Button createButton(Composite composite, String text) {
    Button button = new Button(composite, SWT.PUSH);
    button.setText(text);//from w w  w  .j a v  a  2s . com
    button.setFont(JFaceResources.getDialogFont());
    int widthHint = UIUtils.getButtonWidthHint(composite);
    GridData gd = new GridData();
    gd.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    gd.horizontalAlignment = GridData.FILL;
    button.setLayoutData(gd);
    return button;
}