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.eclipse.wst.xquery.internal.ui.preferences.PropertyPageUtility.java

License:Open Source License

private static Combo newComboControl(Composite composite, String[] values) {
    Combo comboBox = new Combo(composite, SWT.READ_ONLY);
    comboBox.setItems(values);/*from  w ww. j a  v a  2 s  .c o  m*/
    comboBox.setFont(JFaceResources.getDialogFont());

    return comboBox;
}

From source file:org.eclipse.wst.xsl.ui.internal.preferences.AbstractXSLPreferencePage.java

License:Open Source License

protected Combo createCombo(Composite parent, String label, String prefKey) {
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);

    Label labelControl = new Label(parent, SWT.LEFT);
    labelControl.setFont(JFaceResources.getDialogFont());
    labelControl.setText(label);//from w w  w .j a v  a  2s  .co m
    labelControl.setLayoutData(gd);

    Combo combo = createDropDownBox(parent);
    combo.addSelectionListener(this);
    combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    return combo;
}

From source file:org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected Button addCheckboxWithData(Composite parent, String label, ControlData data, GridData gd) {
    Button checkBox = new Button(parent, SWT.CHECK);
    checkBox.setFont(JFaceResources.getDialogFont());
    checkBox.setText(label);//from   ww  w .  j a v a2s.  c om
    checkBox.setData(data);
    checkBox.setLayoutData(gd);
    checkBox.addSelectionListener(getSelectionListener());
    makeScrollableCompositeAware(checkBox);
    updateCheckBox(checkBox);
    checkBoxes.add(checkBox);
    return checkBox;
}

From source file:org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected Text addTextField(Composite parent, String label, String key, int indent, int widthHint) {
    Label labelControl = new Label(parent, SWT.WRAP);
    labelControl.setText(label);/*from  w ww  .j  a v  a2  s .  co  m*/
    labelControl.setFont(JFaceResources.getDialogFont());
    GridData labelLayoutData = new GridData();
    labelLayoutData.horizontalIndent = indent;
    labelControl.setLayoutData(labelLayoutData);
    Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);
    textBox.setData(key);
    makeScrollableCompositeAware(textBox);
    labels.put(textBox, labelControl);
    updateText(textBox);
    textBox.addModifyListener(getTextModifyListener());

    GridData textLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
    if (widthHint != 0) {
        textLayoutData.widthHint = widthHint;
    }
    textBox.setLayoutData(textLayoutData);
    textBoxes.add(textBox);
    return textBox;
}

From source file:org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected Combo addComboBox(Composite parent, String label, String key, int indent, String[] values,
        String[] valueLabels) {//  w  w  w  .jav a2 s . c o m
    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(SWT.FILL, SWT.CENTER, false, false));

    labels.put(comboBox, labelControl);

    return comboBox;
}

From source file:org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

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

    Combo comboBox = new Combo(composite, SWT.READ_ONLY);
    comboBox.setItems(valueLabels);/*from  w  ww .ja  va  2  s . c om*/
    comboBox.setData(data);
    comboBox.addSelectionListener(getSelectionListener());
    comboBox.setFont(JFaceResources.getDialogFont());
    comboBox.setVisibleItemCount(30);

    makeScrollableCompositeAware(comboBox);

    updateCombo(comboBox);

    comboBoxes.add(comboBox);
    return comboBox;
}

From source file:org.eclipselabs.stlipse.jspeditor.NewBeanclassWizard.java

License:Open Source License

private WizardDialog createWizardDialog(NewClassCreationWizard wizard) {
    Shell shell = Display.getDefault().getActiveShell();
    WizardDialog dialog = new WizardDialog(shell, wizard);
    PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
            converter.convertHeightInCharsToPixels(20));
    dialog.create();/*from w  w  w  .j  ava 2s  .c o m*/
    dialog.getShell().setText("Create New ActionBean");
    return dialog;
}

From source file:org.eclipsetrader.ui.internal.views.Level2View.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    Composite content = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginWidth = gridLayout.marginHeight = 0;
    gridLayout.verticalSpacing = 0;/*from w  ww  . j  a va 2s .co  m*/
    content.setLayout(gridLayout);

    GC gc = new GC(content);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    Composite group = new Composite(content, SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    group.setLayout(new GridLayout(4, false));

    Label label = new Label(group, SWT.NONE);
    label.setText(Messages.Level2View_Symbol);
    symbol = new Text(group, SWT.BORDER);
    symbol.setLayoutData(new GridData(Dialog.convertWidthInCharsToPixels(fontMetrics, 15), SWT.DEFAULT));
    symbol.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            onSetSymbol();
        }
    });
    symbol.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            onSetSymbol();
        }
    });

    final ImageHyperlink connectorButton = new ImageHyperlink(group, SWT.NONE);
    connectorButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    connectorButton.setImage(UIActivator.getDefault().getImageRegistry().get(UIConstants.TOOLBAR_ARROW_RIGHT));
    connectorButton.setToolTipText(Messages.Level2View_SelectDataSource);
    connectorButton.addHyperlinkListener(new IHyperlinkListener() {

        private Menu dropDownMenu;

        @Override
        public void linkActivated(HyperlinkEvent e) {
            if (dropDownMenu != null) {
                dropDownMenu.dispose();
            }

            dropDownMenu = new Menu(connectorButton);
            List<IFeedConnector> c = Arrays.asList(feedService.getConnectors());
            Collections.sort(c, new Comparator<IFeedConnector>() {

                @Override
                public int compare(IFeedConnector o1, IFeedConnector o2) {
                    return o1.getName().compareTo(o2.getName());
                }
            });
            for (IFeedConnector connector : c) {
                if (connector instanceof IFeedConnector2) {
                    MenuItem menuItem = new MenuItem(dropDownMenu, SWT.CHECK);
                    menuItem.setText(connector.getName());
                    menuItem.setData(connector);
                    menuItem.setSelection(Level2View.this.connector == connector);
                    menuItem.addSelectionListener(connectionSelectionListener);
                }
            }
            dropDownMenu.setVisible(true);
        }

        @Override
        public void linkEntered(HyperlinkEvent e) {
        }

        @Override
        public void linkExited(HyperlinkEvent e) {
        }
    });

    activeConnector = new Label(group, SWT.NONE);
    activeConnector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    summaryGroup = createSummary(content);
    if (hideSummaryAction != null) {
        summaryGroup.setVisible(!hideSummaryAction.isChecked());
        ((GridData) summaryGroup.getLayoutData()).exclude = hideSummaryAction.isChecked();
    }

    pressureBar = new PressureBar(content, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.heightHint = 16;
    pressureBar.getControl().setLayoutData(gridData);

    createBookViewer(content);

    if (memento != null) {
        String s = memento.getString("symbol"); //$NON-NLS-1$
        if (s != null) {
            symbol.setText(s);
            ISecurity security = getSecurityFromSymbol(s);
            if (security != null) {
                getSite().getSelectionProvider().setSelection(new StructuredSelection(security));
                setPartName(security.getName());
                setTitleToolTip(NLS.bind(VIEW_TITLE_TOOLTIP, new Object[] { security.getName() }));
            }
        }

        String id = memento.getString("connector"); //$NON-NLS-1$
        if (id != null) {
            IFeedConnector connector = feedService.getConnector(id);
            if (connector == null) {
                connector = CoreActivator.getDefault().getDefaultConnector();
            }
            if (connector instanceof IFeedConnector2) {
                this.connector = (IFeedConnector2) connector;
                activeConnector.setText(this.connector.getName());
            }
        }

        if (s != null && connector != null) {
            subscription = this.connector.subscribeLevel2(s);

            subscription.addSubscriptionListener(subscriptionListener);

            lastClose = subscription.getLastClose();
            lastTrade = subscription.getTrade();
            update(subscription.getTodayOHL());
            update();
        }
    }

    Display.getDefault().timerExec(100, bookUpdateRunnable);
}

From source file:org.elbe.relations.internal.forms.AbstractEditForm.java

License:Open Source License

protected int convertWidthInCharsToPixels(final Control inTestControl, final int inCharsNumber) {
    if (fontMetrics == null) {
        final GC lGC = new GC(inTestControl);
        lGC.setFont(JFaceResources.getDialogFont());
        fontMetrics = lGC.getFontMetrics();
        lGC.dispose();/* w ww  .j a  va2 s .  c o  m*/
    }
    return Dialog.convertWidthInCharsToPixels(fontMetrics, inCharsNumber);
}

From source file:org.emftext.language.xpath2.resource.xpath2.ui.Xpath2BrowserInformationControl.java

License:Open Source License

/**
 * /*from   w  ww  .  j a v  a2s.  c  om*/
 * @see
 * org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int,
 * int)
 */
public Point computeSizeConstraints(int widthInChars, int heightInChars) {
    if (fSymbolicFontName == null) {
        return null;
    }

    GC gc = new GC(fBrowser);
    Font font = fSymbolicFontName == null ? JFaceResources.getDialogFont()
            : JFaceResources.getFont(fSymbolicFontName);
    gc.setFont(font);
    int width = gc.getFontMetrics().getAverageCharWidth();
    int height = gc.getFontMetrics().getHeight();
    gc.dispose();

    return new Point(widthInChars * width, heightInChars * height);
}