Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324388

Summary: Virtual/lazy TreeViewer creates all grandchildren of expanded nodes
Product: [Eclipse Project] Platform Reporter: Jan Koehnlein <jan>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: hsoliwal
Version: 3.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Jan Koehnlein CLA 2010-09-03 06:07:43 EDT
If you call expandNodes() on a TreeViewer with a ILazyTreeContentProvider and a SWT.VIRTUAL Tree that contains virutal nodes, the tree viewer will expand all grandchildren of the nodes to be expanded. This can cause a serious performance/memory penalty, as virtual trees are meant to create their tree items only on demand.

Reason is that internalSetExpand() recursively calls itself when the data on an item is null, which is the case for virtual nodes. Then all grandchildren will be created. 

Workaround for me was to implement my own TreeProvider and move the 
  if (expandedElements.size() > 0) {
    internalSetExpanded(expandedElements, item); 
  }
one line up into the 
  if(date != null) 
block.
Comment 1 Hitesh CLA 2010-09-03 06:42:30 EDT

*** This bug has been marked as a duplicate of bug 266189 ***