This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 408763 - The ImportExportPage filters allows an empty category to appear
Summary: The ImportExportPage filters allows an empty category to appear
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.4 M2   Edit
Assignee: Daniel Rolka CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-22 18:09 EDT by Nobody - feel free to take it CLA
Modified: 2013-09-17 05:15 EDT (History)
2 users (show)

See Also:


Attachments
Sample project with the considered issue (8.10 KB, multipart/x-zip)
2013-07-03 08:05 EDT, Daniel Rolka CLA
no flags Details
Normal state (14.68 KB, image/png)
2013-07-03 08:06 EDT, Daniel Rolka CLA
no flags Details
Considered issue (14.97 KB, image/png)
2013-07-03 08:07 EDT, Daniel Rolka CLA
no flags Details
picture1 (13.64 KB, image/png)
2013-07-15 11:34 EDT, Dani Megert CLA
no flags Details
picture2 (13.66 KB, image/png)
2013-07-15 11:34 EDT, Dani Megert CLA
no flags Details
Plugin that exposes the issue (8.04 KB, multipart/x-zip)
2013-08-20 03:31 EDT, Daniel Rolka CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2013-05-22 18:09:36 EDT
In the Import or Export Wizard dialog, within a given category, if you have a PatternFilter allowing one wizard through and a WizardActivityFilter allowing a different wizard through, then the category remains in the display, though empty.

I noticed that NewWizardNewPage does also use PatternFilter and WizardActivityFilter, but it also has one last filter WizardEmptyFolderFilter. Adding this filter to ImportExportPage does indeed seem to fix the problem.
Comment 1 Daniel Rolka CLA 2013-06-10 06:36:17 EDT
Could you please add the steps to reproduce the issue or attach sample project that shows it?

thanks,
Daniel
Comment 2 Nobody - feel free to take it CLA 2013-06-10 07:36:13 EDT
I couldn't find a reproducible case in stock Eclipse. Hopefully a more explicit example will help.

For us the bug shows up because we have a Capability filter hiding certain wizards. Say you have an import wizard category containing two wizards, named 'Inactive Wizard' and 'Active Wizard', with 'Inactive Wizard' hidden by capability. If I then type 'Inactive' in the dialog filter text box, the category containing the two is shown but it is empty.

It appears that the category folder is allowed to appear because every filter on its children passes at least one child, with the capability filter letting through 'Active Wizard' and PatternFilter letting through 'Inactive Wizard'.
Comment 3 Daniel Rolka CLA 2013-07-03 08:05:39 EDT
Created attachment 233027 [details]
Sample project with the considered issue
Comment 4 Daniel Rolka CLA 2013-07-03 08:06:33 EDT
Created attachment 233029 [details]
Normal state
Comment 5 Daniel Rolka CLA 2013-07-03 08:07:04 EDT
Created attachment 233030 [details]
Considered issue
Comment 6 Daniel Rolka CLA 2013-07-03 08:27:39 EDT
I've attached the sample project where the issue was recreated. Steps to reproduce it:

1) Run attached plugin

2) Open dialog with the 'Show wizards' toolbar button. You should see the dialog with the content presented by the 'Normal state' attachment. If not, press the 'Modify activity' button to apply the proper Capability filter.

3) Using filter text box enter some wizard's name that is hidden by the filter, the 'file' one for instance

4) You should get the dialog's content with the issue. See the 'Considered issue' attachment.

I'll continue the investigation of the issue,
Daniel
Comment 7 Nobody - feel free to take it CLA 2013-07-03 09:15:41 EDT
Yup, that's it. I thought I would add a patch for the one line fix I mentioned, but now I see that WizardEmptyFolderFilter is a class that we added to our version of the platform code. This means that the headline for this bug should be extended to include the New Project Wizard.
Comment 8 Dani Megert CLA 2013-07-15 09:20:45 EDT
Is this a regression? I don't see why/how this qualifies for a backport.
Comment 9 Daniel Rolka CLA 2013-07-15 09:32:21 EDT
(In reply to comment #8)
> Is this a regression? I don't see why/how this qualifies for a backport.

I've just checked it in the Eclipse 3.8 and it doesn't work there either. So it looks like it was always broken

Daniel
Comment 10 Dani Megert CLA 2013-07-15 11:33:18 EDT
(In reply to comment #6)
> I've attached the sample project where the issue was recreated. Steps to
> reproduce it:
> 
> 1) Run attached plugin
> 
> 2) Open dialog with the 'Show wizards' toolbar button. You should see the
> dialog with the content presented by the 'Normal state' attachment. If not,
> press the 'Modify activity' button to apply the proper Capability filter.

I cannot reproduce this. When I
1. import the plug-in into my dev workspace
2. and launch target with new workspace
3. close Welcome
4. click 'Show wizards'
I see picture1
5. click 'Modify activity'
==> picture1


> 
> 3) Using filter text box enter some wizard's name that is hidden by the
> filter, the 'file' one for instance
> 
> 4) You should get the dialog's content with the issue. See the 'Considered
> issue' attachment.

When I do this, all looks good, see picture2.
Comment 11 Dani Megert CLA 2013-07-15 11:34:10 EDT
Created attachment 233485 [details]
picture1
Comment 12 Dani Megert CLA 2013-07-15 11:34:53 EDT
Created attachment 233486 [details]
picture2
Comment 13 Daniel Rolka CLA 2013-07-16 02:44:32 EDT
(In reply to comment #12)
> Created attachment 233486 [details]
> picture2

Let's try with the following wizards dialog: File/New/Other...
You should get the issue using it as well

Daniel
Comment 14 Dani Megert CLA 2013-07-16 09:12:30 EDT
(In reply to comment #13)
> (In reply to comment #12)
> > Created attachment 233486 [details]
> > picture2
> 
> Let's try with the following wizards dialog: File/New/Other...
> You should get the issue using it as well
> 
> Daniel

Yep, that does the trick, but your 'Show wizards' does not seem to work.
Comment 15 Dani Megert CLA 2013-07-25 07:21:28 EDT
(In reply to comment #14)
> (In reply to comment #13)
> > (In reply to comment #12)
> > > Created attachment 233486 [details]
> > > picture2
> > 
> > Let's try with the following wizards dialog: File/New/Other...
> > You should get the issue using it as well
> > 
> > Daniel
> 
> Yep, that does the trick, but your 'Show wizards' does not seem to work.

Adding a WizardEmptyFolderFilter [1] to the NewWizardNewPage fixes that particular problem. Either we have to add it to all affected wizards or we find a common place to add the filter. For that, we should have steps / test cases for each individual wizard/problem, so that the fix can be verified.

[1] WizardEmptyFolderFilter
private class WizardEmptyFolderFilter extends ViewerFilter {
    public boolean select(Viewer viewer, Object parentElement, Object element) {
        if (element instanceof WizardCollectionElement) {
            WizardCollectionElement wce = (WizardCollectionElement) element;
            return wce.getChildren().length > 0;
        }
        return true;
    }
}
Comment 16 Daniel Rolka CLA 2013-08-13 09:11:39 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > (In reply to comment #13)
> > > (In reply to comment #12)
> > > > Created attachment 233486 [details]
> > > > picture2
> > > 
> > > Let's try with the following wizards dialog: File/New/Other...
> > > You should get the issue using it as well
> > > 
> > > Daniel
> > 
> > Yep, that does the trick, but your 'Show wizards' does not seem to work.
> 
> Adding a WizardEmptyFolderFilter [1] to the NewWizardNewPage fixes that
> particular problem. Either we have to add it to all affected wizards or we
> find a common place to add the filter. For that, we should have steps / test
> cases for each individual wizard/problem, so that the fix can be verified.
> 
> [1] WizardEmptyFolderFilter
> private class WizardEmptyFolderFilter extends ViewerFilter {
>     public boolean select(Viewer viewer, Object parentElement, Object
> element) {
>         if (element instanceof WizardCollectionElement) {
>             WizardCollectionElement wce = (WizardCollectionElement) element;
>             return wce.getChildren().length > 0;
>         }
>         return true;
>     }
> }

I've noticed an issue with this approach. Please follow the proper Gerrit's comments for more details. I've put the altered patch of my original solution for that to Gerrit - http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=05a1b7675bf9c450c71aa229a07106d7d4084715

Thanks in advance for review,
Daniel
Comment 17 Daniel Rolka CLA 2013-08-20 03:31:11 EDT
Created attachment 234560 [details]
Plugin that exposes the issue

Steps to reproduce the issue:

1) Launch the updated version of plugin (WizardFilteringIssue_modified.zip)
2) The plugin will add three toolbar buttons
3) Execute the 'Show wizards' button. The new dialog with wizards will be
   displayed
4) Enter the 'file' in the filter textbox
5) Verify the considered issue:
  a) Without the patch the empty 'General' category will be displayed 
     (see the 'Considered issue' attachment). If you don't see the empty
     category use the 'Modify activity' button to enable the activity filter

  b) After applying the fix the empty wizards list will be displayed

Please let me know if you need more information,
Daniel
Comment 18 Dani Megert CLA 2013-08-20 08:45:15 EDT
(In reply to comment #17)
> Created attachment 234560 [details]
> Plugin that exposes the issue
> 
> Steps to reproduce the issue:
> 
> 1) Launch the updated version of plugin (WizardFilteringIssue_modified.zip)
> 2) The plugin will add three toolbar buttons
> 3) Execute the 'Show wizards' button. The new dialog with wizards will be
>    displayed
> 4) Enter the 'file' in the filter textbox
> 5) Verify the considered issue:
>   a) Without the patch the empty 'General' category will be displayed 
>      (see the 'Considered issue' attachment). If you don't see the empty
>      category use the 'Modify activity' button to enable the activity filter
> 
>   b) After applying the fix the empty wizards list will be displayed
> 
> Please let me know if you need more information,
> Daniel

Those steps work, thanks.
Comment 19 Dani Megert CLA 2013-08-20 08:50:08 EDT
See https://git.eclipse.org/r/#/c/14554/ for proposed fixes.
Comment 20 Dani Megert CLA 2013-08-20 08:58:53 EDT
Retargeting to 4.4 since this is neither a new nor a major issue.
Comment 22 Daniel Rolka CLA 2013-09-17 05:15:11 EDT
Verified in the build: I20130916-2330