Bug 207064 - Bundles Launch Configuration should support filtering
Summary: Bundles Launch Configuration should support filtering
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Ian Bull CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
: 154592 (view as bug list)
Depends on: 207637
Blocks:
  Show dependency tree
 
Reported: 2007-10-22 11:55 EDT by Chris Aniszczyk CLA
Modified: 2008-02-22 13:49 EST (History)
4 users (show)

See Also:
caniszczyk: review? (caniszczyk)


Attachments
FilteredCheckboxTreeViewer (3.38 KB, text/plain)
2007-10-26 13:17 EDT, Ian Bull CLA
no flags Details
Initial version of a filtered tree for the launch configuration (34.60 KB, patch)
2007-10-29 16:48 EDT, Ian Bull CLA
no flags Details | Diff
mylyn/context/zip (95.74 KB, application/octet-stream)
2007-10-29 16:48 EDT, Ian Bull CLA
no flags Details
Updated patch for filtered checkbox tree (36.17 KB, patch)
2007-10-30 00:13 EDT, Ian Bull CLA
no flags Details | Diff
mylyn/context/zip (98.00 KB, application/octet-stream)
2007-10-30 00:13 EDT, Ian Bull CLA
no flags Details
Patch (26.71 KB, patch)
2008-02-18 21:46 EST, Ian Bull CLA
no flags Details | Diff
mylyn/context/zip (100.69 KB, application/octet-stream)
2008-02-18 21:46 EST, Ian Bull CLA
no flags Details
Patch (Feb 20) (29.08 KB, text/plain)
2008-02-20 20:09 EST, Ian Bull CLA
no flags Details
mylyn/context/zip (177.26 KB, application/octet-stream)
2008-02-20 20:09 EST, Ian Bull CLA
no flags Details
Patch (Feb21) (33.19 KB, patch)
2008-02-21 02:54 EST, Ian Bull CLA
no flags Details | Diff
mylyn/context/zip (181.06 KB, application/octet-stream)
2008-02-21 02:55 EST, Ian Bull CLA
no flags Details
Another Patch (32.31 KB, patch)
2008-02-21 20:46 EST, Ian Bull CLA
no flags Details | Diff
mylyn/context/zip (181.75 KB, application/octet-stream)
2008-02-21 20:46 EST, Ian Bull CLA
no flags Details
org.eclipse.pde.ui.patch (36.67 KB, patch)
2008-02-22 10:28 EST, Chris Aniszczyk CLA
no flags Details | Diff
mylyn/context/zip (182.98 KB, application/octet-stream)
2008-02-22 10:28 EST, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Aniszczyk CLA 2007-10-22 11:55:11 EDT
see bug 204404 for some more information
Comment 1 Ian Bull CLA 2007-10-22 13:24:48 EDT
This is a bit of work, since there is no filtered checkbox tree. The naive solution doesn't work, since you must maintain the checkbox state whenever a refresh happens (and in our case we don't actually have a model that maintains check state).  As well, tree/table viewers don't have refresh listeners.  Currently I am addressing this issue by overriding all the refresh operations and  saving the check state, and then putting them back.  There must be a better way.

Anyone have any pointers. 
Comment 2 Chris Aniszczyk CLA 2007-10-22 14:06:35 EDT
ok, if this is too tricky, I would worry less about it as the other bug does quite a bit for us.
Comment 3 Ian Bull CLA 2007-10-26 13:17:57 EDT
Created attachment 81280 [details]
FilteredCheckboxTreeViewer

Here is the first crack at a filtered checkboxtreeviewer.  This viewer saves all the items which have a check before a refresh, and then after the refresh it puts the check back.   

This viewer will be needed for this bug, so I am putting it here so I don't loose the code :-)
Comment 4 Ian Bull CLA 2007-10-29 16:48:24 EDT
Created attachment 81502 [details]
Initial version of a filtered tree for the launch configuration

This is an initial version of the launch configuration.  The patch still needs some TLC, but it outlines the basic approach.  

I think we will need some people to checkout the behaviour since a filtered checkbox tree is not common in Eclipse, so the interactions may not be right.  Maybe we can get this in early in the M4 release cycle so we have lots to time to test it out.
Comment 5 Ian Bull CLA 2007-10-29 16:48:34 EDT
Created attachment 81503 [details]
mylyn/context/zip
Comment 6 Chris Aniszczyk CLA 2007-10-29 16:50:12 EDT
targetting to 3.4M4
Comment 7 Ian Bull CLA 2007-10-30 00:13:20 EDT
Created attachment 81545 [details]
Updated patch for filtered checkbox tree

Here is an updated patch with some comments and TLC.  Chris / Brian, you can probably start to review this (when you get a chance). 

We may also want to get some of the equinox guys to try it out and see if it makes sense or not.
Comment 8 Ian Bull CLA 2007-10-30 00:13:27 EDT
Created attachment 81546 [details]
mylyn/context/zip
Comment 9 Chris Aniszczyk CLA 2007-10-30 10:45:41 EDT
We will start making the Equinox guys too productive with all your good work Ian :)
Comment 10 Ian Bull CLA 2007-10-30 16:37:13 EDT
When you actually review this, let me know.  We can hit IRC if you have questions.  There were a lot of changes in the OSGiBundleBlock because the existing version assumed that all checked bundles have a TreeItem.  However, if you filter some nodes, they are still considered "checked".

The basic approach I took was to create a FilteredCheckboxTree which contains a cache of all elements in the tree.  This way, even when an item is filtered, you can still get / set its checked state.
Comment 11 Ian Bull CLA 2007-10-31 13:11:24 EDT
*** Bug 154592 has been marked as a duplicate of this bug. ***
Comment 12 Chris Aniszczyk CLA 2007-11-02 16:06:47 EDT
Almost there Ian, it even works well on a large set of bundles (RSA's ~1000 bundles) however a few issues need to be addressed to get us to the finish line:

1) The buttons like 'Select All', etc... should be aligned with the jface viewer so users can associate that the buttons act on the actual plug-ins within the viewer

2) The semantics of 'Select All' and 'Deselect All' should apply to whatever is filtered / displayed. It shouldn't apply to everything. This is a similar approach we take in the Import Plug-ins and Fragments wizard.

3) I notice some flicker and lag. The refresh should happen in a WorkbenchJob with a delay of about 200 ms. Take inspiration from PluginImportWizardDetailedPage and its clever way of filtering things in a responsive way.

4) I also got an NPE while toying with the code:
java.lang.NullPointerException
at org.eclipse.pde.internal.ui.launcher.OSGiBundleBlock.handleGroupStateChanged(OSGiBundleBlock.java:297)
at org.eclipse.pde.internal.ui.launcher.AbstractPluginBlock.toggleGroups(AbstractPluginBlock.java:444)
at org.eclipse.pde.internal.ui.launcher.AbstractPluginBlock$Listener.filterAffectingControl(AbstractPluginBlock.java:128)
at org.eclipse.pde.internal.ui.launcher.AbstractPluginBlock$Listener.widgetSelected(AbstractPluginBlock.java:156)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) 

This is great work Ian. I'm excited about this stuff as much as I am about the Plug-in Spy at the moment :)
Comment 13 Ian Bull CLA 2007-11-02 16:59:47 EDT
(In reply to comment #12)
> 1) The buttons like 'Select All', etc... should be aligned with the jface
> viewer so users can associate that the buttons act on the actual plug-ins
> within the viewer
Ok, I will fix this. 


> 
> 2) The semantics of 'Select All' and 'Deselect All' should apply to whatever is
> filtered / displayed. It shouldn't apply to everything. This is a similar
> approach we take in the Import Plug-ins and Fragments wizard.
Hum... the reason I went with this was because of the "add required bundles". How should this button act? Does it only add the required bundles that are currently visible?  Should this act differently from select all?

Chris suggested that we disable the "Add Required", "Working Set" and "Restore Defaults" when filtering, since their behaviour is not clear.

> 
> 3) I notice some flicker and lag. The refresh should happen in a WorkbenchJob
> with a delay of about 200 ms. Take inspiration from
> PluginImportWizardDetailedPage and its clever way of filtering things in a
> responsive way.
> 
I'm pretty sure this is what happens in the FilteredTree (which I extend).  If you look at the FilteredTree::textChange() method this seems to do this.  I will keep an eye out for this.

> 4) I also got an NPE while toying with the code:
Yikes... ok, I will look into this.
Comment 14 Chris Aniszczyk CLA 2007-11-02 17:05:27 EDT
For #3, use the Import Plug-ins wizard as a  litmus test... there's no flicker there.

Thanks again!
Comment 15 Chris Aniszczyk CLA 2007-12-03 12:08:49 EST
Ian, any time to get this in for M4?
Comment 16 Chris Aniszczyk CLA 2007-12-11 14:01:39 EST
Let's move this to M5
Comment 17 Ian Bull CLA 2007-12-11 14:08:44 EST
Thanks Chris,

I haven't forgotten about this :-).  I spent part of the weekend getting this to work again (a lot has changed in eclipse core since M3), but I was able to get it working with last weeks I build.  I will work on this early in the M5 cycle to *make sure* it gets in. (and doesn't become the reason for an M5a) :-)

Comment 18 Ian Bull CLA 2008-02-18 17:14:18 EST
I have some time this week while my supervisor reads my thesis :-), so I thought I would return to this bug.  I am having a hard time applying my patch since a bunch of formatting was done to both the AbstractPluginBlock and OSGiBundleBlock on Jan16.

Are these formatting rules published somewhere? Was there a reason for this?

Also, I noticed we are now using import java.util.* instead of java.util.Set, etc...  Is this a new standard?

Comment 19 Chris Aniszczyk CLA 2008-02-18 17:33:23 EST
ya, each PDE project has project-level settings along with formatting options.

Sorry that this affected the patch :(
Comment 20 Ian Bull CLA 2008-02-18 21:46:28 EST
Created attachment 90017 [details]
Patch

No worries, I have updated my original patch so it can now be applied again.  This is still the same patch (with the same problems), but at least I can start working on this bug again :-).
Comment 21 Ian Bull CLA 2008-02-18 21:46:31 EST
Created attachment 90018 [details]
mylyn/context/zip
Comment 22 Ian Bull CLA 2008-02-20 20:09:34 EST
Created attachment 90264 [details]
Patch (Feb 20)

This is an updated patch. It fixes most of Chris's comments, but there is still one issue remaning.  I will work on it tonight.
Comment 23 Ian Bull CLA 2008-02-20 20:09:38 EST
Created attachment 90265 [details]
mylyn/context/zip
Comment 24 Ian Bull CLA 2008-02-21 02:54:53 EST
Created attachment 90297 [details]
Patch (Feb21)

This patch addresses the comments Chris had.  If someone would like to take it for a spin and post comments, it would be much appreciated.
Comment 25 Ian Bull CLA 2008-02-21 02:55:01 EST
Created attachment 90298 [details]
mylyn/context/zip
Comment 26 Ian Bull CLA 2008-02-21 20:46:52 EST
Created attachment 90433 [details]
Another Patch

I have fixed up the code a bit, added some documentation and made a few tweaks.  This patch should be good to go.  Any takers :-)
Comment 27 Ian Bull CLA 2008-02-21 20:46:55 EST
Created attachment 90434 [details]
mylyn/context/zip
Comment 28 Chris Aniszczyk CLA 2008-02-22 10:26:45 EST
reviewing...
Comment 29 Chris Aniszczyk CLA 2008-02-22 10:28:45 EST
Created attachment 90468 [details]
org.eclipse.pde.ui.patch

I updated the patch to add a separator between the pluginviewer and everything else. This makes it look a bit cleaner with the new filtered text there. I also did some code cleanup and fixed some copyrights.

This should make its way into the next I-build and hopefully please people that deal with complex launch configurations.
Comment 30 Chris Aniszczyk CLA 2008-02-22 10:28:49 EST
Created attachment 90469 [details]
mylyn/context/zip
Comment 31 Chris Aniszczyk CLA 2008-02-22 10:29:43 EST
Thanks for the good work Ian!

Simon Archer has one less thing to complain about :)
Comment 32 Ian Bull CLA 2008-02-22 10:50:46 EST
Thanks Chris,

The separator looks good!  I will grab the next I-Build when it comes out and continue to test this.  There are still a few open issues I discovered, and I have opened bugs for these.