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.obeonetwork.angularjs.eclipse.tools.ide.ui.internal.wizards.AngularJSStringButtonDialogField.java

License:Open Source License

protected static GridData gridDataForButton(Button button, int span) {
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = false;
    gd.horizontalSpan = span;//w  w w .  j  av  a2s .  com
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    gd.widthHint = widthHint;
    return gd;
}

From source file:org.opensixen.omvc.console.dialog.AbstractDialog.java

License:GNU General Public 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);/* www.  j  a va  2 s.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.org.eclipse.core.utils.platform.dialogs.Dialog.java

License:Open Source License

/**
 * Creates a new button with the given id.
 * <p>/*w  w  w .ja  v  a  2  s  .  c  om*/
 * The <code>Dialog</code> implementation of this framework method creates a standard push button, registers it for selection events including button presses, and registers default buttons with its shell. The button id is stored as the button's client data. If the button id is <code>IDialogConstants.CANCEL_ID</code>, the new button will be accessible from <code>getCancelButton()</code>. If the button id is <code>IDialogConstants.OK_ID</code>, the new button will be accesible from <code>getOKButton()</code>. Note that the parent's layout is assumed to be a <code>GridLayout</code> and the number of columns in this layout is incremented. Subclasses may override.
 * </p>
 * 
 * @param parent
 *            the parent composite
 * @param id
 *            the id of the button (see <code>IDialogConstants.*_ID</code> constants for standard dialog button ids)
 * @param label
 *            the label from the button
 * @param defaultButton
 *            <code>true</code> if the button is to be the default button, and <code>false</code> otherwise
 * 
 * @return the new button
 * 
 * @see #getCancelButton
 * @see #getOKButton()
 */
protected Button createButton(Composite parent, int id, String label, boolean defaultButton, int style) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, style);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(Integer.valueOf(new Integer(id)));
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            buttonPressed(((Integer) event.widget.getData()).intValue());
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    buttons.put(Integer.valueOf(id), button);
    setButtonLayoutData(button);
    return button;
}

From source file:org.org.eclipse.core.utils.platform.dialogs.Dialog.java

License:Open Source License

/**
 * Initializes the computation of horizontal and vertical dialog units based on the size of current font.
 * <p>/*  w ww.  j  a  v  a  2 s .co  m*/
 * This method must be called before any of the dialog unit based conversion methods are called.
 * </p>
 * 
 * @param control
 *            a control from which to obtain the current font
 */
protected void initializeDialogUnits(Control control) {
    // Compute and store a font metric
    GC gc = new GC(control);
    gc.setFont(JFaceResources.getDialogFont());
    fontMetrics = gc.getFontMetrics();
    gc.dispose();
}

From source file:org.org.eclipse.core.utils.platform.tools.WidgetTools.java

License:Open Source License

/**
 * Returns a height hint for a button control.
 * @deprecated button height is now determined by the layout.
 *///from w w w .j a v  a  2  s. c o  m
public static int getButtonHeightHint(Button button) {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    return converter.convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
}

From source file:org.osate.analysis.arinc653.actions.PreferencesDialog.java

License:Open Source 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  a 2 s. c o m
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));

    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {

            okPressed();

        }
    });

    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }

    setButtonLayoutData(button);
    return button;
}

From source file:org.ow2.joram.design.model.export.wizard.SelectElementsWizardPage.java

License:Open Source License

protected Button createButton(Composite parent, int id, String label) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);/*  w w  w .  j a  v a 2  s .c om*/
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    setButtonLayoutData(button);
    return button;
}

From source file:org.parallelj.extensions.data.generator.wizard.dialog.PackageSelectionDialog.java

License:Open Source License

/**
 * below method creates default OK and Cancel button
 *//*from  w  ww. j  av a 2  s  .c om*/

@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    if (id != 0) {
        dataPerspectiveDialogEvents();
        initializeDialogMaster();

    }
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (((Integer) event.widget.getData()).intValue() == 1) {
                if (wizardOutput != null)
                    wizardOutput = null;
            } else {
                setWizardData();
                setDialogSettings();

            }

            buttonPressed(((Integer) event.widget.getData()).intValue());
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    buttons.put(new Integer(id), button);
    setButtonLayoutData(button);
    return button;
}

From source file:org.parallelj.extensions.data.generator.wizard.subdialog.ParallelJSubDialog.java

License:Open Source License

@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);//from  w ww  .ja  va 2s .  c  om
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            if (((Integer) event.widget.getData()).intValue() == 0) {
                if (childData.getObject() == null) {
                    if (table.getItem(0) != null) {
                        List<Object> datas = new ArrayList<Object>();
                        datas.add(table.getItem(0).getData());
                        childData.setObject(datas);
                    }
                }
            } else {
                if (childData != null)
                    childData = null;
            }
            buttonPressed(((Integer) event.widget.getData()).intValue());
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    buttons.put(new Integer(id), button);
    if (((Integer) button.getData()).intValue() == 0) {
        if (childData != null && childData.getLobjects() == null) {
            button.setEnabled(false);
            dialogLabel.setEnabled(false);
            searchText.setEnabled(false);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.phpmaven.eclipse.ui.prj.ProjWizArchetypePage.java

License:Open Source License

/** initializes the fonts. */
private void initializeFonts() {
    // create a level-2 heading font
    if (this.h2Font == null) {
        Font baseFont = JFaceResources.getDialogFont();
        FontData[] fontData = baseFont.getFontData();
        for (FontData data : fontData) {
            data.setStyle(data.getStyle() | SWT.BOLD);
            data.height = data.height * 1.25f;
        }/*  ww  w  .  j ava2s.c  o m*/
        this.h2Font = new Font(Display.getCurrent(), fontData);
        this.disposables.add(this.h2Font);
    }
    // create a level-1 heading font
    if (this.h1Font == null) {
        Font baseFont = JFaceResources.getDialogFont();
        FontData[] fontData = baseFont.getFontData();
        for (FontData data : fontData) {
            data.setStyle(data.getStyle() | SWT.BOLD);
            data.height = data.height * 1.35f;
        }
        this.h1Font = new Font(Display.getCurrent(), fontData);
        this.disposables.add(this.h1Font);
    }
}