DESCRIPTION

Bug 506931 -  [CommonNavigator] A quick filter possibility in Project
Explorer and other CNF viewers

Change-Id: I30ea6878c9ad86f25feae2fef45b3dc0b2d00126
Signed-off-by: Clara Kelly xxx@xxx.xxx

COMMENTS

author: Clara Kelly
date: 2017-03-24 08:59:12.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2017-03-24 08:59:18.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/12266/

-------------------------------------
author: Brenden Conley
date: 2017-03-24 09:26:10.000000000

Patch Set 2: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/12266/ : UNSTABLE

-------------------------------------
author: Isis Velasquez
date: 2017-03-24 16:29:03.000000000

Patch Set 2:

It seems to me that only shortcuts or quick access are available to trigger the command. I don't think users will easily discover and enjoy it. Would it be possible to add a toolitem contribution in the view toolbar to control it?

-------------------------------------
author: Lorelei Hammond
date: 2017-03-24 16:36:03.000000000

Patch Set 2:

Hi Stefan,
I'm actually having trouble getting Incremental Find to work on project explorer/cnf viewers. Would you be able to upload some screenshots (better yet a webm) displaying your improvements? Thanks!

-------------------------------------
author: Clara Kelly
date: 2017-03-24 19:33:46.000000000

Patch Set 2:

> Hi Stefan,
 > I'm actually having trouble getting Incremental Find to work on
 > project explorer/cnf viewers. Would you be able to upload some
 > screenshots (better yet a webm) displaying your improvements?
 > Thanks!

I have tweeted a video: https://twitter.com/xpomul/status/845354976771756032
Project Explorer needs to have focus, then CTRL+J (or CMD+J on Mac) should show the text field in the status line. The latter was Lars' idea because the TextEditor also uses the status line.
After the comment of Mickael, however, I feel a button in the view's toolbar which shows/hides a text field above the CommonViewer is more intuitive and has more relation to the actual context... I will try to upload a new patch tomorrow...

Best,
Stefan

-------------------------------------
author: Zaid Mosley
date: 2017-03-27 08:29:10.000000000

Patch Set 2:

> Project Explorer needs to have focus, then CTRL+J (or CMD+J on Mac)
 > should show the text field in the status line. The latter was Lars'
 > idea because the TextEditor also uses the status line.

+1 for the status line approach, we should avoid any blocking dialog if possible. 
I suggest to use CTRL+F to make it easier to discover this feature. At some point I would also like to move the text editor search to a non blocking approach.

-------------------------------------
author: Clara Kelly
date: 2017-03-27 08:44:05.000000000

Patch Set 2:

Hi Lars, I didn't mean to have the text field in a separate dialog. I just wanted to add a composite between the toolbar and the tree in the CommonNavigator view holding the text field. 
The composite would be hidden per default and only on CTRL+J it would be shown. And only as long as the "search mode" is active.
Having it directly inside the view has the advantage that the user can see it in context. Otherwise, the optical distance between the status line and the view is too big. The user cannot intuitively see what this text field belongs to (especially so, if the user presses CTRL+J by chance...).

The (only) issue with the text field in the view is that adding the composite to the CommonNavigator view as described above requires a new method and we are past API freeze for Oxygen. I could do it just for the project explorer for Oxygen and we add general CommonNavigator support in the next release.

(The status line approach would be less invasive and would be possible without API change, but with the disadvantage of being less intuitive in my opinion).

-------------------------------------
author: Zaid Mosley
date: 2017-03-27 08:48:33.000000000

Patch Set 2:

Sounds good to me Stefan. Except that I suggest to use CTRL+F instead of CTRL+J.

-------------------------------------
author: Isis Velasquez
date: 2017-03-27 08:57:42.000000000

Patch Set 2:

> The (only) issue with the text field in the view is that adding the composite to the CommonNavigator view as described above requires a new method and we are past API freeze for Oxygen. I could do it just for the project explorer for Oxygen and we add general CommonNavigator support in the next release.

IIRC, when on a graphical editor, GEF (or GMF) manages to show in the main toolbar a "combo" item which allows user to directly enter text. I think a similar widget can be displayed directly in the Project Explorer toolbar, as a toolitem, using regular existing APIs.

-------------------------------------
author: Isis Velasquez
date: 2017-03-27 09:19:02.000000000

Patch Set 2:

> ...

The interesting class would be ZoomComboContributionItem

-------------------------------------
author: Lorelei Hammond
date: 2017-03-27 13:52:18.000000000

Patch Set 2:

> Sounds good to me Stefan. Except that I suggest to use CTRL+F
 > instead of CTRL+J.

+1 to this. I think its more intuitive to have it as CTRL+F in this specific use case

-------------------------------------
author: Clara Kelly
date: 2017-03-29 13:58:54.000000000

Patch Set 2:

Hi all,
big revamped patch incoming.
I could not achieve to add a text field to the tool bar. It would be possible in theory the way GEF does it, BUT: GEF contributes to the main toolbar. In this case, I'd need to contribute to the view's toolbar. But right of the last toolbar button is the view menu, which always comes after the toolbar. Adding a text field would lead to ugly-looking line breaks.

In the incoming patch, I again added a composite to the CommonNavigator View. It works, albeit it is a bit hacky, because I traverse the SWT containment hierarchy. But as we have control over the createControl() of the CommonViewer, I think it is safe to assume the SWT hierarchy until after 4.7 is release (then the API should be exposed and the helper should be refactored, as the code comments say).

Also, when I tried it with a larger workspace, it turned out that performance is a big issue. I have tried to optimize by using a job and by pruning all non-resource elements, but still the first filtering takes about 5s.
So, if anyone has an idea on how we could improve this further, please make suggestions.

-------------------------------------
author: Clara Kelly
date: 2017-03-29 14:39:19.000000000

Patch Set 2:

Ok, just now I realized that the speed can be improved by using Java8 parallelStream in the filter calculation. With this, I am down from 5s to about 2,5s in my case (of course depends on the size of the workspace).

One thing which is not part of the 5s, and which could be improved is:
Currently, after the filter element calculation I call expandAll() on the filtered tree. This also takes some time (and partially blocks the UI thread because viewer.expandAll() is implemeted this way).
Instead of revealing all filtered leaf nodes, I could also just reveal the first one.
What is your opinion here?

Personally, I would expect the tree to be expanded with all items, but maybe you have other opinions?

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