1

I have a JFace treeviewer with 7000+ nodes, when I perform expand all on the root element, it takes about 2 minutes to expand.

I have tried calling expandAll() and expandToLevel(Object, level), still the performance remains the same.

Is there a way to expand the tree in less time ?

Baz
  • 36,440
  • 11
  • 68
  • 94
Sudeep
  • 153
  • 1
  • 1
  • 12
  • You want to expand the whole tree in one go? Have you looked into using a ["virtual" tree](http://www.eclipse.org/articles/Article-SWT-Virtual/Virtual-in-SWT.html)? – Baz Apr 24 '18 at 09:25
  • not exactly the whole tree, but based on selection of node i have an handler which will call `expandToLevel()`, even this selected node will take time if it has large number of children. i tried using the `SWT.VIRTUAL` while creating the tree viewer, still the performance remains same. Is this the correct way to do it ? – Sudeep Apr 24 '18 at 10:14
  • 1
    Did you use an `ILazyTreeContentProvider` with the SWT.VIRTUAL? Virtual on its own doesn't do anything. Even then tree viewer performance is poor with a large numbers of chlldren as too much memory has to be allocated. – greg-449 Apr 24 '18 at 14:08
  • 1
    i saw a 70% improvement when i used setRedraw(false) before expanding and then setting it to setredraw(true) after expanding. Related article can be found [here](https://bugs.eclipse.org/bugs/show_bug.cgi?id=325185) – Sudeep May 04 '18 at 08:24
  • I would like to show `ProgressBar` when tree is being expanded but `ProgressBar` doesn't show the progress (gets stuck at starting point) but tree is being expanded in the background. After the tree expansion is complete, progress bar goes off. My only concern is why the `ProgressBar` doesn't show the progress (gets stuck at starting point). I have used both `Display.getDefault().asyncExec()` and `Display.getDefault().syncExec()` – Sudeep May 07 '18 at 08:05

0 Answers0