Eclipse编辑器的只读“属性"视图 [英] Read-only Properties view for Eclipse editor
问题描述
我正在创建一个在文本编辑器中具有树视图的编辑器.我附加了一个属性视图,以便在选择每个树项目时显示该项目的属性.为此,每个树项都是一个实现IPropertySource的类.因此,属性值是通过覆盖IPropertySource类的方法(如getPropertyDescriptors,getPropertyValue,setPropertyValue等)获得的. 属性值显示正确.但是,我要求属性视图中的值是只读的.当前,名称不可编辑.但是在选择属性视图的行之一时,该属性的值是可编辑的.如何使属性视图的所有属性值均为只读(不可编辑)?
I am creating an editor that has a tree view in a text Editor. I have a properties view attached to it so that on selection of each tree item, the properties of the item are displayed. For this each tree item is a class that implements IPropertySource. So the property values are obtained by overriding the methods (like getPropertyDescriptors, getPropertyValue, setPropertyValue and so on) of the IPropertySource class. The property values are displayed correctly. However, I require the values in properties view to be read-only. Currently, the names are non-editable. But on selecting one of the rows of the property view, the value of that property is editable. How do I make all values of properties of the properties view read-only (non-editable)?
谢谢!
推荐答案
如果您使用的是Eclipse的标准属性表页面,则取决于IPropertySource.getPropertyDescriptors
返回的IPropertyDescriptor
实现,以及是否以及如何在其中编辑属性.风景.
If you are using the standard property sheet page from Eclipse, it depends on the IPropertyDescriptor
implementation returned by IPropertySource.getPropertyDescriptors
whether and how your property is editable in the view.
如果您查看IPropertyDescriptor
的JavaDoc,则可以看到以下内容:
If you have a look at the JavaDoc of IPropertyDescriptor
, you can see the following:
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
应该可以解决问题.
So for your case returning the PropertyDescriptor
should do the trick.
这篇关于Eclipse编辑器的只读“属性"视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!