Bug 164221 - recognize comment#number link on bug editor
Summary: recognize comment#number link on bug editor
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.4   Edit
Assignee: Frank Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 281369 (view as bug list)
Depends on: 301756
Blocks:
  Show dependency tree
 
Reported: 2006-11-11 12:11 EST by Willian Mitsuda CLA
Modified: 2010-03-05 20:53 EST (History)
6 users (show)

See Also:


Attachments
mylyn/context/zip (1.03 KB, application/octet-stream)
2008-05-01 12:32 EDT, Frank Becker CLA
no flags Details
patch (2.42 KB, patch)
2008-05-03 04:09 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (2.46 KB, application/octet-stream)
2008-05-03 04:09 EDT, Frank Becker CLA
no flags Details
updated patch (3.15 KB, patch)
2008-06-18 09:33 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (13.85 KB, application/octet-stream)
2008-06-18 09:33 EDT, Frank Becker CLA
no flags Details
patch for 3.2 (2.58 KB, patch)
2009-03-26 18:19 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (19.17 KB, application/octet-stream)
2009-03-26 18:19 EDT, Frank Becker CLA
no flags Details
commited patch (10.37 KB, patch)
2010-03-03 15:55 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (5.60 KB, application/octet-stream)
2010-03-03 15:55 EST, Frank Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Willian Mitsuda CLA 2006-11-11 12:11:57 EST
Mylar 0.9.0:

The bugzilla web interface recognizes patterns like bug#158069 comment#22, and turns it out into a link not only to the bug, but directly to the comment too.

The bug editor only recognizes bug#number, not the comment part.
Comment 1 Eugene Kuleshov CLA 2007-01-01 20:50:18 EST
There is much more editor don't recognize. See bug 146964 for details. So, this one is a duplicate, unless we want to deal with each issue separately...
Comment 2 Robert Elves CLA 2007-01-02 14:23:23 EST
My thinking is that this particular feature may be a little more involved than the other parsing issues identified on bug#146964 so lets keep this one alive.
Comment 3 Steffen Pingel CLA 2008-04-26 01:13:21 EDT
This would be a useful addition. Frank, would you be interested in looking into this? 

Somewhat related is bug 166807 .
Comment 4 Frank Becker CLA 2008-05-01 12:27:39 EDT
Should we finish bug#167941 first?

Then we can add an commentNr attribute of the class TaskHyperlink.

Is it possible to do an open of an editor with positioning on the requested comment or should we need to implement this?
Comment 5 Frank Becker CLA 2008-05-01 12:32:20 EDT
Created attachment 98332 [details]
mylyn/context/zip
Comment 6 Steffen Pingel CLA 2008-05-01 16:00:13 EDT
I would like to hold off on bug#167941 until we have a better understanding of how the implement should work.

In order for the task editor to scroll to the right comment we would need a method on TaskEditor that allows it to jump to a certain comment. Here is how it could work:

 - open task editor
 - get reference to editor
 - map anchor to corresponding ITaskComment object
 - invoke TaskEditor.reveal(ITaskComment) to make comment visible
 
This will require a few API changes and it would makes sense to port the Bugzilla connector to the new editor architecture first.

As a start we could modify the hyperlink detector to recognize the comment number and implement the actual revealing of the comment in the UI later?
Comment 7 Frank Becker CLA 2008-05-03 04:09:34 EDT
Created attachment 98523 [details]
patch

 (In reply to comment #6)

> As a start we could modify the hyperlink detector to recognize the comment
> number and implement the actual revealing of the comment in the UI later?

Here the first part.

Lets do the UI later.
Comment 8 Frank Becker CLA 2008-05-03 04:09:39 EDT
Created attachment 98524 [details]
mylyn/context/zip
Comment 9 Robert Elves CLA 2008-05-15 14:06:06 EDT
No big rush here but for the text "bug#123" I get the following:

java.lang.IndexOutOfBoundsException: No group 6
	at java.util.regex.Matcher.group(Matcher.java:463)
	at org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaConnectorUi.extractHyperlink(BugzillaConnectorUi.java:155)
	at org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaConnectorUi.findHyperlinks(BugzillaConnectorUi.java:123)
	at org.eclipse.mylyn.internal.tasks.ui.editors.TaskHyperlinkDetector.detectHyperlinks(TaskHyperlinkDetector.java:79)
	at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:265)
	at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:466)
Comment 10 Frank Becker CLA 2008-05-15 15:34:44 EDT
 (In reply to comment #9)
> No big rush here but for the text "bug#123" I get the following:
> 
> java.lang.IndexOutOfBoundsException: No group 6
> at java.util.regex.Matcher.group(Matcher.java:463)
> at
> org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaConnectorUi.extractHyperlink(BugzillaConnectorUi.java:155)
> at
> org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaConnectorUi.findHyperlinks(BugzillaConnectorUi.java:123)
> at
> org.eclipse.mylyn.internal.tasks.ui.editors.TaskHyperlinkDetector.detectHyperlinks(TaskHyperlinkDetector.java:79)
> at
> org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
> at
> org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:265)
> at
> org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:466)
Sorry I can not reproduce this.

What is the exact complete text of the comment? are there space or newline before or after the String?
Comment 11 Robert Elves CLA 2008-06-16 23:12:46 EDT
bug#123     <---- just like so last time I tested
Comment 12 Frank Becker CLA 2008-06-18 09:33:54 EDT
Created attachment 105284 [details]
updated patch

I add a try cach block to avoid this problem. Maybe the implementation of class PATTERn
Comment 13 Frank Becker CLA 2008-06-18 09:33:58 EDT
Created attachment 105285 [details]
mylyn/context/zip
Comment 14 Frank Becker CLA 2009-03-26 18:19:27 EDT
Created attachment 130024 [details]
patch for 3.2
Comment 15 Frank Becker CLA 2009-03-26 18:19:33 EDT
Created attachment 130025 [details]
mylyn/context/zip
Comment 16 Steffen Pingel CLA 2009-06-24 12:53:08 EDT
*** Bug 281369 has been marked as a duplicate of this bug. ***
Comment 17 Robert Elves CLA 2009-08-05 19:13:29 EDT
Status: Frank's attached patch looks good, just awaiting resolution of bug#178474.
Comment 18 Steffen Pingel CLA 2010-02-28 21:12:54 EST
Frank, you should now be able to go ahead with your patch. To make this work invoke TaskHyperlink.setSelection(attributeId) where attributeId is a String with the id of the comment attribute that should be revealed, e.g. TaskAttribute.PREFIX_COMMENT + "20" for comment 20 in Bugzilla.
Comment 19 Frank Becker CLA 2010-03-03 15:55:27 EST
Created attachment 160844 [details]
commited patch

I also add support for the new (Bugzilla 3.6) form of comments for attachments
Comment 20 Frank Becker CLA 2010-03-03 15:55:34 EST
Created attachment 160845 [details]
mylyn/context/zip
Comment 21 Steffen Pingel CLA 2010-03-03 16:16:10 EST
Looks good to me. Any reason to keep the commented out code in BugzillaConnectorUi around?
Comment 22 Frank Becker CLA 2010-03-03 16:33:46 EST
(In reply to comment #21)
> Looks good to me. Any reason to keep the commented out code in
> BugzillaConnectorUi around?

Cleanup and more junit tests are non in HEAD.
Comment 23 Steffen Pingel CLA 2010-03-03 18:00:14 EST
Great! Thanks Frank.
Comment 24 Andrew Gvozdev CLA 2010-03-05 18:09:09 EST
Bugzilla also recognizes the pattern comment #24 making a link to the comment in current task. Mylyn that I updated today does not seem to understand that. Perhaps a shortcut like bug 164221#24 would be nice to have too.
Comment 25 Steffen Pingel CLA 2010-03-05 20:30:50 EST
Andrew, could you file a new bug for that?
Comment 26 Andrew Gvozdev CLA 2010-03-05 20:53:38 EST
(In reply to comment #25)
> Andrew, could you file a new bug for that?
Sure, bug 304910. Hmm,  that request matches the subject of this bug exactly.