diff options
author | Vincent Dondain <vincent.dondain@xamarin.com> | 2016-05-27 17:51:32 +0300 |
---|---|---|
committer | Vincent Dondain <vincent.dondain@xamarin.com> | 2016-05-30 13:24:30 +0300 |
commit | 0dc6334d20e665d8d80a6d5727746eab40fab8e2 (patch) | |
tree | 5a763229eafc2697de32b0186f88149201fc025d /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks | |
parent | 5b801e80122f8d4c9b129080bc8a82171e75d1b8 (diff) |
Add documentation extension point
IErrorDocumentationProvider has one method:
GetDocumentationLink which gives the address
of the documentation for a given error code
within the error's description.
Also link to doc when clicking Show Error Reference
in the error pad.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskListEntry.cs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskListEntry.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskListEntry.cs index e39ad85d3e..df06926052 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskListEntry.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskListEntry.cs @@ -235,6 +235,23 @@ namespace MonoDevelop.Ide.Tasks } } + public string DocumentationLink { + get; set; + } + + public bool HasDocumentationLink () + { + var extensions = Mono.Addins.AddinManager.GetExtensionObjects<Extensions.IErrorDocumentationProvider> ("/MonoDevelop/Ide/IErrorDocumentationProvider", false); + foreach (var ext in extensions) { + var link = ext.GetDocumentationLink (description); + if (!string.IsNullOrEmpty (link)) { + DocumentationLink = link; + return true; + } + } + return false; + } + public virtual void JumpToPosition() { if (!file.IsNullOrEmpty) { @@ -242,8 +259,12 @@ namespace MonoDevelop.Ide.Tasks var project = WorkspaceObject as Project; IdeApp.Workbench.OpenDocument (file, project, Math.Max (1, line), Math.Max (1, column)); } else { - var pad = IdeApp.Workbench.GetPad<ErrorListPad> ()?.Content as ErrorListPad; - pad?.FocusOutputView (); + if (HasDocumentationLink ()) { + DesktopService.ShowUrl (DocumentationLink); + } else { + var pad = IdeApp.Workbench.GetPad<ErrorListPad> ()?.Content as ErrorListPad; + pad?.FocusOutputView (); + } } } else if (parentObject != null) { Pad pad = IdeApp.Workbench.GetPad<ProjectSolutionPad> (); |