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.kopson.cite.actions.AddSmartLogRowDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    ((GridLayout) parent.getLayout()).numColumns++;

    Button button = new Button(parent, SWT.PUSH);
    button.setText(CITE.DIALOG_OK);/*from w ww.j a v a 2s .  c  o  m*/
    button.setFont(JFaceResources.getDialogFont());
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (tagText.getText().length() != 0 && messageText.getText().length() != 0
                    && typeCombo.getItem(typeCombo.getSelectionIndex()).length() != 0
                    && objectText.getText().length() != 0 && assertionText.getText().length() != 0) {
                row = new SmartLogEntry(SmartLogProvider.ROWID++,
                        typeCombo.getItem(typeCombo.getSelectionIndex()), tagText.getText(),
                        messageText.getText(), objectText.getText(), assertionText.getText());
                close();

            } else {
                setErrorMessage(CITE.DIALOG_ERROR_MSG);
            }
        }
    });
}

From source file:com.liferay.ide.project.ui.action.NewWizardAction.java

License:Open Source License

public void run() {
    Shell shell = getShell();//from   w w  w  .ja va2 s . c o m
    try {
        INewWizard wizard = createWizard();

        wizard.init(PlatformUI.getWorkbench(), getSelection());

        WizardDialog dialog = new WizardDialog(shell, wizard);

        PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());

        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));

        dialog.create();

        int res = dialog.open();

        notifyResult(res == Window.OK);
    } catch (CoreException e) {
    }
}

From source file:com.liferay.ide.project.ui.pref.AbstractValidationSettingsPage.java

License:Open Source License

/**
 * Creates a Combo widget in the composite <code>parent</code>. The data
 * in the Combo is associated with <code>key</code>. The Combo data is
 * generated based on the integer <code>values</code> where the index
 * of <code>values</code> corresponds to the index of <code>valueLabels</code>
 *
 * @param parent the composite to create the combo box in
 * @param label the label to give the combo box
 * @param key the unique key to identify the combo box
 * @param values the values represented by the combo options
 * @param valueLabels the calues displayed in the combo box
 * @param indent how far to indent the combo box label
 *
 * @return the generated combo box/*from w ww .  ja  v a  2s  . co  m*/
 */
protected Combo addComboBox(Composite parent, String label, String key, int[] values, String[] valueLabels,
        int indent) {
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1);
    gd.horizontalIndent = indent;

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

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

    return comboBox;
}

From source file:com.liferay.ide.project.ui.pref.AbstractValidationSettingsPage.java

License:Open Source License

/**
 * Creates a combo box and associates the combo data with the
 * combo box./*ww  w. ja va  2 s .co  m*/
 *
 * @param composite the composite to create the combo box in
 * @param key the unique key to identify the combo box
 * @param values the values represented by the combo options
 * @param valueLabels the values displayed in the combo box
 *
 * @return the generated combo box
 */
protected Combo newComboControl(Composite composite, String key, int[] values, String[] valueLabels) {
    ComboData data = new ComboData(key, values, -1);

    Combo comboBox = new Combo(composite, SWT.READ_ONLY);
    comboBox.setItems(valueLabels);
    comboBox.setData(data);
    comboBox.addSelectionListener(getSelectionListener());
    comboBox.setFont(JFaceResources.getDialogFont());

    makeScrollableCompositeAware(comboBox);

    int severity = -1;
    if (key != null)
        severity = fPreferencesService.getInt(getPreferenceNodeQualifier(), key, ValidationMessage.WARNING,
                createPreferenceScopes());

    if (severity == ValidationMessage.ERROR || severity == ValidationMessage.WARNING
            || severity == ValidationMessage.IGNORE) {
        data.setSeverity(severity);
        data.originalSeverity = severity;
    }

    if (data.getIndex() >= 0)
        comboBox.select(data.getIndex());

    fCombos.add(comboBox);
    return comboBox;
}

From source file:com.liferay.ide.ui.util.SWTUtil.java

License:Open Source License

protected static void initializeDialogUnits(Control testControl) {
    // Compute and store a font metric
    GC gc = new GC(testControl);
    gc.setFont(JFaceResources.getDialogFont());
    fontMetrics = gc.getFontMetrics();/* w w  w .j a v  a 2  s . c  o  m*/
    gc.dispose();
}

From source file:com.liferay.ide.xml.search.ui.editor.LiferayCustomXmlHoverControl.java

License:Open Source License

protected void deferredCreateContent() {
    if (region != null) {
        final ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL);
        GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
        scrolledComposite.setLayoutData(gridData);
        scrolledComposite.setExpandVertical(false);
        scrolledComposite.setExpandHorizontal(false);

        Composite composite = new Composite(scrolledComposite, SWT.NONE);
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        GridLayout layout = new GridLayout(1, false);
        composite.setLayout(layout);//from w  w  w .  j  a  v a 2 s .  co m

        scrolledComposite.setContent(composite);

        for (IRegion reg : region.getRegions()) {
            if (reg instanceof MarkerRegion) {
                final MarkerRegion markerReg = (MarkerRegion) reg;
                createAnnotationInformation(composite, markerReg.getAnnotation());
                final IMarker marker = markerReg.getAnnotation().getMarker();
                IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry().getResolutions(marker);

                if (resolutions.length > 0) {
                    createResolutionsControl(composite, marker, resolutions);
                    // createSeparator( composite );
                }
            } else if (reg instanceof TemporaryRegion) {
                final TemporaryRegion tempReg = (TemporaryRegion) reg;
                createAnnotationInformation(composite, tempReg.getAnnotation());
                final IMarker marker = new TempMarker(tempReg.getAnnotation());

                IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry().getResolutions(marker);

                if (resolutions.length > 0) {
                    createResolutionsControl(composite, marker, resolutions);
                }
            } else if (reg instanceof InfoRegion) {
                String text;

                if ((text = ((InfoRegion) reg).getInfo()) != null) {
                    setInformation(composite, text);
                }
            }
        }

        Point constraints = getSizeConstraints();
        Point contentSize = composite.computeSize(constraints != null ? constraints.x : SWT.DEFAULT,
                SWT.DEFAULT);

        composite.setSize(new Point(contentSize.x, contentSize.y));
    }

    setColorAndFont(parent, parent.getForeground(), parent.getBackground(), JFaceResources.getDialogFont());

    parent.layout(true);
}

From source file:com.maccasoft.composer.InstrumentEditor.java

License:Open Source License

protected Button createButton(Composite parent, int id, String label) {
    ((GridLayout) parent.getLayout()).numColumns++;

    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);/*  w  w w  . j  a  va  2  s  .  c o  m*/
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
    Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    data.widthHint = Math.max(widthHint, minSize.x);
    button.setLayoutData(data);

    return button;
}

From source file:com.mentor.nucleus.bp.core.ui.dialogs.ScrolledTextDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (optionalText != null) {
        ((GridLayout) parent.getLayout()).numColumns++;
        optionalButton = new Button(parent, SWT.CHECK);
        optionalButton.setText(optionalText);
        optionalButton.setFont(JFaceResources.getDialogFont());
        optionalButton.setSelection(false);
        setButtonLayoutData(optionalButton);
    }//from w ww  .  j a  v  a 2  s . c  om
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (allowCancel) {
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    }
}

From source file:com.mercatis.lighthouse3.ui.event.providers.ShowHideDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText("OK");
    button.setFont(JFaceResources.getDialogFont());
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            for (TableColumn column : columnConfiguration.keySet()) {
                Button checkBox = getCheckBoxByName(column.getText());
                if (checkBox != null) {
                    columnConfiguration.put(column, checkBox.getSelection());
                }/*from  ww w  .j  av  a2s  .co m*/
            }
            close();
        }
    });
}

From source file:com.midrange.rse_enhancements.chgmsg.EditMessageTextDialog.java

License:Open Source License

private Font getBoldFont() {

    Font f = JFaceResources.getDialogFont();

    FontData fontData = f.getFontData()[0];
    fontData.setStyle(SWT.BOLD);/*from   w  ww .j a  v  a2  s .co m*/

    Font boldFont = new Font(DISPLAY, fontData);

    return boldFont;
}