Example usage for org.eclipse.jface.resource StringConverter asFontDataArray

List of usage examples for org.eclipse.jface.resource StringConverter asFontDataArray

Introduction

In this page you can find the example usage for org.eclipse.jface.resource StringConverter asFontDataArray.

Prototype

public static FontData[] asFontDataArray(String value) 

Source Link

Document

Convert the given value into an array of SWT font data objects.

Usage

From source file:com.cisco.yangide.ext.model.editor.preferences.ModelEditorPreferencePage.java

License:Open Source License

private FontData[] toFontData(String str) {
    return JFaceResources.getFontRegistry().filterData(StringConverter.asFontDataArray(str),
            PlatformUI.getWorkbench().getDisplay());
}

From source file:org.eclipse.ui.internal.themes.FontDefinition.java

License:Open Source License

/**
 * Returns the value.//  ww  w.  j  a  v a  2s  .c om
 * 
 * @return FontData []
 */
public FontData[] getValue() {
    if (value == null) {
        return null;
    }
    if (parsedValue == null) {
        parsedValue = JFaceResources.getFontRegistry().filterData(StringConverter.asFontDataArray(value),
                PlatformUI.getWorkbench().getDisplay());
    }

    return parsedValue;
}

From source file:org.polarsys.reqcycle.traceability.types.configuration.preferences.TTypeDecorationPreferencePage.java

License:Open Source License

private void initProviders() {
    AdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    listOfRelationsViewer.setLabelProvider(new AdapterFactoryLabelProvider(factory));
    listOfRelationsViewer.setContentProvider(ArrayContentProvider.getInstance());
    tableOfMappingViewer.setContentProvider(ArrayContentProvider.getInstance());
    tableOfMappingViewer.setLabelProvider(
            new AdapterFactoryLabelProvider.FontAndColorProvider(factory, tableOfMappingViewer) {

                @Override/*from  www  .  j  a va2 s  .  c om*/
                public Font getFont(Object object, int columnIndex) {
                    if (object instanceof DecorationPredicate) {
                        DecorationPredicate d = (DecorationPredicate) object;
                        Font font = JFaceResources.getFontRegistry().get(d.getStyle());
                        if (font == null) {
                            JFaceResources.getFontRegistry().put(d.getStyle(),
                                    StringConverter.asFontDataArray(d.getStyle()));
                            font = JFaceResources.getFontRegistry().get(d.getStyle());
                        }
                        return font;
                    }
                    return super.getFont(object, columnIndex);
                }

                @Override
                public Color getForeground(Object object, int columnIndex) {
                    if (object instanceof DecorationPredicate) {
                        DecorationPredicate d = (DecorationPredicate) object;
                        Color color = JFaceResources.getColorRegistry().get(d.getColor());
                        if (color == null) {
                            JFaceResources.getColorRegistry().put(d.getColor(),
                                    StringConverter.asRGB(d.getColor()));
                            color = JFaceResources.getColorRegistry().get(d.getColor());
                        }
                        return color;
                    }
                    return super.getForeground(object, columnIndex);
                }

            });
}

From source file:org.polarsys.reqcycle.traceability.types.ui.impl.StylePredicateProvider.java

License:Open Source License

public Font getFontForRelation(Link link) {
    return getResourcetForRelation(link, new IBehavior<Font>() {

        @Override//from w w w  .j  ava  2 s.  c om
        public Font handleRegistry(DecorationPredicate t) {
            Font result = JFaceResources.getFontRegistry().get(t.getStyle());
            if (result == null) {
                JFaceResources.getFontRegistry().put(t.getStyle(),
                        StringConverter.asFontDataArray(t.getStyle()));
                result = JFaceResources.getFontRegistry().get(t.getStyle());
            }
            return result;
        }
    });
}