Fix problems and optimize GraphExplorerImpl.selectPath
GraphExplorerImpl.selectPath has many problems including the fact that it just doesn't work.
- It is not expanding nodes before attempting to wait for the path subnodes to become visible. The Git version history does not reveal why, but expansion is done only after trying to waiting for nodes to become visible, which does nothing.
-
selectPathInternal(NodeContext[] context, int position)
invokes itself recursively with increasingposition
but always invokestryFind(contexts[position])
without any starting TreeItem for the search. This means the search will at every NodeContext in a node path try to find a TreeItem in the tree whose data matchescontexts[position]
by starting the search from the root of the tree. This makes absolutely no sense both functionally nor performance-wise when we can have a proper starting TreeItem upon recursive invocations. - Attempting to select a
NodeContext[]
path that contains resources used for virtual nodes (= same resource, different node type) where the complete path cannot be resolved and expanded in the tree, the tree will be left expanded at nodes that are part of a wrong path. The internal implementation should take care to collapse any nodes that were actually expanded by the failed path selection implementation. Nodes that were already expanded are not to be collapsed.
Edited by Tuukka Lehtonen