Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 227800 - [Viewers] TreeViewer loses expansion state when refresh needs to create new item for existing element
Summary: [Viewers] TreeViewer loses expansion state when refresh needs to create new i...
Status: RESOLVED DUPLICATE of bug 113675
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-18 12:38 EDT by Nick Edgar CLA
Modified: 2008-04-18 17:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2008-04-18 12:38:48 EDT
3.3.2 build

In a tree viewer with elements expanded as in:
+ a
- b
  - c
    + d


toggle a filter which hides 'a', and refresh the viewer.
The expansion state is preserved:
- b
  + c
    + d

Now toggle the filter back on, and refresh again.
The expansion state for c is lost:
+ a
- b
  - c

This is because in AbstractTreeViewer.updateChildren, it reuses the first item for a (previously used by b) and creates a new item for b.  While the expansion state of b is preserved, the expansion state of its children is not.

To solve this efficiently, updateChildren will need to collect expanded elements from subtrees whose items are being reuse and pass this down to the new subtree for the element.

(Jazz work item: 48906)
Comment 1 Boris Bokowski CLA 2008-04-18 17:15:27 EDT

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