Divya Dev
Divya Dev

Reputation: 125

how to disable collapsible in JFace TreeViewer

I am using JFace treeviewer, would like to know how to disable the ability to collapse items and how to remove the collapsible icon.

Upvotes: 1

Views: 382

Answers (1)

Surajit Biswas
Surajit Biswas

Reputation: 809

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);

Upvotes: 0

Related Questions