Example #1
0
  /**
   * Set the GridData on button to be one that is spaced for the current font.
   *
   * @param button the button the data is being set on.
   */
  protected void setButtonLayoutData(Button button) {

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);

    // Compute and store a font metric
    GC gc = new GC(button);
    gc.setFont(button.getFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    int widthHint =
        org.eclipse.jface.dialogs.Dialog.convertVerticalDLUsToPixels(
            fontMetrics, IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    button.setLayoutData(data);
  }
Example #2
0
 public int convertVerticalDLUsToPixels(int dlus) {
   return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
 }
 public int convertVerticalDLUsToPixels(int dlus) {
   return org.eclipse.jface.dialogs.Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
 }