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

Bug 323805

Summary: [Viewers] PatternFilter does not search in all duplicates tree objects
Product: [Eclipse Project] Platform Reporter: Said Taaouati <staaouat>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WONTFIX QA Contact: Hitesh <hsoliwal>
Severity: normal    
Priority: P3    
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Said Taaouati CLA 2010-08-27 06:47:37 EDT
Build Identifier: Version: 3.5.1 Build id: M20090917-0800

In the case that a tree consists of two duplicates tree objects, only the first one will be processed. With duplicates objects I means the same object can be found in the tree in more then one distinct path.

The problem is found in the method:
PatternFilter.isAnyVisible(Viewer viewer, Object parent, Object[]elements)
…
    	Boolean foundAny = (Boolean) foundAnyCache.get(parent);

If parent already found in the tree, then it will be not processed again if the same object will be found in the other tree path.
    
…
 


Reproducible: Always

Steps to Reproduce:
1.Add PatternFilter  to a viewer
2.add an object twice to the tree with distinct children 
3.search for a child name in the second object. The child will be not found
Comment 1 Hitesh CLA 2010-09-01 08:10:10 EDT
I assume you are using a FilteredTree; this limitation is because we cache the already filtered results. The existing behaviour is a very common use-case; and what you see is an optimization. I do not intend to change this ATM.

It is possible for you to work around this limitation 

1) By sublclassing FilteredTree (see method protected TreeViewer doCreateTreeViewer(Composite parent, int style))

2) Adding your own filter along the lines of PatternFilter
Comment 2 Hitesh CLA 2010-09-07 04:40:05 EDT
Closing the bug as WONTFIX; read Comment 1.