FontFieldEditor ffe = new FontFieldEditor(PreferenceInitializer.ATTR_LOGCAT_FONT,
"Display Font:", getFieldEditorParent());
addField(ffe);
Preferences prefs = DdmsPlugin.getDefault().getPluginPreferences();
prefs.addPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
// get the name of the property that changed.
String property = event.getProperty();
if (PreferenceInitializer.ATTR_LOGCAT_FONT.equals(property)) {
try {
FontData fdat = new FontData((String)event.getNewValue());
LogCatView.setFont(new Font(getFieldEditorParent().getDisplay(), fdat));
} catch (IllegalArgumentException e) {
// Looks like the data from the store is not valid.
// We do nothing (default font will be used).
} catch (SWTError e2) {
// Looks like the Font() constructor failed.
// We do nothing in this case, the logcat view will use the default font.
}
}
}
});