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.osee.ote.ui.define.importer.OutfileImportPage.java

License:Open Source License

private Button createButton(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);/*w  ww .  ja  v  a 2  s . com*/
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    setButtonLayoutData(button);
    return button;
}

From source file:org.eclipse.papyrus.profile.ui.dialogs.ChooseSetAssistedDialog.java

License:Open Source License

/**
 * Apply Font to elements that display text.
 *//*from w w w  . j  a va2  s.c  om*/
private void setFonts() {
    // FontData[] fontdata={new FontData("Arial", 9, SWT.NORMAL)};
    selectedElementsLabel.setFont(JFaceResources.getDialogFont());
    selectedElementsTable.setFont(JFaceResources.getDialogFont());
    possibleElementsLabel.setFont(JFaceResources.getDialogFont());
    possibleElementsTable.setFont(JFaceResources.getDialogFont());
}

From source file:org.eclipse.pde.api.tools.ui.internal.ApiToolsLabelProvider.java

License:Open Source License

@Override
public Font getFont(Object element) {
    if (isDefaultBaseline(element)) {
        if (font == null) {
            Font dialogFont = JFaceResources.getDialogFont();
            FontData[] fontData = dialogFont.getFontData();
            for (int i = 0; i < fontData.length; i++) {
                FontData data = fontData[i];
                data.setStyle(SWT.BOLD);
            }/*from   w  ww.j  a va  2  s .  com*/
            Display display = ApiUIPlugin.getShell().getDisplay();
            font = new Font(display, fontData);
        }
        return font;
    }
    return null;
}

From source file:org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.java

License:Open Source License

protected Button addCheckBox(Composite parent, String label, Key key, String[] values, int indent) {
    ControlData data = new ControlData(key, values);
    Font dialogFont = JFaceResources.getDialogFont();

    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 3;/*from  w w w . j ava2s . c  o m*/
    gd.horizontalIndent = convertWidthInCharsToPixels(dialogFont, indent);

    Button checkBox = new Button(parent, SWT.CHECK);
    checkBox.setFont(dialogFont);
    checkBox.setText(label);
    checkBox.setData(data);
    checkBox.setLayoutData(gd);
    checkBox.addSelectionListener(this.selectionlistener);

    String currValue = null;
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=280619
    // only look up the project and default scopes if the project
    // already contains project-specific settings
    if (hasProjectSpecificSettings(fProject)) {
        currValue = key.getStoredValue(
                new IScopeContext[] { new ProjectScope(fProject), DefaultScope.INSTANCE }, false, fManager);
    } else {
        currValue = key.getStoredValue(fLookupOrder, false, fManager);
    }
    checkBox.setSelection(data.getSelection(currValue) == 0);
    fCheckBoxes.add(checkBox);
    return checkBox;
}

From source file:org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.java

License:Open Source License

/**
 * Initializes the group of EE meta-data that is installed
 * /*from  w  ww  . java2 s  . c  o  m*/
 * @param parent
 */
private void initializeInstalledMetatadata(final Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 2, 2, GridData.FILL_HORIZONTAL, 0, 0);
    GridData gd = (GridData) comp.getLayoutData();
    gd.horizontalIndent = 15;
    Group group = SWTFactory.createGroup(comp,
            PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees, 3, 3, GridData.FILL_BOTH);
    String[] stubs = StubApiComponent.getInstalledMetadata();
    this.fSystemLibraryControls = new ArrayList<Control>(stubs.length + 1);
    this.fSystemLibraryControls.add(group);
    boolean installMore = (stubs.length < ProfileModifiers.getAllIds().length);
    if (stubs.length == 0) {
        SWTFactory.createVerticalSpacer(group, 1);
        this.fSystemLibraryControls.add(SWTFactory.createLabel(group,
                PreferenceMessages.ApiErrorsWarningsConfigurationBlock_no_ees_installed,
                JFaceResources.getDialogFont(), 1));
    } else {
        for (int i = 0; i < stubs.length; i++) {
            this.fSystemLibraryControls
                    .add(SWTFactory.createLabel(group, stubs[i], JFaceResources.getDialogFont(), 1));
        }
    }
    if (installMore) {
        ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
        final Command command = commandService.getCommand(P2_INSTALL_COMMAND_HANDLER);
        if (command.isHandled()) {
            String linkedName = PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_link_label;
            if (stubs.length == 0) {
                linkedName = PreferenceMessages.install_ee_descriptions;
            }
            SWTFactory.createVerticalSpacer(group, 1);
            Link link = SWTFactory.createLink(group, linkedName, JFaceResources.getDialogFont(), 3);
            link.setToolTipText(
                    PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_tooltip);
            link.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    IHandlerService handlerService = PlatformUI.getWorkbench()
                            .getService(IHandlerService.class);
                    try {
                        handlerService.executeCommand(P2_INSTALL_COMMAND_HANDLER, null);
                    } catch (@SuppressWarnings("unused") ExecutionException ex) {
                        handleCommandException();
                    } catch (@SuppressWarnings("unused") NotDefinedException ex) {
                        handleCommandException();
                    } catch (@SuppressWarnings("unused") NotEnabledException ex) {
                        handleCommandException();
                    } catch (@SuppressWarnings("unused") NotHandledException ex) {
                        handleCommandException();
                    }
                }
            });
            this.fSystemLibraryControls.add(link);
        }
    }
}

From source file:org.eclipse.pde.api.tools.ui.internal.wizards.CompareToBaselineWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_HORIZONTAL);
    setControl(comp);/*www .  ja  v  a  2 s  . c  o  m*/

    SWTFactory.createLabel(comp, ActionMessages.SelectABaseline, 1);
    this.baselinecombo = SWTFactory.createCombo(comp, SWT.BORDER | SWT.FLAT | SWT.READ_ONLY, 1,
            GridData.FILL_HORIZONTAL, null);
    this.baselinecombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            Combo combo = (Combo) e.widget;
            String[] baselineNames = (String[]) combo.getData();
            String selectedBaselineName = baselineNames[combo.getSelectionIndex()];
            CompareToBaselineWizardPage.this.baselineName = selectedBaselineName;
            setPageComplete(isPageComplete());
        }
    });
    this.link = SWTFactory.createLink(comp, ActionMessages.AddNewBaseline, JFaceResources.getDialogFont(), 1,
            GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IAdaptable element = getAdaptable();
            if (element == null) {
                return;
            }
            CompareToBaselineWizardPage.this.baselineName = null;
            SWTFactory.showPreferencePage(getShell(), ApiBaselinePreferencePage.ID, element);
            initialize();
            setPageComplete(isPageComplete());
        }
    });
    link.setToolTipText(ActionMessages.CompareToBaselineWizardPage_open_baseline_pref_page);
    // do initialization
    initialize();
    getShell().pack();
    PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IApiToolsHelpContextIds.API_COMPARE_WIZARD_PAGE);
}

From source file:org.eclipse.php.internal.ui.wizards.fields.LayoutUtil.java

License:Open Source License

public static int getButtonWidthHint(final 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:org.eclipse.rcptt.ui.editors.ecl.EclInformationContol.java

License:Open Source License

public static String applyStyling(String html) {
    String styles = loadStyles();
    FontData fontData = JFaceResources.getDialogFont().getFontData()[0];
    styles = HTMLPrinter.convertTopLevelFont(styles, fontData);

    StringBuffer b = new StringBuffer(html);
    b.insert(0, "</style></head><body>");
    b.insert(0, styles);/* w w w.j  a  v a 2 s.c o m*/
    b.insert(0, "<html><head><style type=\"text/css\">");
    b.append("</body></html>");

    return b.toString();
}

From source file:org.eclipse.rcptt.ui.history.ListDialogField.java

License:Open Source License

protected Button createButton(Composite parent, String label, SelectionListener listener) {
    Button button = new Button(parent, SWT.PUSH);
    button.setFont(parent.getFont());//from  ww  w.j  av  a2  s .com
    button.setText(label);
    button.addSelectionListener(listener);
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = GridData.BEGINNING;

    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int wh = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    gd.widthHint = Math.max(wh, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);

    button.setLayoutData(gd);

    return button;
}

From source file:org.eclipse.rcptt.ui.panels.assertion.AssertionPanelWindow.java

License:Open Source License

@Override
protected void initializeDialogUnits(Control control) {
    // Compute and store a font metric
    Shell sh = new Shell(control.getDisplay());
    // sh.open();
    sh.setVisible(false);/*from ww  w . j  a v  a 2  s  . co  m*/
    GC gc = new GC(sh);
    gc.setFont(JFaceResources.getDialogFont());
    fontMetrics = gc.getFontMetrics();
    gc.dispose();
    sh.dispose();
}