Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 151205 - [Viewers] Add setFilters() to change multiple filters at once efficiently
Summary: [Viewers] Add setFilters() to change multiple filters at once efficiently
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 3.3 M2   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-20 06:12 EDT by Thomas Schindl CLA
Modified: 2006-09-11 22:37 EDT (History)
0 users

See Also:


Attachments
Patch to add new API-Function (2.24 KB, patch)
2006-07-20 06:14 EDT, Thomas Schindl CLA
no flags Details | Diff
Adding API function to removeFilters/addFilters (1.98 KB, patch)
2006-07-28 12:09 EDT, Thomas Schindl CLA
no flags Details | Diff
Revised patch (2.37 KB, patch)
2006-08-01 08:04 EDT, Thomas Schindl CLA
no flags Details | Diff
Added new replace method (3.24 KB, patch)
2006-09-01 14:20 EDT, Thomas Schindl CLA
no flags Details | Diff
The implementation (3.07 KB, patch)
2006-09-11 12:52 EDT, Thomas Schindl CLA
no flags Details | Diff
NLP fix and Tests (5.29 KB, patch)
2006-09-11 13:46 EDT, Thomas Schindl CLA
no flags Details | Diff
Fixed test-problems with virtual (7.03 KB, patch)
2006-09-11 14:35 EDT, Thomas Schindl CLA
no flags Details | Diff
1.3 support ;-) (6.91 KB, patch)
2006-09-11 14:55 EDT, Thomas Schindl CLA
no flags Details | Diff
updated patch (7.23 KB, patch)
2006-09-11 22:29 EDT, Boris Bokowski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2006-07-20 06:12:55 EDT
When one needs to add more than one filter after every request a refresh command is issued which is not desired an API-Function where the user could control whether the refresh is called or not would be a great performance improvement.
Comment 1 Thomas Schindl CLA 2006-07-20 06:14:09 EDT
Created attachment 46567 [details]
Patch to add new API-Function

This patch adds the possiblity to control whether the viewer is automatically refresh or not
Comment 2 Boris Bokowski CLA 2006-07-28 11:20:35 EDT
Why not addFilters(ViewerFilter[]) ?
Comment 3 Thomas Schindl CLA 2006-07-28 11:50:55 EDT
Even better I thought about that after having submitted the code. Will prepare a patch.
(In reply to comment #2)
> Why not addFilters(ViewerFilter[]) ?
> 

Comment 4 Thomas Schindl CLA 2006-07-28 12:09:00 EDT
Created attachment 46960 [details]
Adding API function to removeFilters/addFilters

This implements the same behaviour than before but using removeFilters/addFilters instead of flags
Comment 5 Boris Bokowski CLA 2006-07-29 12:33:04 EDT
Your patch changes the behaviour of the existing remove method - see this comment in the original code:

// Note: can't use List.remove(Object). Use identity comparison
// instead.

I believe addFilters()/removeFilters() would have to use identity comparisons as well.
Comment 6 Thomas Schindl CLA 2006-08-01 08:04:59 EDT
Created attachment 47134 [details]
Revised patch

Hopefully this does create the same problem one should read and think about the comments before code ;-)
Comment 7 Thomas Schindl CLA 2006-09-01 14:20:47 EDT
Created attachment 49274 [details]
Added new replace method

Boris it would be nice if this patch could be accepted it's only a very small change but it is really vital to performance and user experience.
Comment 8 Boris Bokowski CLA 2006-09-01 23:10:39 EDT
Wouldn't it be simpler (and less new API) to just have a method void setFilters(ViewerFilter[] filters) ?
Comment 9 Thomas Schindl CLA 2006-09-11 12:52:27 EDT
Created attachment 49847 [details]
The implementation

You are completely right Boris.
Comment 10 Boris Bokowski CLA 2006-09-11 13:04:26 EDT
I would feel much better about putting this in if we had some test cases.  Tom, how can we help you with writing some JUnit tests?
Comment 11 Thomas Schindl CLA 2006-09-11 13:46:11 EDT
Created attachment 49855 [details]
NLP fix and Tests

You are right Boris and I found a bug in my implementation when there haven't been any filters. All tests pass beside the Virtual ones and I can't grasp why I think the implementation is now correct but maybe. I can't really grasp what the problem is maybe it's something todo that the item count is not decreased approrpiately?
Comment 12 Boris Bokowski CLA 2006-09-11 14:18:41 EDT
Filtering and sorting is not supported for the virtual case (when using an ILazyContentProvider).  You will have to override the new test methods in VirtualLazy*ViewerTest to do nothing, or only add the new methods to concrete subclasses like Table/TreeViewerTest.  This is not very clean, so if you have a better idea how to structure the tests please let me know.
Comment 13 Thomas Schindl CLA 2006-09-11 14:35:33 EDT
Created attachment 49863 [details]
Fixed test-problems with virtual

Oh. I see I think leaving the testFilter and testSetFilters next to each other is the better way.
Comment 14 Boris Bokowski CLA 2006-09-11 14:46:45 EDT
Sorry - one more:

Collections.addAll(this.filters, filters);

is @since 1.5, which we cannot use. JFace runs on CDC-1.0/Foundation-1.0 and J2SE-1.3 which means we can only use the subset of J2SE-1.3 supported by CDC-1.0/Foundation-1.0.

I suggest that you install a 1.3 JRE and make it known to Eclipse. PDE will then pick this up (see the Execution Environment section in the PDE editor) and set the classpath accordingly so that you cannot use 1.4 or 1.5 API for JFace anymore.
Comment 15 Thomas Schindl CLA 2006-09-11 14:55:15 EDT
Created attachment 49867 [details]
1.3 support ;-)
Comment 16 Thomas Schindl CLA 2006-09-11 14:57:30 EDT
(In reply to comment #14)

> I suggest that you install a 1.3 JRE and make it known to Eclipse. PDE will
> then pick this up (see the Execution Environment section in the PDE editor) and
> set the classpath accordingly so that you cannot use 1.4 or 1.5 API for JFace
> anymore.
> 

Is 1.3.1-18 ok?
Comment 17 Boris Bokowski CLA 2006-09-11 15:01:27 EDT
(In reply to comment #16)
> Is 1.3.1-18 ok?

Yes. I assume that just like Eclipse, Sun does not change API in maintenance releases.
Comment 18 Thomas Schindl CLA 2006-09-11 15:06:56 EDT
(In reply to comment #17)
> (In reply to comment #16)
> > Is 1.3.1-18 ok?
> 
> Yes. I assume that just like Eclipse, Sun does not change API in maintenance
> releases.
> 

ok, guess what jface doesn't compile any more because in DialogSettings there are classes used that don't exist in 1.3 like javax.xml.* and org.w3c.* do I need to add something like xerces to my class path then?
Comment 19 Boris Bokowski CLA 2006-09-11 22:29:18 EDT
Created attachment 49893 [details]
updated patch

I updated the patch once again: shortened Javadoc, setFilters() now does not take null, simplified the code in setFilters(), added contribution notices.

Released >20060911.
Comment 20 Boris Bokowski CLA 2006-09-11 22:31:07 EDT
Released >20060911. Thanks for your work, Tom!