Disable SimpleTreeStructure auto-expand with single child Follow
Answered
How do I disable auto-expand in SimpleTreeStructure when there is only a single child element? I'm trying to display a recursive object and this auto-expand functionality is opening an infinite chain of children. Everything works normally if there is more than one child, but if there is just one child it results in the following issue:
Please sign in to leave a comment.
Hi Brandon,
SimpleTreeStructure looks like a model class. Check com.intellij.ui.treeStructure.SimpleNode.isAutoExpandNode() method. I don't know your implementation and use case details but seems like you may to extend SimpleNode and override isAutoExpandNode().
Unfortunately, that method is never called during the issue demonstrated above and the source code for SimpleNode.isAutoExpandNode() shows that if it was called, it returns false. I've also experimented with SimpleNode.getLeafState() with no success.
I see. Please share the full code context then.
https://github.com/BFergerson/simple-tree-structure-issue
The repository above shows a minimally reproducible example of the issue I'm facing. You just need to open a project and the following window should appear which demonstrates the issue:
You can see here that SimpleNode.isAutoExpandNode() has no effect.
It is currently not possible with the open API. Please follow:
https://youtrack.jetbrains.com/issue/IDEA-301210/Add-the-possibility-of-auto-expanding-trees-customization
UPDATE: It is possible with:
DefaultTreeUI.AUTO_EXPAND_ALLOWED
internal API status has been removedsince 223.5582.