SWT Tree, JFaces, TreeViewer

871 Views Asked by At

Could you give me some ideas on how I can achieve this.

I have SWT Tree with me, which is managed by means of Tree Viewer.

I want every item in the tree to be editable (I mean, if you put mouse on it and start editing its string value , it should change). But the Root item should not change.

User should not be able to modify the top item's name.

As of now Editing Support is provided for all the items in the tree including the top item. But top item shouldn't be editable.

Kindly give me some idea about it.

Regards, Venkata Vineel.

1

There are 1 best solutions below

0
On

If you use JFace you should set a org.eclipse.jface.viewers.EditingSupport implemetation on your org.eclipse.jface.viewers.TreeViewerColumn. The editing-support class has a method org.eclipse.jface.viewers.EditingSupport.canEdit(Object) you have to implement and that should return false for your top-items. For some examples how to use TreeViewers, EditingSupport and all the other stuff regarding JFace see also the JFace Snippets page.