I am using JFace treeviewer, would like to know how to disable the ability to collapse items and how to remove the collapsible icon.
Asked
Active
Viewed 362 times
1
-
1You can't remove the icon ('twistie') shown on the tree nodes. – greg-449 Aug 23 '16 at 06:50
-
are there widgets similar to the tree (indented) without collapse property or the icon? but items should be selectable... – Divya Dev Aug 23 '16 at 10:21
-
You could always just use a TableViewer with spaces at the start of the rows. Maybe Eclipse [NatTable](https://eclipse.org/nattable/) can do something. – greg-449 Aug 23 '16 at 10:49
-
doesnt help.. any other suggestions? What i need is to remove the twistie but keep the expanded look and indentation. – Divya Dev Aug 24 '16 at 10:40
-
convert your treeViewer to tableViewer is actually the best way to achieve what you want – Kuku Jul 03 '18 at 06:15
1 Answers
0
Restricting all key events on Tree looks promising but you would loose navigating the tree structure and expand/collapse on tree node and all other functionality.
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
e.doit = false;
}
});
Or also if you use JTree
,
JTree jtree = new JTree();
jtree.setToggleClickCount(0);

Surajit Biswas
- 779
- 7
- 25
-
OMG !!! tree does not support addKeyListener ? Which version of Java you are using ? – Surajit Biswas Aug 23 '16 at 06:23
-
I am working on the code in this link : http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet002TreeViewer.java – Divya Dev Aug 23 '16 at 07:05
-