Reputation: 41
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)?
Thanks!
Upvotes: 4
Views: 1415
Reputation: 1042
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.
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
So for your case returning the PropertyDescriptor
should do the trick.
Upvotes: 4