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