Replies: 3 comments 11 replies
-
Virtual Trees are a bit tricky what I do in one of my applications with a virtual tree is to start with a As expanding one level of the tree then loads the children, this iteratively expands everything up to the desired state. |
Beta Was this translation helpful? Give feedback.
-
That sounds similar to my latest approach, except that I need to rely on As a side node: I've made some smaller changes to the problematic methods and then |
Beta Was this translation helpful? Give feedback.
-
Yes. |
Beta Was this translation helpful? Give feedback.
-
This is an issue I've been scratching my head at for the past few days... I have a virtual tree viewer where I fetch the currently expanded elements via
getExpandedElements()
, update the input and then restore it viasetExpandedElements()
.The problem: This doesn't work, as updating the input collapses the tree and therefore all tree items are virtual and without data object. Restoring the expanded state ist herefore ignored (line 2175).
eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
Lines 2170 to 2190 in 9474c95
For my next attempt, I tried to use
getTreePathFromItem()
, but this has a similar issue except that it simply throws an exception becausesegment == null
(line 3189).eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
Lines 3185 to 3194 in 9474c95
After overwriting this method and simply returning null instead of throwing an exception, the next error was thrown because the method
getExpandedTreePaths()
skips such null elements but doesn't consider this when calculating the size of the returned array (line 3181).eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
Lines 3271 to 3282 in 9474c95
My question: Some of those checks seem intentional, so is this functionality something that's generally unsupported for virtual trees and something where I have to switch back to a "normal" tree?
Beta Was this translation helpful? Give feedback.
All reactions