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

Bug 195223

Summary: [Viewers] 'refresh()' of TreeViewer doesn't remove the image displayed for the previous column
Product: [Eclipse Project] Platform Reporter: Janice Li <jli1>
Component: UIAssignee: Boris Bokowski <bokowski>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: tom.schindl
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Show recommended nodes
none
Show all nodes
none
Test snippet none

Description Janice Li CLA 2007-07-03 03:28:05 EDT
I have a TableTreeViewer where there is a 'Recommended' column. For the tree node that is recommended, I display a 'checked' icon. (Please see the first attached image file -- note: in this Tree, only 'version 1.0.4' is recommended). And I have a filter to filter out recommended nodes. If 'Show Recommended' button is selected, only recommended nodes will be shown (see the first attached file). If 'Show All' button is selected, I will remove this filter from the TreeViewer so that all the nodes will be shown. But as shown in the second attached file, if remove the filter, 'checked' icon will be displayed for 'Version 1.0.1' although it is not a recommended node. Actually it is the 'checked' icon for 'Version 1.0.4' before the filter was removed.

In the LabelProvider, for column 'Recommended', if the node is recommended, I return the ImageDescriptor of the 'checked' image. Otherwise, return null. But it seems 'refresh()' doesn't remove the image displayed for the previous node in the Column.
Comment 1 Janice Li CLA 2007-07-03 03:29:28 EDT
Created attachment 72928 [details]
Show recommended nodes

1st attachment.
Comment 2 Janice Li CLA 2007-07-03 03:30:12 EDT
Created attachment 72929 [details]
Show all nodes

2nd attachment.
Comment 3 Thomas Schindl CLA 2007-07-04 12:15:20 EDT
Could you by change provide a simple code snippet to reproduce this behaviour? I'm also uncertain which class you are using:
- TreeViewer as stated in the Summary
- TableTreeViewer as stated in your description

We had somewhere in dev-cycle 3.3 a problem with cached images. As a starting point you can use one of snippets provide from http://wiki.eclipse.org/JFaceSnippets
Comment 4 Janice Li CLA 2007-07-04 17:32:19 EDT
I use CheckboxTreeViewer and create columns for this CheckboxTreeViewer. MyLabelProvider extends LabelProvider and implements ITableLabelProvider and return the image or null for the 'Recommended' column.
Comment 5 Thomas Schindl CLA 2007-07-05 15:09:54 EDT
Created attachment 73152 [details]
Test snippet

This is a test snippet and it works for me as expected but I could only try against 3.3RC1. Can you run the snippet as report back?
Comment 6 Janice Li CLA 2007-07-05 17:51:51 EDT
Tried it on Eclipse3.3M7 and I can see the problem. The scenario is: 

1. Run the program and expand all the nodes in the Tree. Notice that there is no image for 'Column 0 => Item 0.4.1'.
2. Push the button 
3. Push the button again. There is an image for 'Column 0 => Item 0.4.1' now.
Comment 7 Thomas Schindl CLA 2007-07-05 18:13:23 EDT
You are seeing #186211 we fixed in 3.3RC1. I'll close this as a DUP. Please reopen if you can reproduce in final 3.3.

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