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.summer.sdt.internal.ui.JavaPlugin.java

License:Open Source License

/**
 * Installs backwards compatibility for the preference store.
 *///from   ww  w  . j  a v  a  2 s .c om
private void ensurePreferenceStoreBackwardsCompatibility() {

    IPreferenceStore store = getPreferenceStore();

    // must add here to guarantee that it is the first in the listener list
    fMembersOrderPreferenceCache = new MembersOrderPreferenceCache();
    fMembersOrderPreferenceCache.install(store);

    /*
     * Installs backwards compatibility: propagate the Java editor font from a
     * pre-2.1 plug-in to the Platform UI's preference store to preserve
     * the Java editor font from a pre-2.1 workspace. This is done only
     * once.
     */
    String fontPropagatedKey = "fontPropagated"; //$NON-NLS-1$
    if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) {
        if (!store.getBoolean(fontPropagatedKey))
            PreferenceConverter.setValue(getDeprecatedWorkbenchPreferenceStore(),
                    PreferenceConstants.EDITOR_TEXT_FONT,
                    PreferenceConverter.getFontDataArray(store, JFaceResources.TEXT_FONT));
    }
    store.setValue(fontPropagatedKey, true);

    /*
     * Backwards compatibility: set the Java editor font in this plug-in's
     * preference store to let older versions access it. Since 2.1 the
     * Java editor font is managed by the workbench font preference page.
     */
    PreferenceConverter.putValue(store, JFaceResources.TEXT_FONT,
            JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT));

    fFontPropertyChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty()))
                PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT,
                        JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT));
        }
    };
    JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener);

    /*
     * Backwards compatibility: propagate the Java editor tab width from a
     * pre-3.0 plug-in to the new preference key. This is done only once.
     */
    final String oldTabWidthKey = DEPRECATED_EDITOR_TAB_WIDTH;
    final String newTabWidthKey = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH;
    String tabWidthPropagatedKey = "tabWidthPropagated"; //$NON-NLS-1$
    if (store.contains(oldTabWidthKey) && !store.isDefault(oldTabWidthKey)) {
        if (!store.getBoolean(tabWidthPropagatedKey))
            store.setValue(newTabWidthKey, store.getInt(oldTabWidthKey));
    }
    store.setValue(tabWidthPropagatedKey, true);

    /*
     * Backwards compatibility: set the Java editor tab width in this plug-in's
     * preference store with the old key to let older versions access it.
     * Since 3.0 the tab width is managed by the extended text editor and
     * uses a new key.
     */
    store.putValue(oldTabWidthKey, store.getString(newTabWidthKey));

    fPropertyChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (newTabWidthKey.equals(event.getProperty())) {
                IPreferenceStore prefStore = getPreferenceStore();
                prefStore.putValue(oldTabWidthKey, prefStore.getString(newTabWidthKey));
            }
        }
    };
    store.addPropertyChangeListener(fPropertyChangeListener);

    /*
     * Backward compatibility for the refactoring preference key.
     */
    //      store.setValue(
    //         PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD,
    //         RefactoringCore.getConditionCheckingFailedSeverity());

    // The commented call above triggers the eager loading of the LTK core plug-in
    // Since the condition checking failed severity is guaranteed to be of RefactoringStatus.SEVERITY_WARNING,
    // we directly insert the inlined value of this constant
    store.setToDefault(DEPRECATED_REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD);

    if (!store.getBoolean(JavaDocLocations.PREF_JAVADOCLOCATIONS_MIGRATED)) {
        JavaDocLocations.migrateToClasspathAttributes();
    }

    FormatterProfileStore.checkCurrentOptionsVersion();

    /*
     * Backward compatibility: migrate "alphabetic ordering" preference to point the sorter
     * preference to the alphabetic sorter.
     */
    String proposalOrderMigrated = "proposalOrderMigrated"; //$NON-NLS-1$

    if (store.contains(DEPRECATED_CODEASSIST_ORDER_PROPOSALS)) {
        if (!store.getBoolean(proposalOrderMigrated)) {
            boolean alphabetic = store.getBoolean(DEPRECATED_CODEASSIST_ORDER_PROPOSALS);
            if (alphabetic)
                store.setValue(PreferenceConstants.CODEASSIST_SORTER, "org.summer.sdt.ui.AlphabeticSorter"); //$NON-NLS-1$
        }
    }
    store.setValue(proposalOrderMigrated, true);

}

From source file:org.talend.designer.core.ui.viewer.ReconcilerViewer.java

License:Open Source License

protected void initializeViewer(IDocument document) {
    fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();

    setDocument(document);/*from   w  w  w  .j  av a 2 s . c  om*/

    installViewerConfiguration();
    setEditable(true);

    Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
    getTextWidget().setFont(font);

    Control control = getControl();
    GridData data = new GridData(GridData.FILL_BOTH);
    control.setLayoutData(data);

    prependVerifyKeyListener(new VerifyKeyListener() {

        public void verifyKey(VerifyEvent event) {
            handleVerifyKeyPressed(event);
        }
    });
    addDocumentListener(document);

    addMenu();
}

From source file:org.talend.designer.core.ui.viewer.ReconcilerViewer.java

License:Open Source License

protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {

    Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator();
    while (e.hasNext()) {
        support.setAnnotationPreference((AnnotationPreference) e.next());
    }/*from w ww .j  av a 2  s.c o  m*/

    support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
    support.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN);
    support.setSymbolicFontName(JFaceResources.TEXT_FONT);
}

From source file:org.thanlwinsoft.doccharconvert.eclipse.editors.MappingTableLabelProvider.java

License:Open Source License

@Override
public Font getFont(Object element, int columnIndex) {
    if (columnIndex < COL_OFFSET) {
        return JFaceResources.getFont(JFaceResources.TEXT_FONT);
    }//w ww  . java  2s .c om
    String ref = mappingTable.getColumns().getComponentArray(columnIndex - COL_OFFSET).getR();
    SyllableConverter sc = mParentEditor.getDocument().getSyllableConverter();
    int side = SyllableConverterUtils.getSide(sc, ref);
    return mParentEditor.getFont(side);
}

From source file:org.thanlwinsoft.doccharconvert.eclipse.editors.SyllableConverterEditor.java

License:Open Source License

protected Font getFont(int side) {
    if (mFonts[side] != null)
        return mFonts[side];
    Script s = converterDoc.getSyllableConverter().getScriptArray(side);
    String faceName = s.getFont();
    Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
    if (faceName == null) {
        InputStream is = null;/*  w  w  w.ja v a2s  . com*/
        try {
            URL fileUrl = mFileInput.getURI().toURL();
            String filename = fileUrl.getPath();
            int dot = filename.lastIndexOf(".");
            if (dot > -1) {
                filename = filename.substring(0, dot + 1) + "dccx";
                fileUrl.getHost();
                fileUrl = new URL(fileUrl, filename);
                is = fileUrl.openStream();
            }
        } catch (MalformedURLException e) {
            DocCharConvertEclipsePlugin.log(IStatus.WARNING, e.getLocalizedMessage(), e);
        } catch (IOException e) {
            DocCharConvertEclipsePlugin.log(IStatus.WARNING, e.getLocalizedMessage(), e);
        }

        // if (inputFile != null)
        // {
        // IPath dccxPath = inputFile.getFullPath();
        //                
        // if (dccxPath != null)
        // {
        // dccxPath =
        // dccxPath.removeFileExtension().addFileExtension("dccx");
        // IResource dccxRes =
        // ResourcesPlugin.getWorkspace().getRoot().findMember(dccxPath);
        // if (dccxRes instanceof IFile)
        // {
        // IFile dccxFile = (IFile)dccxRes;
        // try
        // {
        // is = dccxFile.getContents(true);
        // }
        // catch (CoreException e)
        // {
        // DocCharConvertEclipsePlugin.log(IStatus.WARNING,
        // e.getLocalizedMessage(), e);
        // }
        // }
        // }
        // else
        // {
        // dccxPath =
        // inputFile.getLocation().removeFileExtension().addFileExtension
        // ("dccx");
        // File file = dccxPath.toFile();
        // try
        // {
        // is = new FileInputStream(file);
        // }
        // catch (FileNotFoundException e)
        // {
        // DocCharConvertEclipsePlugin.log(IStatus.WARNING,
        // e.getLocalizedMessage(), e);
        // }
        // }

        if (is != null) {

            try {
                DocCharConverterDocument doc = DocCharConverterDocument.Factory.parse(is);
                Styles styles = doc.getDocCharConverter().getStyles();
                if (styles.sizeOfStyleArray() > 0) {
                    Style style = styles.getStyleArray(0);
                    faceName = style.getFontArray(side).getName();
                }
            } catch (XmlException e) {
                DocCharConvertEclipsePlugin.log(IStatus.WARNING, e.getLocalizedMessage(), e);
            } catch (IOException e) {
                DocCharConvertEclipsePlugin.log(IStatus.WARNING, e.getLocalizedMessage(), e);
            }
        }
    }
    if (faceName != null) {
        FontData fd = new FontData(faceName, font.getFontData()[0].getHeight(), SWT.NORMAL);
        font = new Font(parent.getDisplay(), fd);
        mFonts[side] = font;
    }

    return font;
}

From source file:org.universaal.uaalpax.ui.ProjectLabelProvider.java

License:Apache License

public Font getFont(Object element) {
    if (parentViewer.getGrayed(element))
        return JFaceResources.getFontRegistry().getItalic(JFaceResources.TEXT_FONT);
    else//w w  w  .  jav  a  2 s .c  o  m
        return null;
}

From source file:org.xmind.ui.resources.FontUtils.java

License:Open Source License

private static boolean isDefaultKey(String key) {
    return JFaceResources.DEFAULT_FONT.equals(key) || JFaceResources.DIALOG_FONT.equals(key)
            || JFaceResources.HEADER_FONT.equals(key) || JFaceResources.TEXT_FONT.equals(key)
            || JFaceResources.BANNER_FONT.equals(key);
}

From source file:org.xrepl.ui.console.XreplConsolePage.java

License:Open Source License

private void createOutputViewer() {
    outputViewer = new TextViewer(page, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    outputViewer.getTextWidget().setLayoutData(new GridData(GridData.FILL_BOTH));
    outputViewer.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    outputViewer.setEditable(false);/*from w  w  w  .j  ava  2 s.c  om*/
    outputViewer.setDocument(new Document());
}

From source file:patch.org.eclipse.jdt.internal.ui.JavaPlugin.java

License:Open Source License

/**
 * Installs backwards compatibility for the preference store.
 *///w ww .j av a2s.  c  o m
private void ensurePreferenceStoreBackwardsCompatibility() {

    IPreferenceStore store = getPreferenceStore();

    // must add here to guarantee that it is the first in the listener list
    fMembersOrderPreferenceCache = new MembersOrderPreferenceCache();
    fMembersOrderPreferenceCache.install(store);

    /*
     * Installs backwards compatibility: propagate the Java editor font from a
     * pre-2.1 plug-in to the Platform UI's preference store to preserve
     * the Java editor font from a pre-2.1 workspace. This is done only
     * once.
     */
    String fontPropagatedKey = "fontPropagated"; //$NON-NLS-1$
    if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) {
        if (!store.getBoolean(fontPropagatedKey))
            PreferenceConverter.setValue(getDeprecatedWorkbenchPreferenceStore(),
                    PreferenceConstants.EDITOR_TEXT_FONT,
                    PreferenceConverter.getFontDataArray(store, JFaceResources.TEXT_FONT));
    }
    store.setValue(fontPropagatedKey, true);

    /*
     * Backwards compatibility: set the Java editor font in this plug-in's
     * preference store to let older versions access it. Since 2.1 the
     * Java editor font is managed by the workbench font preference page.
     */
    PreferenceConverter.putValue(store, JFaceResources.TEXT_FONT,
            JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT));

    fFontPropertyChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty()))
                PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT,
                        JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT));
        }
    };
    JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener);

    /*
     * Backwards compatibility: propagate the Java editor tab width from a
     * pre-3.0 plug-in to the new preference key. This is done only once.
     */
    final String oldTabWidthKey = DEPRECATED_EDITOR_TAB_WIDTH;
    final String newTabWidthKey = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH;
    String tabWidthPropagatedKey = "tabWidthPropagated"; //$NON-NLS-1$
    if (store.contains(oldTabWidthKey) && !store.isDefault(oldTabWidthKey)) {
        if (!store.getBoolean(tabWidthPropagatedKey))
            store.setValue(newTabWidthKey, store.getInt(oldTabWidthKey));
    }
    store.setValue(tabWidthPropagatedKey, true);

    /*
     * Backwards compatibility: set the Java editor tab width in this plug-in's
     * preference store with the old key to let older versions access it.
     * Since 3.0 the tab width is managed by the extended text editor and
     * uses a new key.
     */
    store.putValue(oldTabWidthKey, store.getString(newTabWidthKey));

    fPropertyChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (newTabWidthKey.equals(event.getProperty())) {
                IPreferenceStore prefStore = getPreferenceStore();
                prefStore.putValue(oldTabWidthKey, prefStore.getString(newTabWidthKey));
            }
        }
    };
    store.addPropertyChangeListener(fPropertyChangeListener);

    /*
     * Backward compatibility for the refactoring preference key.
     */
    //      store.setValue(
    //         PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD,
    //         RefactoringCore.getConditionCheckingFailedSeverity());

    // The commented call above triggers the eager loading of the LTK core plug-in
    // Since the condition checking failed severity is guaranteed to be of RefactoringStatus.SEVERITY_WARNING,
    // we directly insert the inlined value of this constant
    store.setToDefault(DEPRECATED_REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD);

    if (!store.getBoolean(JavaDocLocations.PREF_JAVADOCLOCATIONS_MIGRATED)) {
        JavaDocLocations.migrateToClasspathAttributes();
    }

    FormatterProfileStore.checkCurrentOptionsVersion();

    /*
     * Backward compatibility: migrate "alphabetic ordering" preference to point the sorter
     * preference to the alphabetic sorter.
     */
    String proposalOrderMigrated = "proposalOrderMigrated"; //$NON-NLS-1$

    if (store.contains(DEPRECATED_CODEASSIST_ORDER_PROPOSALS)) {
        if (!store.getBoolean(proposalOrderMigrated)) {
            boolean alphabetic = store.getBoolean(DEPRECATED_CODEASSIST_ORDER_PROPOSALS);
            if (alphabetic)
                store.setValue(PreferenceConstants.CODEASSIST_SORTER, "org.eclipse.jdt.ui.AlphabeticSorter"); //$NON-NLS-1$
        }
    }
    store.setValue(proposalOrderMigrated, true);

}

From source file:v9t9.gui.client.swt.wizards.SetupIntroPage.java

License:Open Source License

private void setupFooterLabel() {
    StyledTextHelper styledTextHelper = new StyledTextHelper(label);

    styledTextHelper.pushStyle(new TextStyle(), SWT.ITALIC);

    label.append("\n" + "Note: copyrighted ROMs are not distributed with V9t9 itself.\n\n" + "Please see ");

    // SWT.UNDERLINE_LINK does not appear to work as promised :p
    TextStyle urlSt = new TextStyle(JFaceResources.getFontRegistry().getItalic(JFaceResources.TEXT_FONT),
            getDisplay().getSystemColor(SWT.COLOR_BLUE), null);

    urlSt.underline = true;// ww w  .  jav  a2  s .co  m
    urlSt.underlineColor = getDisplay().getSystemColor(SWT.COLOR_BLUE);

    final StyleRange urlStyle = styledTextHelper.pushStyle(urlSt, SWT.ITALIC);

    label.append(InternetDefinitions.sV9t9RomsURL);

    styledTextHelper.popStyle();

    registerLink(urlStyle, new ILinkHandler() {
        public void linkClicked() {
            BrowserUtils.openURL(InternetDefinitions.sV9t9RomsURL);
        }
    });

    label.append(" for information on ROMs.\n\n");
    label.append("Or, exit this wizard and use the 'Demo' button to see how V9t9 behaves.");

    styledTextHelper.popStyle();
}