List of usage examples for org.eclipse.jface.preference PreferenceConverter FONTDATA_ARRAY_DEFAULT_DEFAULT
FontData[] FONTDATA_ARRAY_DEFAULT_DEFAULT
To view the source code for org.eclipse.jface.preference PreferenceConverter FONTDATA_ARRAY_DEFAULT_DEFAULT.
Click Source Link
FontData[] preferences. From source file:org.eclipse.ui.internal.themes.ThemeElementHelper.java
License:Open Source License
/** * Installs the given font in the preference store and optionally the font * registry./*from ww w . jav a 2 s. c om*/ * * @param definition * the font definition * @param registry * the font registry * @param store * the preference store from which to set and obtain font data * @param setInRegistry * whether the color should be put into the registry as well as * having its default preference set */ private static void installFont(FontDefinition definition, ITheme theme, IPreferenceStore store, boolean setInRegistry) { FontRegistry registry = theme.getFontRegistry(); String id = definition.getId(); String key = createPreferenceKey(theme, id); FontData[] prefFont = store != null ? PreferenceConverter.getFontDataArray(store, key) : null; FontData[] defaultFont = null; if (definition.getValue() != null) { defaultFont = definition.getValue(); } else if (definition.getDefaultsTo() != null) { defaultFont = registry.filterData(registry.getFontData(definition.getDefaultsTo()), PlatformUI.getWorkbench().getDisplay()); } else { // values pushed in from jface property files. Very ugly. Display display = PlatformUI.getWorkbench().getDisplay(); //If in high contrast, ignore the defaults in jface and use the default (system) font. //This is a hack to address bug #205474. See bug #228207 for a future fix. FontData[] fontData = JFaceResources.getFontRegistry() .getFontData(display.getHighContrast() ? JFaceResources.DEFAULT_FONT : id); defaultFont = registry.bestDataArray(fontData, display); } if (setInRegistry) { if (prefFont == null || prefFont == PreferenceConverter.FONTDATA_ARRAY_DEFAULT_DEFAULT) { prefFont = defaultFont; } if (prefFont != null) { registry.put(id, prefFont); } } if (defaultFont != null && store != null) { PreferenceConverter.setDefault(store, key, defaultFont); } }