Example usage for org.eclipse.jface.resource JFaceResources TEXT_FONT

List of usage examples for org.eclipse.jface.resource JFaceResources TEXT_FONT

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources TEXT_FONT.

Prototype

String TEXT_FONT

To view the source code for org.eclipse.jface.resource JFaceResources TEXT_FONT.

Click Source Link

Document

The symbolic font name for the text font (value "org.eclipse.jface.textfont").

Usage

From source file:org.apache.directory.studio.schemaeditor.view.dialogs.MessageDialogWithTextarea.java

License:Apache License

@Override
protected Control createCustomArea(Composite parent) {
    textArea = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
    textArea.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels((int) (IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2));
    gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 4);
    textArea.setLayoutData(gd);/*from   w  w  w .  j a v  a2s .c  o  m*/
    //textArea.setBackground( parent.getBackground() );
    textArea.setText(detailMessage);

    return textArea;
}

From source file:org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditorSourceCodePage.java

License:Apache License

/**
 * {@inheritDoc}/*from w  w w .ja va 2 s  .com*/
 */
protected void createFormContent(IManagedForm managedForm) {
    super.createFormContent(managedForm);

    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    form.getBody().setLayout(layout);
    toolkit.paintBordersFor(form.getBody());

    // SOURCE CODE Field
    schemaSourceViewer = new SchemaSourceViewer(form.getBody(), null, null, false,
            SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 10;
    schemaSourceViewer.getTextWidget().setLayoutData(gd);

    // set text font
    Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
    schemaSourceViewer.getTextWidget().setFont(font);

    IDocument document = new Document();
    schemaSourceViewer.setDocument(document);

    // Initialization from the "input" attribute type
    fillInUiFields();

    // Listeners initialization
    addListeners();

    // Help Context for Dynamic Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(form,
            PluginConstants.PLUGIN_ID + "." + "attribute_type_editor"); //$NON-NLS-1$ //$NON-NLS-2$

    initialized = true;
}

From source file:org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditorSourceCodePage.java

License:Apache License

/**
 * {@inheritDoc}/*  ww w . j  a va 2 s .co m*/
 */
protected void createFormContent(IManagedForm managedForm) {
    super.createFormContent(managedForm);

    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    form.getBody().setLayout(layout);
    toolkit.paintBordersFor(form.getBody());

    // SOURCE CODE Field
    schemaSourceViewer = new SchemaSourceViewer(form.getBody(), null, null, false,
            SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 10;
    schemaSourceViewer.getTextWidget().setLayoutData(gd);

    // set text font
    Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
    schemaSourceViewer.getTextWidget().setFont(font);

    IDocument document = new Document();
    schemaSourceViewer.setDocument(document);

    // Initialization from the "input" object class
    fillInUiFields();

    // Listeners initialization
    addListeners();

    // Help Context for Dynamic Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(form,
            PluginConstants.PLUGIN_ID + "." + "object_class_editor"); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:org.apache.directory.studio.schemaeditor.view.editors.schema.SchemaEditorSourceCodePage.java

License:Apache License

/**
 * {@inheritDoc}//from   w  ww  .  j av a  2 s.c  o  m
 */
protected void createFormContent(IManagedForm managedForm) {
    schema = ((SchemaEditor) getEditor()).getSchema();

    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    GridLayout layout = new GridLayout();
    form.getBody().setLayout(layout);
    toolkit.paintBordersFor(form.getBody());

    // SOURCE CODE Field
    schemaSourceViewer = new SchemaSourceViewer(form.getBody(), null, null, false,
            SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 10;
    schemaSourceViewer.getTextWidget().setLayoutData(gd);
    schemaSourceViewer.getTextWidget().setEditable(false);

    // set text font
    Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
    schemaSourceViewer.getTextWidget().setFont(font);

    IDocument document = new Document();
    schemaSourceViewer.setDocument(document);

    // Initializes the UI from the schema
    fillInUiFields();

    // Help Context for Dynamic Help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(form, PluginConstants.PLUGIN_ID + "." + "schema_editor"); //$NON-NLS-1$ //$NON-NLS-2$

    initialized = true;
}

From source file:org.cfeclipse.cfml.preferences.CFPreviewerUpdater.java

License:Open Source License

/**
 * Creates a source preview updater for the given viewer, configuration and preference store.
 *
 * @param viewer the viewer//from  w w w  .  j av  a 2 s.  c om
 * @param configuration the configuration
 * @param preferenceStore the preference store
 */
public CFPreviewerUpdater(final SourceViewer viewer, final CFConfiguration configuration,
        final IPreferenceStore preferenceStore) {

    initializeViewerColors(viewer, preferenceStore);

    final IPropertyChangeListener fontChangeListener = new IPropertyChangeListener() {
        /*
         * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
         */
        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(JFaceResources.TEXT_FONT)) {
                Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
                viewer.getTextWidget().setFont(font);
            }
        }
    };
    final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
        /*
         * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
         */
        public void propertyChange(PropertyChangeEvent event) {

            String property = event.getProperty();

            if (AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND.equals(property)
                    || AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property)
                    || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND.equals(property)
                    || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)
                    || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND.equals(property)
                    || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT.equals(property)
                    || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND.equals(property)
                    || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT
                            .equals(property)) {
                initializeViewerColors(viewer, preferenceStore);
            }

            /*
                        if (configuration.affectsTextPresentation(event)) {
                           configuration.adaptToPreferenceChange(event);
                           viewer.invalidateTextPresentation();
                        }
             */

            if (FormattingPreferences.affectsFormatting(event)) {
                format(viewer, preferenceStore);
            }
        }

        /**
         * @param viewer
         * @param preferenceStore
         */
        private void format(final SourceViewer sourceViewer, final IPreferenceStore store) {
            String contents = loadPreviewContentFromFile("FormatPreviewCode.txt");
            FormattingPreferences prefs = new FormattingPreferences();
            prefs.setPreferenceStore(store);
            CFMLFormattingStrategy formatter = new CFMLFormattingStrategy();
            contents = formatter.format(contents, prefs, "", false);
            viewer.getDocument().set(contents);
        }
    };
    viewer.getTextWidget().addDisposeListener(new DisposeListener() {
        /*
         * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
         */
        public void widgetDisposed(DisposeEvent e) {
            preferenceStore.removePropertyChangeListener(propertyChangeListener);
            JFaceResources.getFontRegistry().removeListener(fontChangeListener);
        }
    });
    JFaceResources.getFontRegistry().addListener(fontChangeListener);
    preferenceStore.addPropertyChangeListener(propertyChangeListener);
}

From source file:org.cfeclipse.cfml.preferences.CodeFormatterPreferencePage.java

License:Open Source License

private Control createPreviewer(Composite parent) {
    fPreviewViewer = new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    fEditor = new CFMLEditor();
    ColorManager colorMan = new ColorManager();
    CFConfiguration configuration = new CFConfiguration(colorMan, fEditor);

    fPreviewViewer.configure(configuration);
    fPreviewViewer.setEditable(false);//from   w w  w.j  av  a2  s.  com
    Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
    fPreviewViewer.getTextWidget().setFont(font);

    IPreferenceStore store = new ChainedPreferenceStore(
            new IPreferenceStore[] { getOverlayStore(), EditorsUI.getPreferenceStore() });
    fPreviewerUpdater = new CFPreviewerUpdater(fPreviewViewer, configuration, store);

    String content = loadPreviewContentFromFile("FormatPreviewCode.txt"); //$NON-NLS-1$
    content = formatContent(content, store);
    //IDocument document = new Document(content);       
    ICFDocument document = new ICFDocument(content);
    new CFDocumentSetupParticipant().setup(document);
    fPreviewViewer.setDocument(document);

    return fPreviewViewer.getControl();
}

From source file:org.codehaus.groovy.eclipse.debug.ui.EnsureJUnitFont.java

License:Apache License

public void propertyChange(PropertyChangeEvent event) {
    if (event.getProperty().equals(PreferenceConstants.GROOVY_JUNIT_MONOSPACE_FONT)
            || event.getProperty().equals(JFaceResources.TEXT_FONT)
            || event.getProperty().equals(JFaceResources.DEFAULT_FONT)) {
        maybeForceMonospaceFont();//from  w  w  w  .  j av  a 2  s  .co  m
    }
}

From source file:org.daveware.passwordmakerapp.gui.GuiMain.java

License:Open Source License

protected void setupFonts() {
    // Clone the font of the accountFilterText widget
    Font stockFont = accountFilterText.getFont();
    FontData[] fdItalics = display.getSystemFont().getFontData();

    // Default OSX font doesn't support italics (on my system)
    if (Utilities.isMac()) {
        italicsSearchFont = new Font(display, fdItalics[0].getName(), fdItalics[0].getHeight(), 0);
    } else {//from www .j a va2s.  c  o  m
        italicsSearchFont = new Font(display, fdItalics[0].getName(), fdItalics[0].getHeight(), SWT.ITALIC);
    }

    regularSearchFont = new Font(display, stockFont.getFontData());
    accountFilterText.setFont(italicsSearchFont);

    int fontSize = cmdLineSettings.fontSize > 0 ? cmdLineSettings.fontSize : 14;
    if (cmdLineSettings.pwFont != null) {
        passwordFont = new Font(Display.getCurrent(), cmdLineSettings.pwFont, fontSize, SWT.BOLD);
    } else {
        passwordFont = new Font(Display.getCurrent(),
                JFaceResources.getFont(JFaceResources.TEXT_FONT).getFontData()[0].getName(), fontSize,
                SWT.BOLD);
    }
}

From source file:org.deidentifier.arx.gui.view.impl.menu.DialogDebug.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite parent) {
    parent.setLayout(new GridLayout());

    // License/*w  w w.  j  av a  2s .co  m*/
    data = new Text(parent, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    data.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    data.setText(controller.getDebugData());
    final GridData d = SWTUtil.createFillGridData();
    d.heightHint = 200;
    d.grabExcessVerticalSpace = true;
    data.setLayoutData(d);

    return parent;
}

From source file:org.destecs.ide.ui.editor.impl.CoSimMultiPageEditor.java

License:Open Source License

void createPage3() {
    Composite composite = new Composite(getContainer(), SWT.NONE);
    FillLayout layout = new FillLayout();
    composite.setLayout(layout);// ww  w. jav  a  2s . c om
    text3 = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
    text3.setEditable(false);

    int index = addPage(composite);
    setPageText(index, "Overview");
    IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
    ITheme currentTheme = themeManager.getCurrentTheme();

    FontRegistry fontRegistry = currentTheme.getFontRegistry();
    text3.setFont(fontRegistry.get(JFaceResources.TEXT_FONT));
    text3.addFocusListener(new FocusListener() {

        public void focusLost(FocusEvent e) {
        }

        public void focusGained(FocusEvent e) {
            text3.setText(getOverviewDescription());
        }
    });
}