DESCRIPTION

Bug 408763 - The ImportExportPage filters allows an empty category to
appear

Change-Id: Ic5f23653eb0f14c5a176d418aa4706b7c7f72fb6
Signed-off-by: Addison Irwin xxx@xxx.xxx

COMMENTS

author: Addison Irwin
date: 2013-07-16 13:57:02.000000000

Uploaded patch set 4.

-------------------------------------
author: Addison Irwin
date: 2013-07-16 14:00:02.000000000

Patch Set 4:

Fix in the last change set works regardless the filtering order

thanks in advance for review,
Daniel

-------------------------------------
author: Sebastian Porter
date: 2013-07-25 11:13:06.000000000

Patch Set 4:

I'm not convinced about all those changes and why we would need this. Especially, I don't like adding the API on PatternFilter.

See the bug for a simpler solution.

-------------------------------------
author: Addison Irwin
date: 2013-07-25 11:26:35.000000000

Patch Set 4:

OK, let me use the idea about additional filter mentioned in the bug, however it is the workaround for the real issue only

-------------------------------------
author: Sebastian Porter
date: 2013-07-25 11:28:28.000000000

Patch Set 4:

If you can better explain your approach and not add the API to PatternFilter, I'm open for another version of your patch.

-------------------------------------
author: Addison Irwin
date: 2013-07-25 12:46:03.000000000

Patch Set 4:

Let me try to explain the issue better, however it is quite complicated processing basing on the recursively traversing by tree. So in my example I have activity filter set for the 'New' wizards that accepts the 'New folder' wizard only. 

Test case 1:
In the pattern filter field I enter 'f' token and it works line below:

1st filtering iteration:
 * Input tree items: [org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx -> 'New project' wizard
		      WizardCollection, 0 children, 4 wizards] -> 'General' wizard collection

 * Result of filtering: [WizardCollection, 0 children, 4 wizards] -> 'General' wizard collection (not modified, at least 3 wizards contain 'f' in name)

 * After this step the 'General' category is displayed on the tree

2nd filtering iteration:
 * Input tree items: [org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx 
                      org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx                                                                 
                      org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx 
                      org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx -> content of the'General' wizard collection. Only 'Folder' will 
                                                                                          be accepted by the activity and pattern filters

 * Result of filtering:  [org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx -> 'Folder' wizard

 * After this step the 'General/Folder' wizard is displayed. Second iteration is processed since the 'General' wizard collection returned after 1st iteration still   contains items matching the patterns

 
Test case 2:
In the pattern filter field I enter 'fi' token and it works line below:

1st filtering iteration:
 * Input tree items: [org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx -> 'New project' wizard
		      WizardCollection, 0 children, 4 wizards] -> 'General' wizard collection

 * Result of filtering: [WizardCollection, 0 children, 4 wizards] -> 'General' wizard collection (not modified, contains 2 wizards with 'fi' in name)

 * After this step the 'General' category is rendered

2nd filtering iteration
 * Input tree items: [org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx 
                      org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx                                                                 
                      org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx 
                      org.eclipse.ui.internal.dialogs.WorkLeon xxx@xxx.xxx -> wizards contained in the Wizard Collection. Only 'Folder' will be accepted by
                                                                                          the activity filter. However it will be filtered out by the pattern filter

 * Result of filtering: []

 * So after this step the empty 'General' category left


It looks that the issue is caused by returning the 'General' wizard collection that is not modifying during filtering what triggers another filtering iteration. 
I was able to fix it by modifying the collection during processing the first iteration

I'm not sure if there will be possible to fix it simpler than either by adding this additional filter or following the original patch 
for this issue and making the filters the order sensitive

Daniel

-------------------------------------
author: Addison Irwin
date: 2013-07-29 13:06:33.000000000

Patch Set 4:

The additional empty category filter also relies on filtering older. First the pattern filter as well as the activity one have to be completed to filter out the empty categories.
I will try to improve the original patch since in my opinion it is the right direction for this fix.

Daniel

-------------------------------------
