从Eclipse RCP,我正在使用字段编辑器(http://www.eclipse.org/articles/Article-Field-Editors/field_editors.html)构建首选项页面
我正在尝试使用FieldEditor的子类字段编辑器BooleanFieldEditor。
我的问题是在javadoc中,我找不到更改此字段编辑器状态(选中/未选中)的函数。
setChecked(boolean)函数在哪里? :-)
我错过了什么吗?
最佳答案
您可以通过访问首选项商店的API来实现。
getPreferenceStore().setValue(preferenceID, value);
其中preferenceID是布尔首选项的名称
(即
new BooleanFieldEditor(preferenceID, label, parent);
),并且该值为true / false。
您可以通过以下方式获取ID的当前值:
getPreferenceStore().getBoolean(preferenceID);
关于java - JFace和FieldEditor,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18108606/