Example usage for org.eclipse.jface.preference FontFieldEditor FontFieldEditor

List of usage examples for org.eclipse.jface.preference FontFieldEditor FontFieldEditor

Introduction

In this page you can find the example usage for org.eclipse.jface.preference FontFieldEditor FontFieldEditor.

Prototype

public FontFieldEditor(String name, String labelText, String previewAreaText, Composite parent) 

Source Link

Document

Creates a font field editor with an optional preview area.

Usage

From source file:ch.elexis.core.ui.preferences.FontPreference.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new FontFieldEditor(Preferences.USR_DEFAULTFONT, Messages.FontPreference_standardschriftart,
            "Elexis", getFieldEditorParent())); //$NON-NLS-1$
}

From source file:ch.elexis.preferences.FontPreference.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new FontFieldEditor(PreferenceConstants.USR_DEFAULTFONT,
            Messages.FontPreference_standardschriftart, "Elexis", getFieldEditorParent())); //$NON-NLS-1$
}

From source file:com.astra.ses.spell.gui.preferences.ui.pages.FontsPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    // TODO Auto-generated method stub
    m_colorSelectors = new FontFieldEditor[FontKey.values().length];
    Composite parent = getFieldEditorParent();
    for (FontKey key : FontKey.values()) {
        FontFieldEditor selector = new FontFieldEditor(key.getPreferenceName(), key.description, TEST_TEXT,
                parent);/*from  www .  j ava  2 s . c om*/
        m_colorSelectors[key.ordinal()] = selector;
        addField(selector);
    }
}

From source file:de.byteholder.geoclipse.preferences.PrefPageMap.java

License:Open Source License

private Composite createUI(final Composite parent) {

    final IPreferenceStore prefStore = getPreferenceStore();

    final Composite container = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
    GridLayoutFactory.fillDefaults().applyTo(container);
    {//from w ww  .j  a va 2s  . c o  m
        final Composite infoContainer = new Composite(container, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, false).applyTo(infoContainer);
        GridLayoutFactory.fillDefaults().applyTo(infoContainer);
        {

            // checkbox: show tile info
            _chkShowTileInfo = new BooleanFieldEditor(IMappingPreferences.SHOW_MAP_TILE_INFO,
                    Messages.pref_map_show_tile_info, infoContainer);
            _chkShowTileInfo.setPreferenceStore(prefStore);
            _chkShowTileInfo.setPage(this);
            _chkShowTileInfo.load();
        }

        final Composite fontContainer = new Composite(container, SWT.NONE);
        GridDataFactory.fillDefaults().indent(0, 20).grab(true, false).applyTo(fontContainer);
        GridLayoutFactory.fillDefaults().applyTo(fontContainer);
        {
            // font: mono space
            _monoFontEditor = new FontFieldEditor(IMappingPreferences.THEME_FONT_LOGGING,
                    Messages.Theme_Font_Logging, Messages.Theme_Font_Logging_PREVIEW_TEXT, fontContainer);
            _monoFontEditor.setPreferenceStore(prefStore);
            _monoFontEditor.setPage(this);
            _monoFontEditor.load();
        }
        // force 2 columns
        final GridLayout gl = (GridLayout) fontContainer.getLayout();
        gl.numColumns = 2;
        gl.makeColumnsEqualWidth = true;
    }

    return container;
}

From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewerPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;//from  w  w w . j  a  v  a2  s  .  co m
    gl.marginWidth = 0;
    parent.setLayout(gl);
    Composite page = new Composite(parent, SWT.NONE);
    GridLayout pageLayout = new GridLayout();
    pageLayout.numColumns = 2;
    GridData pageLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    page.setLayoutData(pageLayoutdata);
    page.setLayout(pageLayout);

    fTooltip = new BooleanFieldEditor(ISDPreferences.PREF_TOOLTIP, Messages.SequenceDiagram_ShowTooltips, page);
    fTooltip.setPreferenceStore(fPreferences.getPreferenceStore());
    fTooltip.load();

    // link font with zoom pref
    fLink = new BooleanFieldEditor(ISDPreferences.PREF_LINK_FONT,
            Messages.SequenceDiagram_IncreaseFontSizeWhenZooming, page);
    fLink.setPreferenceStore(fPreferences.getPreferenceStore());
    fLink.load();

    fNoExternalTime = new BooleanFieldEditor(ISDPreferences.PREF_EXCLUDE_EXTERNAL_TIME,
            Messages.SequenceDiagram_ExcludeExternalTime, page);
    fNoExternalTime.setPreferenceStore(fPreferences.getPreferenceStore());
    fNoExternalTime.load();

    // use gradient color pref
    fUseGrad = new BooleanFieldEditor(ISDPreferences.PREF_USE_GRADIENT,
            Messages.SequenceDiagram_UseGradientColor, page);
    fUseGrad.setPreferenceStore(fPreferences.getPreferenceStore());
    fUseGrad.load();

    Label separator = new Label(page, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    GridData sepData = new GridData(
            GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    separator.setLayoutData(sepData);

    Composite prefPage = new Composite(page, SWT.NONE);
    GridLayout prefPageLayout = new GridLayout();
    prefPage.setLayoutData(pageLayoutdata);
    prefPageLayout.numColumns = 1;
    prefPage.setLayout(prefPageLayout);

    // swimLane width pref
    fLifelineWidth = new IntegerFieldEditor(ISDPreferences.PREF_LIFELINE_WIDTH,
            Messages.SequenceDiagram_LifelineWidth, prefPage);
    fLifelineWidth.setPreferenceStore(fPreferences.getPreferenceStore());
    fLifelineWidth.setValidRange(119, 500);
    fLifelineWidth.load();

    // not very nice
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);

    // Font list pref
    fClassItemList = new List(prefPage, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData tabItemLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fClassItemList.setLayoutData(tabItemLayoutdata);

    String[] fontList2 = SDViewPref.getFontList2();
    for (int i = 0; i < fontList2.length; i++) {
        fClassItemList.add(fontList2[i]);
    }
    fClassItemList.setSelection(0);
    fClassItemList.addSelectionListener(this);
    fButtonArea = new Composite(prefPage, SWT.NONE);
    GridData tabItemLayoutdata2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL
            /* |GridData.GRAB_HORIZONTAL */ | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fButtonArea.setLayoutData(tabItemLayoutdata2);
    GridLayout buttonAreaLayout = new GridLayout();
    buttonAreaLayout.numColumns = 1;
    fButtonArea.setLayout(buttonAreaLayout);

    // font selector initialise for the lifeline font pref
    String[] fontList = SDViewPref.getFontList();
    fFont = new FontFieldEditor(fontList[0], "", //$NON-NLS-1$
            Messages.SequenceDiagram_AaBbYyZz, fButtonArea);
    fFont.getPreviewControl().setSize(500, 500);
    fFont.setPreferenceStore(fPreferences.getPreferenceStore());
    fFont.load();

    fBackGroundColor = new ColorFieldEditor(fontList[0] + SDViewPref.BACK_COLOR_POSTFIX,
            Messages.SequenceDiagram_Background, fButtonArea);
    fBackGroundColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fBackGroundColor.load();

    fLineColor = new ColorFieldEditor(fontList[0] + SDViewPref.FORE_COLOR_POSTFIX,
            Messages.SequenceDiagram_Lines, fButtonArea);
    fLineColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fLineColor.load();

    fTextColor = new ColorFieldEditor(fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX,
            Messages.SequenceDiagram_Text, fButtonArea);
    fTextColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fTextColor.load();
    swapPref(true);
    Dialog.applyDialogFont(page);

    return page;
}

From source file:net.tourbook.photo.internal.preferences.PrefPagePhotoDirectory.java

License:Open Source License

private void createUI_12_Gallery(final Composite parent) {

    final Group group = new Group(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
    GridLayoutFactory.swtDefaults().applyTo(group);
    group.setText(Messages.PrefPage_Photo_Viewer_Group_PhotoGallery);
    {//from w  w w .j a  va2  s  .c  o  m
        /*
         * text min size
         */
        createUI_14_MinSize(group);

        /*
         * gallery font
         */
        _galleryFontEditor = new FontFieldEditor(IPhotoPreferences.PHOTO_VIEWER_FONT, //
                Messages.PrefPage_Photo_Viewer_Label_FontEditor,
                Messages.PrefPage_Photo_Viewer_Label_FontExample, group);
        _galleryFontEditor.setPreferenceStore(_prefStore);
        _galleryFontEditor.setPage(this);
        _galleryFontEditor.load();
        _galleryFontEditor.setPropertyChangeListener(this);
    }

    // force 2 columns
    final GridLayout gl = (GridLayout) group.getLayout();
    gl.numColumns = 2;
    gl.marginWidth = 5;
    gl.marginHeight = 5;
    gl.makeColumnsEqualWidth = true;
}

From source file:net.yatomiya.nicherry.ui.preference.ThreadViewPage.java

License:Open Source License

@Override
public void createFieldEditors() {
    CompositeField rootField = getRootCompositeField();

    rootField.addField(new FontFieldEditor(NPreferences.MESSAGE_VIEWER_FONT_PROPOTIONAL, "",
            " ABC abc", rootField.getControl()));
    /*//from w ww  . j  a  v a 2  s .com
            rootField.addField(new FontFieldEditor(
                       NPreferences.MESSAGE_VIEWER_FONT_MONOSPACE,
                       "?",
                       " ABC abc",
                       rootField.getControl()));
    */
    rootField.addField(new ColorFieldEditor(NPreferences.MESSAGE_VIEWER_COLOR_FOREGROUND, "",
            rootField.getControl()));
    rootField.addField(new ColorFieldEditor(NPreferences.MESSAGE_VIEWER_COLOR_BACKGROUND, "",
            rootField.getControl()));

    rootField.addField(LabelField.createSeparatorField(rootField.getControl()));

    rootField.addField(new FontFieldEditor(NPreferences.POST_MESSAGE_PANEL_FONT,
            "??", " ABC abc", rootField.getControl()));
    rootField.addField(new BooleanFieldEditor(NPreferences.THREAD_VIEW_UPDATE_WHEN_OPEN_VIEW,
            "???????", rootField.getControl()));
    rootField.addField(new SpinnerFieldEditor(NPreferences.MESSAGE_VIEWER_HOVER_DELAY_TIME,
            "???????",
            rootField.getControl(), 0, 1000 * 60, 1, 1000));
    rootField.addField(new SpinnerFieldEditor(NPreferences.THREAD_VIEW_POST_PANEL_HEIGHT,
            "????", rootField.getControl(), 1, 4096, 1, 10));
    rootField.addField(new SpinnerFieldEditor(NPreferences.POST_MESSAGE_PANEL_WAIT_TIME,
            "????", rootField.getControl(), 0, 60 * 60, 1, 10));
    rootField.addField(new StringFieldEditor(NPreferences.POST_MESSAGE_PANEL_QUOTE_PREFIX, "",
            rootField.getControl()));
}

From source file:org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewerPage.java

License:Open Source License

/**
 * Creates the Sequence Diagram preference page content
 * /*from  w  w w  .j a va 2 s  .  co m*/
 * @param parent the parent composite
 */
@Override
protected Control createContents(Composite parent) {
    parent.setLayout(new GridLayout());
    Composite page = new Composite(parent, SWT.NONE);
    GridLayout pageLayout = new GridLayout();
    pageLayout.numColumns = 2;
    GridData pageLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    page.setLayoutData(pageLayoutdata);
    page.setLayout(pageLayout);

    tooltip = new BooleanFieldEditor(SDViewPref.PREF_TOOLTIP, SDMessages._97, page);
    tooltip.setPreferenceStore(pref.getPreferenceStore());
    tooltip.load();

    // link font with zoom pref
    link = new BooleanFieldEditor(SDViewPref.PREF_LINK_FONT, SDMessages._82, page);
    link.setPreferenceStore(pref.getPreferenceStore());
    link.load();

    noExternalTime = new BooleanFieldEditor(SDViewPref.PREF_EXCLUDE_EXTERNAL_TIME, SDMessages._83, page);
    noExternalTime.setPreferenceStore(pref.getPreferenceStore());
    noExternalTime.load();

    // use gradient color pref
    useGrad = new BooleanFieldEditor(SDViewPref.PREF_USE_GRADIENT, SDMessages._84, page);
    useGrad.setPreferenceStore(pref.getPreferenceStore());
    useGrad.load();

    Label separator = new Label(page, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    GridData sepData = new GridData(
            GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    separator.setLayoutData(sepData);

    Composite prefPage = new Composite(page, SWT.NONE);
    GridLayout prefPageLayout = new GridLayout();
    prefPage.setLayoutData(pageLayoutdata);
    prefPageLayout.numColumns = 1;
    prefPage.setLayout(prefPageLayout);

    // swimLane width pref
    lifelineWidth = new IntegerFieldEditor(SDViewPref.PREF_LIFELINE_WIDTH, SDMessages._80, prefPage);
    lifelineWidth.setPreferenceStore(pref.getPreferenceStore());
    lifelineWidth.setValidRange(119, 500);
    lifelineWidth.load();

    // not very nice
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);

    // Font list pref
    classItemList = new List(prefPage, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData tabItemLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    classItemList.setLayoutData(tabItemLayoutdata);

    String[] fontList2 = SDViewPref.getFontList2();
    for (int i = 0; i < fontList2.length; i++) {
        classItemList.add(fontList2[i]);
    }
    classItemList.setSelection(0);
    classItemList.addSelectionListener(this);
    buttonArea = new Composite(prefPage, SWT.NONE);
    GridData tabItemLayoutdata2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL
            /* |GridData.GRAB_HORIZONTAL */ | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    buttonArea.setLayoutData(tabItemLayoutdata2);
    GridLayout buttonAreaLayout = new GridLayout();
    buttonAreaLayout.numColumns = 1;
    buttonArea.setLayout(buttonAreaLayout);

    // font selector initialise for the lifeline font pref
    String[] fontList = SDViewPref.getFontList();
    font = new FontFieldEditor(fontList[0], "", //$NON-NLS-1$
            SDMessages._81, buttonArea);
    font.getPreviewControl().setSize(500, 500);
    font.setPreferenceStore(pref.getPreferenceStore());
    font.load();

    backGroundColor = new ColorFieldEditor(fontList[0] + SDViewPref.BACK_COLOR_POSTFIX, SDMessages._85,
            buttonArea);
    backGroundColor.setPreferenceStore(pref.getPreferenceStore());
    backGroundColor.load();

    lineColor = new ColorFieldEditor(fontList[0] + SDViewPref.FORE_COLOR_POSTFIX, SDMessages._86, buttonArea);
    lineColor.setPreferenceStore(pref.getPreferenceStore());
    lineColor.load();

    textColor = new ColorFieldEditor(fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX, SDMessages._87, buttonArea);
    textColor.setPreferenceStore(pref.getPreferenceStore());
    textColor.load();
    swapPref(true);
    Dialog.applyDialogFont(page);

    return page;
}

From source file:org.eclipse.ptp.internal.rdt.editor.preferences.PrintPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    addField(new BooleanFieldEditor(LINE_NUMBER_KEY, PreferenceMessages.LineNumbers, parent));
    addField(new FontFieldEditor(FONT_KEY, PreferenceMessages.Font, SAMPLE, parent));
    addField(new HeaderFooterFieldEditor(parent));
}

From source file:org.eclipse.ui.tests.dialogs.FontFieldEditorTestPreferencePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 *//*w  w w . j a v  a  2  s  .co  m*/
protected void createFieldEditors() {

    Composite feParent = getFieldEditorParent();

    for (int i = 0; i < 3; i++) {
        //Create one with a preview
        addField(new FontFieldEditor("FontValue" + String.valueOf(i), "Font Test" + String.valueOf(i),
                "Preview", feParent));

        //Create one without
        addField(new FontFieldEditor("FontValueDefault" + String.valueOf(i),
                "Font Test Default" + String.valueOf(i), feParent));
    }

}