gpt4 book ai didi

eclipse - Eclipse 编辑器的只读属性 View

转载 作者:行者123 更新时间:2023-12-02 12:13:14 25 4
gpt4 key购买 nike

我正在创建一个在文本编辑器中具有 TreeView 的编辑器。我附加了一个属性 View ,以便在选择每个树项目时显示该项目的属性。为此,每个树项都是一个实现 IPropertySource 的类。因此,属性值是通过重写 IPropertySource 类的方法(如 getPropertyDescriptors、getPropertyValue、setPropertyValue 等)来获取的。属性值显示正确。但是,我要求属性 View 中的值是只读的。目前,这些名称不可编辑。但是,在选择属性 View 的某一行时,该属性的值是可编辑的。如何使属性 View 的所有属性值变为只读(不可编辑)?

谢谢!

最佳答案

如果您使用 Eclipse 中的标准属性表页面,则取决于 IPropertySource.getPropertyDescriptors 返回的 IPropertyDescriptor 实现,您的属性是否以及如何在 View 中可编辑。

如果您查看 IPropertyDescriptor 的 JavaDoc,您可以看到以下内容:

Clients may implement this interface to provide specialized property
descriptors; however, there are standard implementations declared in this
package that take care of the most common cases:

* PropertyDescriptor - read-only property
* TextPropertyDescriptor - edits with a TextCellEditor
* CheckboxPropertyDescriptor - edits with a CheckboxCellEditor
* ComboBoxPropertyDescriptor - edits with a ComboBoxCellEditor
* ColorPropertyDescriptor - edits with a ColorCellEditor

因此,对于您的情况,返回 PropertyDescriptor 应该可以解决问题。

关于eclipse - Eclipse 编辑器的只读属性 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9562394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com