This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 200613 - allow connectors to contribute patterns to TaskTextViewerConfiguration
Summary: allow connectors to contribute patterns to TaskTextViewerConfiguration
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 enhancement with 1 vote (vote)
Target Milestone: 3.1   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 167941
Blocks:
  Show dependency tree
 
Reported: 2007-08-20 17:34 EDT by Steffen Pingel CLA
Modified: 2008-11-05 10:49 EST (History)
3 users (show)

See Also:


Attachments
first cut (14.72 KB, patch)
2008-10-08 03:15 EDT, Steffen Pingel CLA
no flags Details | Diff
screenshot of Trac editor (23.84 KB, image/png)
2008-10-12 01:25 EDT, Steffen Pingel 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-08-20 17:34:13 EDT
This has been discussed on bug 200117: TaskTextViewerConfiguration (old name: RepositoryViewerConfig) uses a list of hard-coded patterns for syntax highlighting (e.g. bug, task#). This should be made more flexible so connectors can contribute custom patterns optimally based on existing hyper link detectors.
Comment 1 Eugene Kuleshov CLA 2007-08-20 19:03:48 EDT
why just not use hyperlink detectors and decorate text based on detection results? so, there will be nothing to contribute then on the connector side, as long as they have hyperlink detector already.
Comment 2 Robert Elves CLA 2007-08-20 19:55:24 EDT
That sounds like a great idea.
Comment 3 Steffen Pingel CLA 2008-08-20 02:40:04 EDT
David, this will be covered by your work on bug 167941, right?
Comment 4 David Green CLA 2008-08-20 11:49:49 EDT
(In reply to comment #3)
> David, this will be covered by your work on bug 167941, right?
> 

Yes.  The work on bug 167941 is strictly about strikethrough font for completed tasks, detected using the hyperlink detector.  So plug-ins that implement an AbstractConnectorUi will be able to affect this behaviour.

The wording of this bug suggests that some other type of syntax highlighting might be desirable.  If this is true, then bug 167941 won't be sufficient.

Patterns may also be contributed using the taskEditorExtension extension point and optionally WikiText.  This gives plug-ins ultimate control over syntax highlighting, since they can dictate the SourceViewer and its configuration.  This depends on bug 244650.
Comment 5 Steffen Pingel CLA 2008-10-01 00:22:13 EDT
Now that decoration of completed tasks is based on hyperlink detection I would like to determine the requirements for decorating task ids in the task editor. In Mylyn 2.x the following tokens are highlighted in blue (hyperlink color):

* task ids (e.g. bug 123)
* urls (e.g. http://eclipse.org)

If the same decoration is desired for Mylyn 3.x with WikiText enabled the current tokenizer based implementation will have to be replaced with a solution similar to bug 167941.

For task ids there is a difference whether a task is in the task list (and it's completion status is known) or not. Should this be indicated by using a lighter color for those links for instance?
Comment 6 Mik Kersten CLA 2008-10-07 13:15:16 EDT
I think that the following are the ideal minimum that needs to be supported consistently in both WikiText and standard editors:
  * Hyperlink style is blue foreground color and underline on-demand.  The following are hyperlinks:
    * Task references (e.g., bug#9999, bug 9999)
    * Comment references (e.g., comment#1, comment 1)
    * URLs (e.g., http://eclipse.org)
    * Java stack trace elements (e.g., org.eclipse.core.runtime.Platform.run(Platform.java:816))
   
I think the following are optional (i.e., help with usability, but are not key to the discoverabilty of hyperlink functionality)
  * Completed tasks appear with strikethrough (very nice that we have this now)
  * Completed tasks appear with the gray foreground color that's set.

Regarding tasks references that appear in the Task List, I think that these will be tricky to distinguish with color in an obvious way.  I think that instead we should improve the tooltips for all task references.  Currently we have no tooltips for tasks that aren't in the Task List and a one line tooltip for tasks that are, and we could expand on this to provide more descriptive multiline tooltips.
Comment 7 Steffen Pingel CLA 2008-10-08 02:53:32 EDT
David, do you think it's feasible to implement this with the current hyperlink detector based approach? We could try adding additional TaskHyperlinkTextPresentationManagers that set  the foreground color of matching tokens to JFacePreferences.ACTIVE_HYPERLINK_COLOR.
Comment 8 Steffen Pingel CLA 2008-10-08 03:15:46 EDT
Created attachment 114515 [details]
first cut
Comment 9 Steffen Pingel CLA 2008-10-08 03:18:43 EDT
Patch is a proof of concept, it's still missing the following, but basically works:
 - set the context to limit hyperlink detection to the respective TaskRepository
 - get hyperlink detectors from extension registry (see HtmlViewerConfiguration)
 - merge HighlightingHyperlinkTextPresentationManager with TaskHyperlinkTextPresentationManager
Comment 10 David Green CLA 2008-10-08 15:09:14 EDT
(In reply to comment #7)
> David, do you think it's feasible to implement this with the current hyperlink
> detector based approach?

Yes, at first glance the hyperlink detector API is the right approach

>  We could try adding additional
> TaskHyperlinkTextPresentationManagers that set  the foreground color of
> matching tokens to JFacePreferences.ACTIVE_HYPERLINK_COLOR.

You may need some additional preferences to handle the foreground color, font etc based on task status for task hyperlinks
Comment 11 Steffen Pingel CLA 2008-10-12 01:25:58 EDT
Created attachment 114893 [details]
screenshot of Trac editor
Comment 12 Steffen Pingel CLA 2008-10-12 01:33:52 EDT
I have committed an updated patch that now properly does highlighting based on the available hyperlink detectors (see attachment).

(In reply to comment #6)
> I think that the following are the ideal minimum that needs to be supported
> consistently in both WikiText and standard editors:
> * Hyperlink style is blue foreground color and underline on-demand.  The
> following are hyperlinks:
> * Task references (e.g., bug#9999, bug 9999)
> * Comment references (e.g., comment#1, comment 1)
> * URLs (e.g., http://eclipse.org)

The highlighting is now based on hyperlink detectors and should pick up all clickable tokens. This only works if a hyperlink detector returns all detected links in a regions of text which to my knowledge only detectors contributed by Mylyn do.  

> * Java stack trace elements (e.g.,
> org.eclipse.core.runtime.Platform.run(Platform.java:816))

Only the filename is highlighted but the whole line is clickable which is supported through the IHighlightingHyperlink interface. I found it to intrusive when the whole stack trace was highlighted.

> I think the following are optional (i.e., help with usability, but are not key
> to the discoverabilty of hyperlink functionality)
> * Completed tasks appear with strikethrough (very nice that we have this now)

This will work for tasks in the task list.

> * Completed tasks appear with the gray foreground color that's set.

I am not sure if that's a good idea as it would break the consistency of highlighting all hyperlinks in the same color?
Comment 13 Mik Kersten CLA 2008-11-05 10:49:00 EST
Looks great.