Bug 263870 - [context] preserve filters in the resource navigator when using resourceFilters
Summary: [context] preserve filters in the resource navigator when using resourceFilters
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 enhancement (vote)
Target Milestone: 3.1   Edit
Assignee: David Shepherd CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-05 16:39 EST by David Shepherd CLA
Modified: 2009-03-04 18:59 EST (History)
2 users (show)

See Also:


Attachments
proposed solution (16.99 KB, patch)
2009-02-10 20:29 EST, Mik Kersten CLA
no flags Details | Diff
mylyn/context/zip (36.03 KB, application/octet-stream)
2009-02-10 20:30 EST, Mik Kersten CLA
no flags Details
This patch will preserve filters for the resources view (assuming the first patch has already been applied). (3.90 KB, patch)
2009-02-11 14:12 EST, David Shepherd CLA
no flags Details | Diff
mylyn/context/zip (42.74 KB, application/octet-stream)
2009-02-11 14:12 EST, David Shepherd CLA
no flags Details
test (20.28 KB, application/xml)
2009-03-04 17:24 EST, Mik Kersten CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Shepherd CLA 2009-02-05 16:39:41 EST
When filters are added in the following manner:
   <extension
           id="myfilterId"
           name="myFilter"
           point="org.eclipse.ui.ide.resourceFilters">
		<filter selected="true"  pattern="*.txt"></filter>		
	</extension>
Mylyn does not preserve the filter in focused mode.   This is because there is no backing class. This is a problem in the resource navigator view and in new file creation dialog.
Comment 1 Mik Kersten CLA 2009-02-06 10:24:48 EST
I recall adding a mechanism for preserving filters contributed by XML.  Are you saying that it's not there or that it's not working?
Comment 2 Shawn Minto CLA 2009-02-06 11:41:00 EST
Mik, there is a way to register id based filters and get them, but only class based filters are accounted for when determining the preserved filters.  So, the framework is there, we just need to make use of it in some way.
Comment 3 Mik Kersten CLA 2009-02-10 20:29:59 EST
Created attachment 125342 [details]
proposed solution

David: please review and test.
Comment 4 Mik Kersten CLA 2009-02-10 20:30:02 EST
Created attachment 125343 [details]
mylyn/context/zip
Comment 5 David Shepherd CLA 2009-02-11 12:58:00 EST
This patch does not work for me, as it does not preserve pattern-based filters in the resource navigator view.  It likely preserves pattern filters in the common navigator view (untested by me), and for this reason might be worth keeping.  The problem seems to be that the patch is working on the FocusCommonNavigatorAction when it should probably be working on the FocusResourceNavigatorAction.  Let me know if you need further information..
Comment 6 David Shepherd CLA 2009-02-11 13:22:52 EST
This patch does work to preserve pattern filters in the common navigator view, I just tested it and it works well.
Comment 7 David Shepherd CLA 2009-02-11 14:12:48 EST
Created attachment 125433 [details]
This patch will preserve filters for the resources view (assuming the first patch has already been applied).

Note: Because the Resources Navigator contains only a single filter for patterns, then if one pattern filter is preserved all must be preserved, and vice versa.
Comment 8 David Shepherd CLA 2009-02-11 14:12:52 EST
Created attachment 125434 [details]
mylyn/context/zip
Comment 9 Mik Kersten CLA 2009-02-26 20:23:59 EST
David: Note the change that I made over your patch because your isPreservedFilter(..) would always return true.  Please make sure to re-test this thoroughly to make sure that we are not preserving all filters.
Comment 10 Mik Kersten CLA 2009-02-26 20:25:19 EST
Patch applied.  Have to get permission to include in 3.1, otherwise will have to backtrack patch.
Comment 11 David Shepherd CLA 2009-03-02 13:58:30 EST
Unfortunately this patch does not work as I expected.  Because the resource filters are all stored within a single class, the ResourcePatternFilter, then if any resource filter is specified as preserved then all resource pattern filters will be preserved.   
e.g., filterA and filterB are resourcepatternfilters, then if filterA is marked as preserved filterB is preserved as well.

The problem is that the method isPreservedFilter(..) returns a true for the entire ResourcePatternFilter, which holds all resourcepatternfilter patterns.  Each filter would have to be implemented as a separate filter to work.  

I think that this side-effect is acceptable, however, because it doesn't break my expectations too much.  I usually want filters preserved in focus mode anyway, especially if I have marked one or more as preserved.  
Comment 12 Mik Kersten CLA 2009-03-02 16:01:34 EST
Reopening to review.
Comment 13 Steffen Pingel CLA 2009-03-02 18:32:41 EST
The documentation of the extension point should be updated and possibly the extension point itself. We currently support preserving of all resource filters in the resource navigator and expression filters in common navigator views based on ids. To make preservation of resource filters work on a more fine-grained level, the pattern that is intended to be preserved would need to be specified in the Mylyn extension point.
Comment 14 Mik Kersten CLA 2009-03-04 17:24:50 EST
Created attachment 127572 [details]
test
Comment 15 Mik Kersten CLA 2009-03-04 17:32:48 EST
Updated documentation and reverted patch.

Steffen: Please reverse David's patch since we won't support this for the resource Navigator view.
Comment 16 Steffen Pingel CLA 2009-03-04 18:59:10 EST
Change in FocusResourceNavigatorAction reverted.