Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364999 - User can select repository when clicking a task hyperlinks in the task editor
Summary: User can select repository when clicking a task hyperlinks in the task editor
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P4 enhancement (vote)
Target Milestone: 3.7   Edit
Assignee: Sam Davis CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, helpwanted
Depends on:
Blocks:
 
Reported: 2011-11-28 14:26 EST by Sam Davis CLA
Modified: 2012-01-11 07:35 EST (History)
1 user (show)

See Also:


Attachments
patch (2.26 KB, patch)
2011-12-21 17:58 EST, Sam Davis CLA
no flags Details | Diff
mylyn/context/zip (4.12 KB, application/octet-stream)
2011-12-21 17:58 EST, Sam Davis CLA
no flags Details
updated patch (6.57 KB, patch)
2012-01-03 19:13 EST, Sam Davis CLA
no flags Details | Diff
mylyn/context/zip (12.05 KB, application/octet-stream)
2012-01-03 19:13 EST, Sam Davis CLA
no flags Details
patch with tests (12.83 KB, patch)
2012-01-06 17:16 EST, Sam Davis CLA
steffen.pingel: review+
Details | Diff
mylyn/context/zip (99.58 KB, application/octet-stream)
2012-01-06 17:16 EST, Sam Davis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Davis CLA 2011-11-28 14:26:39 EST
Task hyperlinks in the task editor should work the same way as in the Java editor: when you hover over the link, there should be a popup simliar to the one for attachment links allowing you to select the repository.
Comment 1 Steffen Pingel CLA 2011-11-29 07:24:39 EST
The hyperlinks work consistently with repository web interfaces, i.e. they link to other tasks in the same repository. In order to link to tasks in other repositories you have to provide the full URL. 

Are you suggesting to always show a list of repositories that may match a task link, e.g. bug 123? My sense is that this would get in the way in the vast majority of cases where the link is referencing a task in the same repository.
Comment 2 Sam Davis CLA 2011-11-29 12:04:48 EST
It would probably make more sense to only show the list of repositories when holding control.
Comment 3 Steffen Pingel CLA 2011-11-29 15:59:35 EST
Thanks for the input. I don't think the modifier keys are available in the hyperlink detector API. I'll keep this open but this type of advanced functionality doesn't fall into the core scope of the project. We'd be happy to resolve this through a contribution though.
Comment 4 Sam Davis CLA 2011-12-21 17:58:28 EST
Created attachment 208710 [details]
patch

The modifiers are not available in the detector, but I just defined a new detector that only operates on the task editor when ctrl is held. It works nicely.
Comment 5 Sam Davis CLA 2011-12-21 17:58:30 EST
Created attachment 208711 [details]
mylyn/context/zip
Comment 6 Steffen Pingel CLA 2011-12-24 05:06:10 EST
That's an interesting idea. One problem I noticed is that the task editor now highlights bug patterns for other repositories, e.g. "#42" which is a Trac specific pattern is highlighted in the Bugzilla editor. These links are only clickable when holding CTRL which is not intuitive and consistent with other links in the editor. The highlighting code would need to be changed to only highlight these links when CTRL is pressed before considering the patch.
Comment 7 Sam Davis CLA 2012-01-03 13:55:28 EST
Good catch, I'll look into whether there's anything I can do about that. I only see the problem with on 3.6 though, not 3.7.
Comment 8 Sam Davis CLA 2012-01-03 13:57:57 EST
Hmm, I see the same problem with another connector.
Comment 9 Sam Davis CLA 2012-01-03 19:13:06 EST
Created attachment 208972 [details]
updated patch

This will only create hyperlinks to other repositories if there is a hyperlink to the current repository. It prevents highlighting anything that wouldn't already be highlighted.

It's not perfect in that, when using Bugzilla, "#42" will just be ignored even when holding Ctrl. I don't think it's possible to do better than that given that the highlighting is controlled by the platform. This at least supports the common case of using multiple repositories that use the same bug pattern.
Comment 10 Sam Davis CLA 2012-01-03 19:13:08 EST
Created attachment 208973 [details]
mylyn/context/zip
Comment 11 Steffen Pingel CLA 2012-01-05 18:55:19 EST
Thanks for the patch. This is very cool! I'd be happy to merge it if you added a few test cases.

> It's not perfect in that, when using Bugzilla, "#42" will just be ignored even
> when holding Ctrl. I don't think it's possible to do better than that given that
> the highlighting is controlled by the platform. 

The highlighting is implemented in subclasses of AbstractHyperlinkTextPresentationManager. We might be able to add special handling for the new hyperlink detector to only highlight bug links for other repositories when Ctrl is pressed.
Comment 12 Sam Davis CLA 2012-01-06 17:16:16 EST
Created attachment 209156 [details]
patch with tests
Comment 13 Sam Davis CLA 2012-01-06 17:16:19 EST
Created attachment 209157 [details]
mylyn/context/zip
Comment 14 Steffen Pingel CLA 2012-01-09 14:32:37 EST
Great! I have simplified the code slightly be removing MultipleTaskHyperlinkDetector.getTaskRepositoryFromSuper() method and replaced the boolean flag to MultipleTaskHyperlinkDetectorTest.createHyperlinkDetector(). Sam, can you take a look if these changes make sense: http://review.mylyn.org/#change,197 ?
Comment 15 Sam Davis CLA 2012-01-09 15:53:32 EST
Thanks, that is much simpler! I should have thought of that (assuming it works).

Regarding the review, the fetch and compare with commands do not work properly. Also, it would be useful to be able to open the patched version of a file directly.
Comment 16 Steffen Pingel CLA 2012-01-11 07:35:01 EST
Great. I have pushed the change into master.