diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2015-04-02 02:32:44 +0300 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2015-04-02 02:32:44 +0300 |
commit | a717fd375b2bc66c50e01355a93673b1da19d273 (patch) | |
tree | 1f4524205c2ab8e8bf4ddd3a27aad5670761a3d1 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks | |
parent | d1da6f5c49ad93486719396a596413a68969677a (diff) |
[Ide] Only jump to errors in text files
Prevents e.g. opening the Windows Photo Viewer when a build
task has a problem with a PNG file.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs index bb41f90835..dc2da230bc 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs @@ -41,7 +41,8 @@ using MonoDevelop.Projects; using MonoDevelop.Ide.Gui; using MonoDevelop.Ide.Gui.Content; using MonoDevelop.Ide.Navigation; -using MonoDevelop.Ide.TextEditing;
+using MonoDevelop.Ide.TextEditing; +using MonoDevelop.Ide.Desktop;
namespace MonoDevelop.Ide.Tasks
{
@@ -427,15 +428,33 @@ namespace MonoDevelop.Ide.Tasks return null; } } - + + /// <summary> + /// Determines whether the task's file should be opened automatically when jumping to the next error. + /// </summary> public static bool IsProjectTaskFile (Task t) { if (t.FileName.IsNullOrEmpty) return false; + + //only files that are part of project Project p = t.WorkspaceObject as Project; if (p == null) return false; - return p.GetProjectFile (t.FileName) != null; + if (p.GetProjectFile (t.FileName) == null) + return false; + + //only text files + var mimeType = DesktopService.GetMimeTypeForUri (t.FileName); + if (!DesktopService.GetMimeTypeIsText (mimeType)) + return false; + + //only files for which we have a default internal display binding + var binding = DisplayBindingService.GetDefaultBinding (t.FileName, mimeType, p); + if (binding == null || !binding.CanUseAsDefault || binding is IExternalDisplayBinding) + return false; + + return true; } |