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.aptana.ide.internal.ui.dialogs.SWTUtil.java

License:Open Source License

/**
 * @param table//from   w ww.ja v a  2  s  .  c om
 * @param rows
 * @return  s
 */
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:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java

License:Open Source License

protected Button addCheckBox(Composite parent, String label, Key key, String[] values, int indent) {
    final ControlData data = new ControlData(key, values);

    final GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 3;//w w  w. ja  v  a2  s.com
    gd.horizontalIndent = indent;

    final Button checkBox = new Button(parent, SWT.CHECK);
    checkBox.setFont(JFaceResources.getDialogFont());
    checkBox.setText(label);
    checkBox.setData(data);
    checkBox.setLayoutData(gd);
    checkBox.addSelectionListener(this.getSelectionListener());

    this.makeScrollableCompositeAware(checkBox);

    final String currValue = this.getValue(key);
    checkBox.setSelection(data.getSelection(currValue) == 0);

    this.fCheckBoxes.add(checkBox);

    return checkBox;
}

From source file:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java

License:Open Source License

protected Button addCheckBoxWithLink(Composite parent, String label, Key key, String[] values, int indent,
        int widthHint, SelectionListener listener) {
    final ControlData data = new ControlData(key, values);

    GridData gd = new GridData(GridData.FILL, GridData.FILL, true, false);
    gd.horizontalSpan = 3;/*from  ww  w  .  j  av a 2s  . c  o  m*/
    gd.horizontalIndent = indent;

    final Composite composite = new Composite(parent, SWT.NONE);
    final GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    composite.setLayout(layout);
    composite.setLayoutData(gd);

    final Button checkBox = new Button(composite, SWT.CHECK);
    checkBox.setFont(JFaceResources.getDialogFont());
    checkBox.setData(data);
    checkBox.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
    checkBox.addSelectionListener(this.getSelectionListener());

    gd = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gd.widthHint = widthHint;

    final Link link = new Link(composite, SWT.NONE);
    link.setText(label);
    link.setLayoutData(gd);
    if (listener != null) {
        link.addSelectionListener(listener);
    }

    this.makeScrollableCompositeAware(link);
    this.makeScrollableCompositeAware(checkBox);

    final String currValue = this.getValue(key);
    checkBox.setSelection(data.getSelection(currValue) == 0);

    this.fCheckBoxes.add(checkBox);

    return checkBox;
}

From source file:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java

License:Open Source License

protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels,
        int indent) {
    final GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1);
    gd.horizontalIndent = indent;//from w  ww .  j a v  a 2 s .com

    final Label labelControl = new Label(parent, SWT.LEFT);
    labelControl.setFont(JFaceResources.getDialogFont());
    labelControl.setText(label);
    labelControl.setLayoutData(gd);

    final Combo comboBox = this.newComboControl(parent, key, values, valueLabels);
    comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    this.fLabels.put(comboBox, labelControl);

    return comboBox;
}

From source file:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java

License:Open Source License

protected Combo addInversedComboBox(Composite parent, String label, Key key, String[] values,
        String[] valueLabels, int indent) {
    final GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gd.horizontalIndent = indent;//from w w w.  ja v  a  2 s.com
    gd.horizontalSpan = 3;

    final Composite composite = new Composite(parent, SWT.NONE);
    final GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    composite.setLayout(layout);
    composite.setLayoutData(gd);

    final Combo comboBox = this.newComboControl(composite, key, values, valueLabels);
    comboBox.setFont(JFaceResources.getDialogFont());
    comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    final Label labelControl = new Label(composite, SWT.LEFT | SWT.WRAP);
    labelControl.setText(label);
    labelControl.setLayoutData(new GridData());

    this.fLabels.put(comboBox, labelControl);
    return comboBox;
}

From source file:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java

License:Open Source License

protected Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels) {
    final ControlData data = new ControlData(key, values);

    final Combo comboBox = new Combo(composite, SWT.READ_ONLY);
    comboBox.setItems(valueLabels);/*from   w  w w.j  a va2  s .  c  o  m*/
    comboBox.setData(data);
    comboBox.addSelectionListener(this.getSelectionListener());
    comboBox.setFont(JFaceResources.getDialogFont());

    this.makeScrollableCompositeAware(comboBox);

    final String currValue = this.getValue(key);
    comboBox.select(data.getSelection(currValue));

    this.fComboBoxes.add(comboBox);
    return comboBox;
}

From source file:com.aptana.internal.ui.text.spelling.OptionsConfigurationBlock.java

License:Open Source License

protected Text addTextField(Composite parent, String label, Key key, int indent, int widthHint) {
    final Label labelControl = new Label(parent, SWT.WRAP);
    labelControl.setText(label);//from   w  w  w.ja v a  2s.  c  o m
    labelControl.setFont(JFaceResources.getDialogFont());
    labelControl.setLayoutData(new GridData());

    final Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);
    textBox.setData(key);
    textBox.setLayoutData(new GridData());

    this.makeScrollableCompositeAware(textBox);

    this.fLabels.put(textBox, labelControl);

    final String currValue = this.getValue(key);
    if (currValue != null) {
        textBox.setText(currValue);
    }
    textBox.addModifyListener(this.getTextModifyListener());

    final GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    if (widthHint != 0) {
        data.widthHint = widthHint;
    }
    data.horizontalIndent = indent;
    data.horizontalSpan = 2;
    textBox.setLayoutData(data);

    this.fTextBoxes.add(textBox);
    return textBox;
}

From source file:com.aptana.internal.ui.text.spelling.SWTUtil.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 * //from w  ww  .j  a  v  a2s .  c  om
 * @param button
 *            the button
 * @return the width hint
 */
public static int getButtonWidthHint(Button button) {
    button.setFont(JFaceResources.getDialogFont());
    final PixelConverter converter = new PixelConverter(button);
    final int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:com.aptana.internal.ui.text.spelling.SWTUtil.java

License:Open Source License

public static int getTableHeightHint(Table table, int rows) {
    if (table.getFont().equals(JFaceResources.getDefaultFont())) {
        table.setFont(JFaceResources.getDialogFont());
    }//www  .jav a2  s  .co  m
    int result = table.getItemHeight() * rows + table.getHeaderHeight();
    if (table.getLinesVisible()) {
        result += table.getGridLineWidth() * (rows - 1);
    }
    return result;
}

From source file:com.archimatetool.editor.ui.dialog.AboutDialog.java

License:Open Source License

private void createLicenseTab() {
    licenseTabItem = new TabItem(folder, SWT.NONE);
    licenseTabItem.setText(Messages.AboutDialog_5);

    Composite control = new Composite(folder, SWT.NONE);
    control.setLayout(new GridLayout());
    licenseTabItem.setControl(control);/*from   www  .  j ava2s . co m*/

    licenseText = new Text(control,
            SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.NO_FOCUS | SWT.H_SCROLL);
    licenseText.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    licenseText.setLayoutData(gridData);
    licenseText.setFont(JFaceResources.getDialogFont());
}