Community
Participate
Working Groups
If a filter is on, and the content of the tree changes (e.g. node is added or removed), and a refresh() call is made on the viewer, the change does not appear until the filter is removed again. My expectation is that a refresh of the TreeViewer would cause the filter to refresh if the filter were applied. Otherwise if a node is deleted from the viewer it doesn't disappear until the filter is reset. Or am I misusing it somehow?
Sounds like a bug. The item you added matched the filter, correct? The deleting part sounds buggy, but I am not sure how (programmatically) you are removing the node from the tree. If you have some sample code that illustrates the problem you are seeing in the delete case that would be helpful.
Sorry for the slow reply on this. Yes, the item matches the filter. Generating sample code for this is a bit involved since needs to be a content provider and actions to replicate. Here are the simplest steps to reproduce, let me know if a pointer to the code would still be useful. 1) create a tree whose content provider returns nodes 11 and 12 2) enter "1" for the filter text (both show) 3) delete node 12 (via view or code), then call getViewer().refresh() - 12 will continue to show, even though it's gone from the content 4) call FilteredTree.textChanged() - 12 will now disappear It's like the refresh is not getting the new content from the content provider when the filter is on. My current work around, thanks to your changes on bug 74795, is to call filteredTree.textChanged(0) instead of getViewer().refresh(). But others could easily trip over this.
You shouldn't have to workaround this. There is a cache of the items in PatternFilter. This may be the problem. Hopefully I will get a chance to look at this soon.
I haven't been noticing this problem recently. Was something fixed with that cache?
No - I did look at this bug though. I tried some things but they didn't work consistently so I never released any code for this problem. I wonder if it got "fixed" somehow because of some other changes in FilteredTree or even in JFace's tree viewer.
I just did some manual testing. Given the following tree: category - one - onetwo If the filter text is set to "one", and "onetwo" is deleted, it will disappear. That wasn't working a while back. What doesn't work is if I rename the item "one" to be "bla". It will still appear in the tree. Similarly if the item "onethree" is added to the tree content it wont show unless the filter is refreshed. There's a chance that this could be related to wierdness in my content provider, but it doesn't seem that likely since the refresh in the tree happens normally otherwise. I guess that there are no clients in the SDK that use the filtered tree with dynamically changing content, so it's not noticeable anywhere else?
The Launch configurations dialog (Run... or Debug...) uses FilteredTree and dynamically changes the labels of tree items. Create a new configuration then change the name and hit Apply.
Did something change about this on M6 or RC1? This bug is no longer happening to me, and I'm pretty sure it was still there on previous releases.
Boris might know.
*** This bug has been marked as a duplicate of bug 187200 ***
*** Bug 165883 has been marked as a duplicate of this bug. ***