28
28
using MonoDevelop.Core;
29
29
using MonoDevelop.Ide.Gui;
30
30
using MonoDevelop.Ide;
31
using MonoDevelop.Ide.Codons;
32
using MonoDevelop.Projects;
32
34
namespace MonoDevelop.SourceEditor
34
public class SourceEditorDisplayBinding : DisplayBinding
36
public class SourceEditorDisplayBinding : IViewDisplayBinding
36
38
public static FilePath SyntaxModePath {
38
return PropertyService.ConfigPath.Combine ("syntaxmodes");
40
return PropertyService.DataPath.Combine ("HighlightingSchemes");
66
public override string Name {
68
70
return GettextCatalog.GetString ("Source Code Editor");
72
public override MonoDevelop.Ide.Gui.IViewContent CreateContentForUri (string fileName)
74
public bool CanHandle (FilePath fileName, string mimeType, Project ownerProject)
76
if (string.IsNullOrEmpty (mimeType))
78
return DesktopService.GetMimeTypeIsText (mimeType);
81
public IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
74
83
return new SourceEditorView ();
77
public override bool CanCreateContentForMimeType (string mimetype)
79
if (String.IsNullOrEmpty (mimetype))
81
return DesktopService.GetMimeTypeIsText (mimetype);
84
public override MonoDevelop.Ide.Gui.IViewContent CreateContentForMimeType (string mimeType, System.IO.Stream content)
86
SourceEditorView result = new SourceEditorView ();
87
result.Document.MimeType = mimeType;
88
if (content != null) {
89
using (StreamReader reader = new StreamReader (content)) {
90
result.Document.Text = reader.ReadToEnd ();
96
public override bool CanCreateContentForUri (string fileName)
86
public bool CanHandleFile (string fileName)
98
88
string mt = DesktopService.GetMimeTypeForUri (fileName);
99
89
return DesktopService.GetMimeTypeIsText (mt);
92
public bool CanUseAsDefault {