* 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()), Workbench
.getInstance().getDisplay());
} else {
// values pushed in from jface property files. Very ugly.
defaultFont = registry.bestDataArray(registry.getFontData(key),
Workbench.getInstance().getDisplay());
}
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);