Community
Participate
Working Groups
Build Identifier: 20100603-0907 SWT Cocoa only: Selection listeners of List/Tree fire when the corresponding viewer's refresh/setInput methods are called. In these cases, if the viewer's handleSelect method is overriden, event.item always seem to be null. Reproducible: Always Steps to Reproduce: 1. Use a SWT Tree or List. 2. Listen to the TreeViewer/ListViewer's selection by an addSelectionChangedListener or by overriding handleSelect in the viewer. 3. Call refresh() or setInput() on the viewer. Notice that selectionChanged() will fire even though selection hasn't changed.
This has bad side effects in Adobe Flash Builder: loops of selectionChanged/refresh(), unexpected actions occurring when refresh() is called, etc.
Can you post a test case that's failing? I'm attaching a modified snippet that I think does what you're describing, but the selectionChanged() doesn't fire when you click the button.
Created attachment 171652 [details] test case Modified TreeViewer snippet.
Hi Scott, Thank you for that test case. I tried it out: 1. Change TreeViewer to ListViewer and selectionChanged() will fire on Button press. 2. Using a TreeViewer, change v.refresh() to v.setInput() and selectionChanged() will fire. These two cases do not occur on windows/carbon. I'll attach the modified test cases as well. Thanks, Anirudh Sasikumar, Flash Builder Engineering
Created attachment 171696 [details] Scott's test case modified to use a ListViewer (with commented out setInput() call to use when the TreeViewer is used) Modified test case.
It looks like Tree.removeAll() is triggering a outlineViewSelectionDidChange event when we call reloadData(). I suspect something similar is happening in Table. Looks like we just need an ignoreSelect = true/false pair around reloadData.
Created attachment 171880 [details] Fix for Tree, List, & Table Ignore selection change events when calling removeAll.
Grant, can you review for 3.6.1?
This was the first bug that motivated bug 317054 and bug 317051, so I'm marking it fixed in 3.6.1 and HEAD.