How to disable collapsible in JFace TreeViewer

Published on Author Code Father

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

Comments

comments