Bug 149110 - [package explorer] Text Box Filter in Package Explorer
Summary: [package explorer] Text Box Filter in Package Explorer
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 enhancement with 8 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 151638 204036 210573 218316 264370 386309 417401 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-29 00:09 EDT by whackity CLA
Modified: 2018-12-07 13:25 EST (History)
20 users (show)

See Also:


Attachments
UI mock-up. (52.32 KB, image/png)
2010-04-28 15:35 EDT, Simon Archer CLA
no flags Details
Screenshot (9.28 KB, image/png)
2012-08-09 04:42 EDT, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description whackity CLA 2006-06-29 00:09:42 EDT
In a project with a lot of files, it would be nice to be able to have a text box in the Package Explorer that automatically filters and fills the list with matching files. Like the "type filter text" in the Preferences window.

It's much quicker than having to define multiple Working Sets or drill down the tree until you find the file you want.
Comment 1 Martin Aeschlimann CLA 2006-07-04 09:13:32 EDT
We are planing to experiment with that in 3.3
Comment 2 Martin Aeschlimann CLA 2006-07-25 09:18:07 EDT
*** Bug 151638 has been marked as a duplicate of this bug. ***
Comment 3 Martin Aeschlimann CLA 2007-11-22 03:35:56 EST
*** Bug 204036 has been marked as a duplicate of this bug. ***
Comment 4 Martin Aeschlimann CLA 2007-11-22 03:36:16 EST
*** Bug 210573 has been marked as a duplicate of this bug. ***
Comment 5 Martin Aeschlimann CLA 2007-11-22 03:45:13 EST
bug 69200 is the corresponding request for the navigator. See bug 69200 comment 7 why this request is non-trivial.
Comment 6 Martin Aeschlimann CLA 2008-02-11 04:25:33 EST
*** Bug 218316 has been marked as a duplicate of this bug. ***
Comment 7 Eugene Kuleshov CLA 2008-06-12 09:53:40 EDT
I'd like to reiterate on this issue. So, we need a quickfilter in Package Explorer and/or Navigator views. I think there is an approach that may work in those views without hurting performance or memory.

If you think of such filter as search, then there is already backend that is capable of running such searches that is used in "Open Type" and "Open Resouce" dialogs. Now Package Explorer view just need to flip input to the search results.
Comment 8 Dani Megert CLA 2009-02-10 11:24:53 EST
*** Bug 264370 has been marked as a duplicate of this bug. ***
Comment 9 Simon Archer CLA 2010-04-28 15:33:22 EDT
Also see bug 34705.
Comment 10 Simon Archer CLA 2010-04-28 15:35:16 EDT
Created attachment 166368 [details]
UI mock-up.

UI mock-up from bug 34705.
Comment 11 Dani Megert CLA 2012-08-02 03:44:49 EDT
*** Bug 386309 has been marked as a duplicate of this bug. ***
Comment 12 Lars Vogel CLA 2012-08-02 04:00:40 EDT
I put the search box in the content of the view, see here: https://github.com/vogella/jdt-package-explorer or use this update site to try it: http://www.vogella.com/updatesite/jdt

Is this an option or is it required to go into the view header? I personally like both approaches, putting it in the view header makes it a bit crowded IMHO but saves space for the content.
Comment 13 Dani Megert CLA 2012-08-02 06:42:30 EDT
(In reply to comment #12)
> I put the search box in the content of the view, see here:
> https://github.com/vogella/jdt-package-explorer or use this update site to
> try it: http://www.vogella.com/updatesite/jdt
> 
> Is this an option or is it required to go into the view header? I personally
> like both approaches, putting it in the view header makes it a bit crowded
> IMHO but saves space for the content.

Could you attach some screenshots?
Comment 14 Markus Keller CLA 2012-08-02 10:16:32 EDT
The UI is not the main blocker here.

The main problems are:
- filter behavior (does it only consider visible elements or all possible children at all levels?; cf. bug 69200 comment 17)
- filtering performance (bug 69200 comment 7)
- efficiency and correctness when model changes must be reflected in the view

Lars, how does your proposal deal with these issues? I don't have time to decipher whitespace changes in https://github.com/vogella/jdt-package-explorer/commit/97a8c0d31938112a6d39e3a7cada8538590f3b58
Comment 15 Lars Vogel CLA 2012-08-09 04:42:10 EDT
Created attachment 219703 [details]
Screenshot

@Dani: Screenshot attached
Comment 16 Lars Vogel CLA 2012-08-09 04:49:13 EDT
@Markus: If desired I can redo the change without whitespace changes, sorry for that I assumed JDT would use the default Eclipse formatter. 

To your questions:
1.) I only filter on project names, e.g. the top node. This way I have a "dynamic project name based working set" like behavior.  

2.) The check does not add any runtime complexity in the O notation as it is a fixed set of instructions and is included in the content provider.  

private boolean matchesFilter(Object project) {
		if (project instanceof IProject) {
			IProject p= (IProject) project;
			String name= getProjectName(p);
			return pattern.matches(name);
		}
		if (project instanceof IJavaElement) {
			IJavaElement p = (IJavaElement) project;
			return pattern.matches(p.getElementName());
		}
		// Should never be called
		return true;
	}

3.) Check is included in the PackageExplorerContentProvider, so everything which refreshes the content provider will also refresh the filter.

Let me know if I should create a whitespace free solution. If I make the change I plan also to use a ViewerFilter directly.
Comment 17 Lars Vogel CLA 2012-08-09 04:50:14 EDT
The comment // Should never be called is incorrect. Will return true for all other elements than IProject and IJavaElement
Comment 18 Dani Megert CLA 2012-08-09 05:19:03 EDT
See bug 69200 for a more general approach.
Comment 19 Lars Vogel CLA 2012-08-09 05:25:53 EDT
@Dani: IMHO Bug 69200 is a different feature request. It is an improved find feature while this Bug is about a dynamic filter for the tree.
Comment 20 Dani Megert CLA 2012-08-09 05:30:12 EDT
(In reply to comment #19)
> @Dani: IMHO Bug 69200 is a different feature request. It is an improved find
> feature while this Bug is about a dynamic filter for the tree.

Well, it's somehow connected. If there's a generic way to search, then you can also filter, which is probably what bug 69200 would implement anyway.
Comment 21 Eric Rizzo CLA 2012-08-09 10:02:01 EDT
(In reply to comment #20)
> (In reply to comment #19)
> > @Dani: IMHO Bug 69200 is a different feature request. It is an improved find
> > feature while this Bug is about a dynamic filter for the tree.
> 
> Well, it's somehow connected. If there's a generic way to search, then you
> can also filter, which is probably what bug 69200 would implement anyway.

That's probably true, but look at the age of that bug; is it realistic that it will actually be implemented in the foreseeable future (ie, the next release or two)? Given the infrastructure nature and open questions around it, I'm skeptical. Here, however, we have a much smaller scope feature that *has a working patch*. IMO it is foolish to reject it just because there's a discussion (not plan, no code) about a more generic solution out there. I can tell you from hard-earned experience that the lack of this feature really hurts Eclipse for very large workspaces.
Comment 22 Dani Megert CLA 2013-09-17 05:14:09 EDT
*** Bug 417401 has been marked as a duplicate of this bug. ***
Comment 23 Lars Vogel CLA 2013-09-17 05:22:53 EDT
(In reply to Markus Keller 'away till 2013-09-22' from comment #14)
> Lars, how does your proposal deal with these issues? I don't have time to
> decipher whitespace changes in
> https://github.com/vogella/jdt-package-explorer/commit/
> 97a8c0d31938112a6d39e3a7cada8538590f3b58

Shall I create a Gerrit review for this change?
Comment 24 Dani Megert CLA 2013-09-17 05:26:16 EDT
(In reply to Lars Vogel from comment #23)
> (In reply to Markus Keller 'away till 2013-09-22' from comment #14)
> > Lars, how does your proposal deal with these issues? I don't have time to
> > decipher whitespace changes in
> > https://github.com/vogella/jdt-package-explorer/commit/
> > 97a8c0d31938112a6d39e3a7cada8538590f3b58
> 
> Shall I create a Gerrit review for this change?

I prefer a more general solution (see bug bug 69200) and at the moment we are too busy with Java 8 to spend time for changes like this one.
Comment 25 Eric Rizzo CLA 2013-09-17 10:06:56 EDT
(In reply to Dani Megert from comment #24)
> (In reply to Lars Vogel from comment #23)
> > (In reply to Markus Keller 'away till 2013-09-22' from comment #14)
> > > Lars, how does your proposal deal with these issues? I don't have time to
> > > decipher whitespace changes in
> > > https://github.com/vogella/jdt-package-explorer/commit/
> > > 97a8c0d31938112a6d39e3a7cada8538590f3b58
> > 
> > Shall I create a Gerrit review for this change?
> 
> I prefer a more general solution (see bug bug 69200) and at the moment we
> are too busy with Java 8 to spend time for changes like this one.

Sad response. See Comment 21 above.
Comment 26 Vincenzo Caselli CLA 2014-10-31 11:24:15 EDT
I agree with Eric ("I can tell you from hard-earned experience that the lack of this feature really hurts Eclipse for very large workspaces.").

I tried the solution proposed by Lars and find it very good.

Maybe there could be an action (http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_basicext_viewActions.htm) with a 'filter' icon, to activate this textbox, disabled by default. In this way users are:
1) not alarmed by this new thing
2) lightly invited to this new thing :)
but this is not very important in the end.

Instead having this feature is very important IMHO.