Bug 134165 - provide find functionality for task editor
Summary: provide find functionality for task editor
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 enhancement with 3 votes (vote)
Target Milestone: 3.11   Edit
Assignee: Lily Guo CLA
QA Contact:
URL:
Whiteboard: sprint=1;
Keywords: contributed, noteworthy, plan
: 242969 (view as bug list)
Depends on: 242433 242969 248898
Blocks:
  Show dependency tree
 
Reported: 2006-03-30 15:04 EST by Alex Chapiro CLA
Modified: 2014-09-29 20:07 EDT (History)
8 users (show)

See Also:


Attachments
UI of "find" (9.33 KB, patch)
2008-07-23 18:45 EDT, Jingwen 'Owen' Ou CLA
no flags Details | Diff
mylyn/context/zip (204.30 KB, application/octet-stream)
2008-07-23 18:45 EDT, Jingwen 'Owen' Ou CLA
no flags Details
screenshot after toggling the find button (7.55 KB, image/png)
2008-07-23 18:48 EDT, Jingwen 'Owen' Ou CLA
no flags Details
moved the ui to sandbox (8.91 KB, patch)
2008-07-23 19:38 EDT, Jingwen 'Owen' Ou CLA
no flags Details | Diff
mylyn/context/zip (230.72 KB, application/octet-stream)
2008-07-23 19:38 EDT, Jingwen 'Owen' Ou CLA
no flags Details
an update patch - ignore patch titled "move the ui to sandbox" (11.90 KB, patch)
2008-07-23 19:40 EDT, Jingwen 'Owen' Ou CLA
no flags Details | Diff
the find patch (13.34 KB, patch)
2008-07-31 01:10 EDT, Jingwen 'Owen' Ou CLA
no flags Details | Diff
mylyn/context/zip (27.67 KB, application/octet-stream)
2008-07-31 01:10 EDT, Jingwen 'Owen' Ou CLA
no flags Details
screenshot of typing "find" in bug 134165 (42.85 KB, image/png)
2008-07-31 01:15 EDT, Jingwen 'Owen' Ou CLA
no flags Details
an updated patch using AdaptiveRefreshPolicy to improve user exp (15.98 KB, patch)
2008-08-01 16:36 EDT, Jingwen 'Owen' Ou CLA
no flags Details | Diff
mylyn/context/zip (15.65 KB, application/octet-stream)
2008-08-01 16:36 EDT, Jingwen 'Owen' Ou CLA
no flags Details
recut the patch against head request in comment 18 (5.93 KB, patch)
2008-08-04 22:51 EDT, Jingwen 'Owen' Ou CLA
no flags Details | Diff
the latest file of ExtensibleBugzillaTaskEditorPage.java (12.39 KB, application/octet-stream)
2008-08-11 16:03 EDT, Jingwen 'Owen' Ou CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Chapiro CLA 2006-03-30 15:04:57 EST
No search in report, I tried a big one, and it was very problematic to find something in it.
Comment 1 Mik Kersten CLA 2006-03-30 20:43:27 EST
Yes, we need some sort of "find" dialog or feature for it.  Current work-around is to use the Browser, but we're trying to minimize the need for that.
Comment 2 Robert Elves CLA 2006-11-22 14:52:46 EST
Unfortunately I don't think this will make it into 1.0.
Comment 3 Mik Kersten CLA 2008-07-22 13:50:54 EDT
Based on our discussion, the best place to add this for now would be to a new row on the editor's header.  The row would only appear if the user hits Ctrl+F or a Find action on the form's toolbar, which would be a push button.

Another option is to add the Find box to the toolbar instead of adding a whole additional row.
Comment 4 Jingwen 'Owen' Ou CLA 2008-07-23 18:45:32 EDT
Created attachment 108278 [details]
UI of "find"

contributed a toggle action on the editor's header. When the action is toggled, including using key Ctrl+F, a textbox appears (it disapears when not toggled). I think its better than building a row which will take some real estates on the header. 

When programmers modified the text in the textbox, a find action will be activated, searching current Task Editor. I suggest also add a line to the left of the header to indicate the job is being done. The idea is pretty much like the "Find" box in the Task List View.

Next step: build "find" under the hood.
Comment 5 Jingwen 'Owen' Ou CLA 2008-07-23 18:45:40 EDT
Created attachment 108279 [details]
mylyn/context/zip
Comment 6 Jingwen 'Owen' Ou CLA 2008-07-23 18:48:06 EDT
Created attachment 108280 [details]
screenshot after toggling the find button
Comment 7 Steffen Pingel CLA 2008-07-23 19:02:06 EDT
Wow, that's cool. Can you move the patch to the sandbox for now?
Comment 8 Jingwen 'Owen' Ou CLA 2008-07-23 19:38:13 EDT
Created attachment 108285 [details]
moved the ui to sandbox

now only the find button is availalbe in Bugzilla. And the patch also includes activating the editor context in TaskEditor, which is part of the functions (not being applied to the head yet) in bug 203670.
Comment 9 Jingwen 'Owen' Ou CLA 2008-07-23 19:38:19 EDT
Created attachment 108286 [details]
mylyn/context/zip
Comment 10 Jingwen 'Owen' Ou CLA 2008-07-23 19:40:27 EDT
Created attachment 108287 [details]
an update patch - ignore patch titled "move the ui to sandbox"
Comment 11 Steffen Pingel CLA 2008-07-23 20:24:14 EDT
Owen, instead of implementing your own Find handler try reusing the global find action. You probably have to add this to TaskEditorActionContributor.registerGlobalHandlers() and delegate to the active task editor page for executing the find action.
Comment 12 Jingwen 'Owen' Ou CLA 2008-07-31 01:10:12 EDT
Created attachment 108815 [details]
the find patch

Everything is working great except that the speed is a bit slow if too many comments.

The main reason is that TaskEditorCommentPart.expendComment(..) will dispose the TextViewer instance when corresponding ExpandableComposite is close. I have to toggle all ExpandableComposite open before doing any search.
Comment 13 Jingwen 'Owen' Ou CLA 2008-07-31 01:10:20 EDT
Created attachment 108816 [details]
mylyn/context/zip
Comment 14 Jingwen 'Owen' Ou CLA 2008-07-31 01:15:27 EDT
Created attachment 108817 [details]
screenshot of typing "find" in bug 134165

* highlights all TextViewer, including those are editable, e.g. the new comment section
* global Ctrl+F is available, even in context menu and Editor->find/replace
* hides comments/sections that do not match any of the keyword
Comment 15 Jingwen 'Owen' Ou CLA 2008-08-01 16:36:38 EDT
Created attachment 108980 [details]
an updated patch using AdaptiveRefreshPolicy to improve user exp

when keep typing the find string, the page will not refresh until finish the whole word.

I like AdaptiveRefreshPolicy.textChanged(..) which schedules the job considering the text length
Comment 16 Jingwen 'Owen' Ou CLA 2008-08-01 16:36:42 EDT
Created attachment 108981 [details]
mylyn/context/zip
Comment 17 Jingwen 'Owen' Ou CLA 2008-08-01 16:38:16 EDT
also we might need a line at the top of the page indicating the find job is in action
Comment 18 Steffen Pingel CLA 2008-08-02 20:07:57 EDT
Owen, that's great stuff! I really like how the find integrates with the existing user interface.

I committed the first patch a few days ago. Please update CVS and recut your follow-up patch against head. I have created bug 242969 for improving the performance when searching.
Comment 19 Mik Kersten CLA 2008-08-04 20:12:42 EDT
I checked out the screenshot.  Very nice!
Comment 20 Jingwen 'Owen' Ou CLA 2008-08-04 22:51:15 EDT
Created attachment 109112 [details]
recut the patch against head request in comment 18
Comment 21 Steffen Pingel CLA 2008-08-04 23:35:43 EDT
Thanks. I'll hold off merging this patch. I would like to figure out if we can make this fast enough (bug 242969) to avoid a delay when the user starts typing. For now I have changed the listener to only trigger the search when the enter key is pressed.
Comment 22 Jingwen 'Owen' Ou CLA 2008-08-04 23:40:26 EDT
(In reply to comment #21)
> Thanks. I'll hold off merging this patch. I would like to figure out if we can
> make this fast enough (bug 242969) to avoid a delay when the user starts typing.
> For now I have changed the listener to only trigger the search when the enter
> key is pressed.

oh btw, right now it won't delay since I added AdaptiveRefreshPolicy and the page will only refresh after the user has settle down the typing. But I agree we should start thinking about bug 242969. 
Comment 23 Jingwen 'Owen' Ou CLA 2008-08-11 16:03:58 EDT
Created attachment 109705 [details]
the latest file of ExtensibleBugzillaTaskEditorPage.java

I noticed my last patch is  confilcting with the head, and the confilct still exists even if I recut it. So I send the file for review. Steffen, please take a look.

I used multithread to delay the page refreshing, as commented at comment#15
Comment 24 Steffen Pingel CLA 2008-08-11 16:15:09 EDT
Thanks Owen. I'll take a look at the patches. Make sure your workspace is sychronized with the latest from CVS. You can use the Synchronize view to resolve conflicts when updating from CVS.
Comment 25 Jingwen 'Owen' Ou CLA 2008-08-11 16:21:57 EDT
(In reply to comment #24)
> Thanks Owen. I'll take a look at the patches. Make sure your workspace is
> sychronized with the latest from CVS. You can use the Synchronize view to
> resolve conflicts when updating from CVS.

Yes I did. But the wired thing is the conflict still exists. I think the problem is CVS is not atomic in synchronization. 
Comment 26 Jingwen 'Owen' Ou CLA 2008-08-11 16:23:16 EDT
(In reply to comment #25)
> (In reply to comment #24)
> > Thanks Owen. I'll take a look at the patches. Make sure your workspace is
> > sychronized with the latest from CVS. You can use the Synchronize view to
> > resolve conflicts when updating from CVS.
> 
> Yes I did. But the wired thing is the conflict still exists. I think the problem
> is CVS is not atomic in synchronization.

I overrided the file and made changes on top of it, it just keeps complaining conflicts...
Comment 27 Jingwen 'Owen' Ou CLA 2008-08-17 21:00:36 EDT
Steffen, this bug is ready for review. Although we need more time to fully finish bug 242969, my last patch fixed some performance issues, which can be used temporally.
Comment 28 Steffen Pingel CLA 2008-08-17 22:50:09 EDT
The patch looks good. I would like to resolve bug 242969 before merging it (see comment 21) though. Since the current search implementation can block the UI for some time I think it's better to only trigger a search when enter is explicitly pressed.
Comment 29 Mik Kersten CLA 2008-08-19 13:49:42 EDT
Tentatively scheduling for 3.1 to include this in our planning, but we have to figure out whether a non-model based approach will scale.
Comment 30 Jeff CLA 2012-10-24 20:23:17 EDT
Any update on this?  Are you still waiting until bug 242969 is resolved?  I seem to recall using this experimental "find" feature a few years ago without any performance issues.  Is it still available from the sandbox?
Comment 31 Sam Davis CLA 2013-08-08 13:03:33 EDT
Let's see if we can resurrect this.
Comment 32 Lily Guo CLA 2013-08-13 14:09:05 EDT
After some experimentation, it looks like I am able to use the taskData to search through the comments (and later description)  which cuts down on the performance time by 66%. The part that is expensive is when the comments are being opened, due to bug 70358 . Still need ideas on the best approach for searching through comments.
Comment 33 Sam Davis CLA 2013-08-13 19:41:48 EDT
It actually isn't related to that bug. It turns out that almost half the time to expand comments is spent calling reflow(). Lily discovered that the find attempts to disable relfow by calling setReflow(false), but this has no effect since it gets set to true again when the comment viewers are created. If we use another mechanism to disable the reflow we could further improve the performance by a lot.
Comment 34 Lily Guo CLA 2013-08-21 21:58:02 EDT
I have noticed a few issues with the old implementation, and changing some design methods fixed some problems and improved the performance greatly:

1) Search only through key parts: summary, private notes, description and comment parts instead of the entire task editor.
2) Expanding every comment is slow (due to the reflow() call), so instead of expanding all at once I first search through the task attributes to see if there is any match. If there isn't then don't expand the comment.
3) When there are groups in comments (Older, Recent) then expand the latest comments first if there are results (they are the ones not in a group), and if not then expand "Recent" group and so on, so at least some result is presented to the user upon search. If there aren't any results in a group then don't expand that group.
4) If both the latest comments and groups contained results, then the group will not be expanded but a link will appear beside the group header that indicates that there are results in the group. Clicking on that link will expand the group and will highlight the results. (Link will disappear after clicking on it)
5) If a comment is expanded already by the user then it will not collapse the comment if there isn't a result. (same with other parts)
6) After every search, there was a call to viewer.refresh() which causes a slight formatting change in the comments. If comments contain quotation, then the first line of the quotation (starts with "(In reply to..)") will become unquoted. By not calling that method and instead setting a blank styleRange to StyledText fixes that issue.
7) Instead of using FindReplaceDocumentAdapter to find the region to highlight, I use string indexOf on StyledText.getText() which is a lot faster. 
8) Mouse hover over a link within a comment will wipe out the highlights in that comment. I have yet to find a solution for this.
Comment 35 Lily Guo CLA 2013-08-22 19:28:44 EDT
I have submitted a patch: 
https://git.eclipse.org/r/#/c/15793/
which depends on some changes in the mylyn tasks, so I pushed a patch for that as well:
https://git.eclipse.org/r/#/c/15791/
Comment 36 Sam Davis CLA 2013-10-08 23:40:36 EDT
We will need to file a CQ to move this code to the tasks repository, but I have pushed the following additional reviews, building on Lily's. Once we have approval to move the code, it will be trivial to enable this functionality for all connectors.

17138: 134165: improve readability of task editor find implementation [Ic3c9b515]
https://git.eclipse.org/r/#/c/17138/

17188: 134165: move task editor find implementation to separate class [I348a4b18]
https://git.eclipse.org/r/#/c/17188/
Comment 37 Sam Davis CLA 2013-10-08 23:43:51 EDT
*** Bug 242969 has been marked as a duplicate of this bug. ***
Comment 38 Sam Davis CLA 2013-10-11 15:36:41 EDT
Moving to 3.11. We made great progress on this in this release cycle. I think we should be able to merge it early in the 3.11 cycle.
Comment 39 Sam Davis CLA 2014-01-10 16:23:46 EST
It sounds like we don't need to do a move review (a type of restructuring review) to move this amount of code (approximately 300 lines). It says at http://www.eclipse.org/projects/dev_process/development_process.php#6_3_8_Restructuring_Review that:

bq. A Restructuring Review may include the movement of significant chunks of code. A move is considered significant if it has an impact on the community (i.e. if segments of the community will notice that the code has moved). This may include entire projects, bundles, and features, but likely excludes small fragments, code snippets and individual files

Steffen, do you think we can just move the code without going through a move review?
Comment 40 Steffen Pingel CLA 2014-01-10 16:41:13 EST
(In reply to comment #39)
> It sounds like we don't need to do a move review (a type of restructuring
> review) to move this amount of code (approximately 300 lines). 
>
> Steffen, do you think we can just move the code without going through a move
> review?

Sounds fine if it's a small amount of code like that and we'll note it in the N&N anyways to make the community aware.
Comment 41 Sam Davis CLA 2014-01-27 20:41:48 EST
I've moved the code to o.e.m.tasks. Marking resolved!