Bug 193849 - allow filtering of completed tasks open task dialog
Summary: allow filtering of completed tasks open task dialog
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P4 enhancement (vote)
Target Milestone: 2.2   Edit
Assignee: Willian Mitsuda CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted, noteworthy
Depends on:
Blocks:
 
Reported: 2007-06-21 19:58 EDT by Steffen Pingel CLA
Modified: 2007-11-29 13:53 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch (25.43 KB, patch)
2007-07-14 17:20 EDT, Willian Mitsuda CLA
no flags Details | Diff
mylyn/context/zip (53.35 KB, application/octet-stream)
2007-07-14 17:20 EDT, Willian Mitsuda CLA
no flags Details
Updated patch (28.37 KB, patch)
2007-08-05 22:44 EDT, Willian Mitsuda CLA
no flags Details | Diff
mylyn/context/zip (70.58 KB, application/octet-stream)
2007-08-05 22:44 EDT, Willian Mitsuda CLA
no flags Details
Updated patch (29.27 KB, patch)
2007-10-15 18:20 EDT, Willian Mitsuda CLA
no flags Details | Diff
mylyn/context/zip (73.31 KB, application/octet-stream)
2007-10-15 18:20 EDT, Willian Mitsuda CLA
no flags Details
Updated patch (27.45 KB, patch)
2007-10-26 01:08 EDT, Willian Mitsuda CLA
no flags Details | Diff
mylyn/context/zip (74.31 KB, application/octet-stream)
2007-10-26 01:08 EDT, Willian Mitsuda CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2007-06-21 19:58:36 EDT
The list of tasks displayed in the dialog can be very long when the task list has accumulated many tasks over time. It would be great if there was a way to toggle the list with a short cut to filter all completed tasks.
Comment 1 Mik Kersten CLA 2007-06-22 15:22:00 EDT
+1  This can be as simple as a checkbox near Open with Browser.
Comment 2 Steffen Pingel CLA 2007-06-22 15:39:04 EDT
I was thinking of using a FilteredItemsSelectionDialog and using the view menu making it similar to the JDT "Open Type" dialog.
Comment 3 Mik Kersten CLA 2007-06-22 15:45:54 EDT
That would be great.  We might get some better performance too.  For some reason the current Open Task dialog is very slow to open, at least on my workspace with thousands of tasks.  But it shouldn't be (performance prolbem could be on our end though).
Comment 4 Eugene Kuleshov CLA 2007-06-22 15:52:12 EDT
-1 for checkbox
+1 for drop down menu like in "Open Type" dialog (it could also have some sort modes too)

I think current implementation is creating temporary list with the search results and populating list widget every time. It should instead use the same model as the Task List.
Comment 5 Mik Kersten CLA 2007-06-22 16:07:27 EDT
+1 for for drop down menu as well, that is the right place for filter/sorter UI as Eugene points out.  This will be at the cost of discoverability but I think that the consistency is worth it.
Comment 6 Eugene Kuleshov CLA 2007-06-22 16:19:18 EDT
It would also make it easier to merge "open..." dialogs.
Comment 7 Willian Mitsuda CLA 2007-07-07 18:09:05 EDT
I can take a look at this one.

 (In reply to comment #3)
> That would be great.  We might get some better performance too.  For some reason
> the current Open Task dialog is very slow to open, at least on my workspace with
> thousands of tasks.  But it shouldn't be (performance prolbem could be on our
> end though).

Current implementation calculates a set of all your tasks (TaskList.getAllTasks()) + all query hits (AbstractRepositoryQuery.getChildren()) to be the input of filtered tree.

Perhaps (I didn't made any benchmarks) this is a expensive job. Question: with all API changes made on 2.0, is this still necessary? Is there a better way to get a union of all tasks + query hits from your workspace?

The initial display is based on your task activation history.

Just in case, how many tasks you have on your task list (+-)? And what is the size (+-) of your activation history?
Comment 8 Eugene Kuleshov CLA 2007-07-07 18:20:14 EDT
Willian, in 2.0 TaskList.getAllTasks() will return all tasks because there is no hits anymore.
Comment 9 Mik Kersten CLA 2007-07-10 17:42:11 EDT
 (In reply to comment #7)
> Just in case, how many tasks you have on your task list (+-)? And what is the
> size (+-) of your activation history?

I have over 6000 tasks.  Based on some research results (e.g. Gonzales et al.) and some of our histories a good benchmark for activation history is 16 x days worked, so let's say 20K for a history.  But if that becomes a performance issue at any point we are likely to start collapsing it.
Comment 10 Willian Mitsuda CLA 2007-07-13 18:01:28 EDT
Update: I'm almost there and it is getting very good. I'm just fixing a few UI glitches.

I'm following Stephen's suggestion and converting to use FilteredItemsSelectionDialog, and thanks to all its "magic" we got for free, the filtering is much more quicker.
Comment 11 Mik Kersten CLA 2007-07-13 21:22:42 EDT
Great to hear!  I was itching for us to move to the new API :)
Comment 12 Willian Mitsuda CLA 2007-07-14 17:20:06 EDT
Created attachment 73797 [details]
Proposed patch
Comment 13 Willian Mitsuda CLA 2007-07-14 17:20:14 EDT
Created attachment 73798 [details]
mylyn/context/zip
Comment 14 Willian Mitsuda CLA 2007-07-14 18:01:55 EDT
Some comments about my last patch:

1 - I converted the dialog to use the FilteredItemsSelectionDialog, but there are some points (pros/cons) in adopting it:

Behavior changes related to the old implementation:

- This class is Eclipse 3.3 only.
- The implementation wraps the label provider and "cancel" the IColorProvider, so we lost all color decoration for tasks.
- This class provides its own history control. Previously I used the task list activation history.
- The last accessed items are sorted alphabetically, rather than by last access order. This is because it uses the same comparator to history/other sections.
- The filtering requires you to explicitly add a "*" to inform your filter is a regular expression, e.g., the old implementation allowed you to type "cvs" to match anything with "cvs" inside. The new implementation requires you to type "*cvs".

Pros:

- The filtering is very much faster than the old implementation, thanks the use of virtual tables, caches, etc. we get for free from that class.

I think the gain is worthy and it will make it easier to improve the dialog in other ways in future.

2 - I also made some improvements over the old dialog:

- I added a label decorator over the label provider. So now it shows the priority decorator on the left site of the task icon.
- I enabled the status section on dialog and made it show the repository label for the task (like open resource shows the folder for files, or open type shows the class package).

These are experiments, so feel free to remove if you think it bloats the dialog (although I like it).

Regarding the status section: I noted the repository overlay has some white pixels which should be transparent. You can note this here because of dialog background color.

3 - A question about the history management: I used the AbstractTask.getHandleIdentifier() to persist/restore the task history.

It worked, but is it reliable? Also, I had to use TaskList.getTask(String handle) to restore tasks from handles, but there is a TODO for removing it in future.

Can you please check if the way I implemented is the right way?
Comment 15 Willian Mitsuda CLA 2007-07-14 18:47:23 EDT
 (In reply to comment #14)
> - The implementation wraps the label provider and "cancel" the IColorProvider,
> so we lost all color decoration for tasks.

Regarding this issue, I opened bug#196553.
Comment 16 Steffen Pingel CLA 2007-07-17 19:36:47 EDT
This is a very cool patch. Thanks Wilian!

 (In reply to comment #14)
> - The filtering requires you to explicitly add a "*" to inform your filter is a
> regular expression, e.g., the old implementation allowed you to type "cvs" to
> match anything with "cvs" inside. The new implementation requires you to type
> "*cvs".

After using this for a bit I find that a little bit annoying since tasks always start with the id, so I always have to type a * first to do a search by keyword. Is there any way to work around this by intercepting the search and adding a *?
Comment 17 Willian Mitsuda CLA 2007-07-17 20:36:15 EDT
(In reply to comment #16)
> After using this for a bit I find that a little bit annoying since tasks always
> start with the id, so I always have to type a * first to do a search by
> keyword. Is there any way to work around this by intercepting the search and
> adding a *?
> 

I thought this too. I'll try to study how the matching works and see if can make it work this way.
Comment 18 Mik Kersten CLA 2007-07-17 21:42:19 EDT
Great to see this progress Willian.  But I'm quite concerned about introducing a second history mechanism and would really like leave it to the single history in order to keep the UI simple and predictable (we can't expect users to understand the semantics of two different histories and Mylyn already overload's the Open Type dialog's history with the task context).  Also, I wonder how big a problem the loss of color decorations is, because it means that users will be unable to distinguish between completed and non-completed tasks on non-Windows OS's and that we will lack consistency with the Task List.  Since our current target is 3.3.x, if Platform applies the patch we could consider working around this by doing something like setting and overriding getItemsListLabelProvider(..) before creation.  But if comment#16 and the above issues are seem problematic perhaps we should consider overriding even more of the dialog's behavior if that's possible?
Comment 19 Willian Mitsuda CLA 2007-07-18 15:48:22 EDT
 (In reply to comment #18)
> Great to see this progress Willian.  But I'm quite concerned about introducing a
> second history mechanism and would really like leave it to the single history in
> order to keep the UI simple and predictable (we can't expect users to understand
> the semantics of two different histories and Mylyn already overload's the Open
> Type dialog's history with the task context).

I didn't investigate before because for me it isn't really a big issue. But your point is valid, and I'll take a look if we can unify the history mechanism.

> Also, I wonder how big a problem
> the loss of color decorations is, because it means that users will be unable to
> distinguish between completed and non-completed tasks on non-Windows OS's and
> that we will lack consistency with the Task List.  Since our current target is
> 3.3.x, if Platform applies the patch we could consider working around this by
> doing something like setting and overriding getItemsListLabelProvider(..) before
> creation.

I took a quick look at FilteredItemsSelectionDialog and the problem is that the getter methods and the label provider wrapper attribute are private. Even the ItemsListLabelProvider inner class is private, so we cannot extend it to include the missing interfaces. Any idea?

Anyway, is it ok if my patch on bug#196553 gets accepted for 3.3.1? This would imply that Mylyn 2.1 must have a minimum requisite of 3.3.1 too, but we could avoid having to hack the dialog. If so, could would vote for this there?
Comment 20 Mik Kersten CLA 2007-07-18 19:24:50 EDT
Although I will see how the schedules overlap, it is unlikely that Mylyn 2.1 can't have a 3.3.1 dependency.  But there are other ways that we can hack in the provider into 3.3.0 if they apply the patch for 3.3.1 (e.g. reflection) so I'm voting on that bug now.
Comment 21 Willian Mitsuda CLA 2007-07-18 21:22:04 EDT
 (In reply to comment #20)
> But there are other ways that we can hack in the
> provider into 3.3.0 if they apply the patch for 3.3.1 (e.g. reflection) so I'm
> voting on that bug now.

Interesting. Do you have some sample code on how this works?
Comment 22 Willian Mitsuda CLA 2007-08-05 22:44:28 EDT
Created attachment 75413 [details]
Updated patch
Comment 23 Willian Mitsuda CLA 2007-08-05 22:44:37 EDT
Created attachment 75414 [details]
mylyn/context/zip
Comment 24 Willian Mitsuda CLA 2007-08-05 23:02:15 EDT
I resolved the following problems in the last patch:

- No need to prepend the "*" to the filter.
- Overrided the history management to use Mylyn's activation history. That was tough because the actual implementation is very tied to settings-file-based history storage. I had to override a lot of methods to cancel the default implementation, but it works.
- Regarding the color/font problem, bug#196553 was commited to 3.4 M1, so if you want to experiment with my patch, you have to checkout the HEAD of org.eclipse.ui.workbench from CVS.
- A fix in 3.3.1 was reported on bug#198549, and I hope it will be accepted. So, if Mylyn 2.1 could have a prerequisite of 3.3.1, the color/font problem hopefully won't require any hack on our side.

But there is still a problem: although I said I resolved the history problem by making it to use Mylyn's task activation management, the dialog displays the history on alphabetical order, not the recent-to-past ordering that is used actually. The hard part is that the methods/attributes that control the sort order on FilteredItemsSelectionDialog are totally private.
Comment 25 Mik Kersten CLA 2007-09-21 14:01:27 EDT
Willian: sorry for the radio silence on this.  I would like to apply this patch after next Friday's 2.1 release.  At that point we will be able to make bigger UI changes of this sort, but for 2.1 the goal was to keep the UI as stable and consistent as possible.
Comment 26 Willian Mitsuda CLA 2007-10-15 17:48:37 EDT
Hi, I'm back ;) Sorry for the slowness. The current patch got stale. I'll provide a new one.
Comment 27 Willian Mitsuda CLA 2007-10-15 18:20:36 EDT
Created attachment 80391 [details]
Updated patch
Comment 28 Willian Mitsuda CLA 2007-10-15 18:20:39 EDT
Created attachment 80392 [details]
mylyn/context/zip
Comment 29 Robert Elves CLA 2007-10-25 20:37:05 EDT
This is looking very nice Willian. I like how you've added the details pane with the associated repository.  Just one outstanding issue I noticed. When a task is opened, it gets added to the task activation history (even thought the task isn't being added). This appears to be due to code in the TaskSelectionHistory.  Once this is resolved this will be committed.
Comment 30 Willian Mitsuda CLA 2007-10-26 01:08:13 EDT
Created attachment 81232 [details]
Updated patch
Comment 31 Willian Mitsuda CLA 2007-10-26 01:08:47 EDT
Created attachment 81233 [details]
mylyn/context/zip
Comment 32 Willian Mitsuda CLA 2007-10-26 01:12:37 EDT
 (In reply to comment #29)
> This is looking very nice Willian. I like how you've added the details pane with
> the associated repository.

Just a little polish item you would like to check later: in the repository icon you mentioned, there are a few white solid pixels that should be transparent.
Comment 33 Willian Mitsuda CLA 2007-11-15 16:17:23 EST
Rob, can you please review? (just a ping, in case this got lost)
Comment 34 Mik Kersten CLA 2007-11-28 18:40:25 EST
Patch applied.  This is great work Willian!  Now we won't feel as bad at taking up a toolbar item with this dialog ;)   

What's affected on 3.3.0, is it just the missing decorations?

Note that I made a minor change to the text for the separator (uses TaskListView.LABEL_PART).  However, we have a small problem with the decoration, because of the fact that we are using Mylyn's wide icons.   The problem is in the following code in ItemsListLabelProvider, which will shortcut the actual label provider (that knows about the wide icons).

		public Image getImage(Object element) {
			if (element instanceof ItemsListSeparator) {
				return WorkbenchImages
						.getImage(IWorkbenchGraphicConstants.IMG_OBJ_SEPARATOR);
			}

			return provider.getImage(element);
		}

Steffen and I deliberated on this some, and given the blinking of the priority icons and the fact that it would be very hard to work around the above constraint we're leaning to leaving the priority decorations off.  The blinking problem dominated.  I have committed this change, could you try it out and see which approach you prefer?  We can change back.
Comment 35 Willian Mitsuda CLA 2007-11-28 21:10:39 EST
 (In reply to comment #34)
> What's affected on 3.3.0, is it just the missing decorations?

Just color decorations. 3.3.1 is fine.

> Note that I made a minor change to the text for the separator (uses
> TaskListView.LABEL_PART).  However, we have a small problem with the decoration,
> because of the fact that we are using Mylyn's wide icons.   The problem is in
> the following code in ItemsListLabelProvider, which will shortcut the actual
> label provider (that knows about the wide icons).

Mik, I think something is wrong here. I can swear that the last time I submitted the patch I tested the dialog, and the icons were wide, and the priority decorating appeared nicely on the left of task icon.

Do you remember any change that could possibly have affected that?

> Steffen and I deliberated on this some, and given the blinking of the priority
> icons and the fact that it would be very hard to work around the above
> constraint we're leaning to leaving the priority decorations off.  The blinking
> problem dominated.  I have committed this change, could you try it out and see
> which approach you prefer?  We can change back.

The blinking problem seems to be from platform. It can be reproduced by opening the open resource dialog (Ctrl+Shift+R). The CVS overlay blinks as you navigate through resource names.

I see no reason why they erase the decoration just to paint a second later. Maybe we should report them to platform?
Comment 36 Willian Mitsuda CLA 2007-11-28 21:28:32 EST
 (In reply to comment #35)
> Mik, I think something is wrong here. I can swear that the last time I submitted
> the patch I tested the dialog, and the icons were wide, and the priority
> decorating appeared nicely on the left of task icon.

I checked the commited code, and see that you changed the line:

labelProvider = new TaskElementLabelProvider(false);

In the original patch, it was passing true. If you change it, you will get wide icons. You can be sure it works by increasing CompositeTaskImageDescriptor.OFFSET_DECORATION from 6 to a bigger value, and see that the icon width increases.

The only issue I see, is that it appears that the priority decoration misses 1 or 2 pixels of blank space on the left, because it seems to overlap with the selection rectangle border when selected (at least in Windows Vista).
Comment 37 Mik Kersten CLA 2007-11-28 23:52:42 EST
Willian: sorry if I was not clean enough in the reasoning in comment#34.  I deliberately switched to narrow icons because there are two problems with wide icons:
1) The blinking of decorations (this is Platform bug 130340, which I just put another comment on)
2) The fact that due to the wide image use, the separator icon was stretched and hence improperly rendered (as per comment#34 there is no straightforward solution to that).

In addition, I'm not clear on how important it is to show the priority decorations in this dialog, since the user is searching by name, and they are visually loud.  Could you try working with it both ways and let us know what your assessment is?
Comment 38 Willian Mitsuda CLA 2007-11-29 09:20:15 EST
Ok, ok, I misunderstood. Sorry, I thought you were talking the wide icons weren't working for you.

Now I see. And, yes, I think we can live without the priority icons. The core functionality, be able to filter completed tasks, and the migration to new dialog are done. Let's leave as is for now.
Comment 39 Willian Mitsuda CLA 2007-11-29 09:21:18 EST
 (In reply to comment #35)
> Just color decorations. 3.3.1 is fine.

Correcting myself: color and font decorations.
Comment 40 Steffen Pingel CLA 2007-11-29 13:53:05 EST
Great work Willian! I really like the new dialog. It is much faster and prettier than the old one.