diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates')
3 files changed, 15 insertions, 14 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeDomFileDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeDomFileDescriptionTemplate.cs index 3a57928536..964f13b1eb 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeDomFileDescriptionTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeDomFileDescriptionTemplate.cs @@ -35,8 +35,8 @@ using System.CodeDom.Compiler; using MonoDevelop.Projects; -using MonoDevelop.Ide.Gui.Content; using MonoDevelop.Core; +using MonoDevelop.Ide.Editor; namespace MonoDevelop.Ide.Templates { @@ -89,7 +89,7 @@ namespace MonoDevelop.Ide.Templates static string StripHeaderAndBlankLines (string text, CodeDomProvider provider) { - Mono.TextEditor.TextDocument doc = new Mono.TextEditor.TextDocument (); + var doc = TextEditorFactory.CreateNewDocument (); doc.Text = text; int realStartLine = 0; for (int i = 1; i <= doc.LineCount; i++) { @@ -106,20 +106,20 @@ namespace MonoDevelop.Ide.Templates // We reformat the C# generated output to the user's coding style anyway, but the reformatter preserves blank lines if (provider is Microsoft.CSharp.CSharpCodeProvider) { for (int i = 1; i <= doc.LineCount; i++) { - Mono.TextEditor.DocumentLine line = doc.GetLine (i); + var line = doc.GetLine (i); if (IsBlankLine (doc, line) && line.LengthIncludingDelimiter > 0) { - doc.Remove (line.Offset, line.LengthIncludingDelimiter); + doc.RemoveText (line.Offset, line.LengthIncludingDelimiter); i--; continue; } } } - int offset = doc.GetLine (Math.Max(Mono.TextEditor.DocumentLocation.MinLine, realStartLine)).Offset; - return doc.GetTextAt (offset, doc.TextLength - offset); + int offset = doc.GetLine (realStartLine).Offset; + return doc.GetTextAt (offset, doc.Length - offset); } - static bool IsBlankLine (Mono.TextEditor.TextDocument doc, Mono.TextEditor.DocumentLine line) + static bool IsBlankLine (IReadonlyTextDocument doc, IDocumentLine line) { for (int i = 0; i < line.Length; i++) { if (!Char.IsWhiteSpace (doc.GetCharAt (line.Offset + i))) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatingProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatingProvider.cs index d23660ee33..b47ae8a685 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatingProvider.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatingProvider.cs @@ -76,8 +76,8 @@ namespace MonoDevelop.Ide.Templates ProjectCreateInformation CreateProjectCreateInformation (NewProjectConfiguration config, SolutionFolder parentFolder)
{
ProjectCreateInformation cinfo = new ProjectCreateInformation ();
- cinfo.SolutionPath = FileService.ResolveFullPath (config.SolutionLocation);
- cinfo.ProjectBasePath = FileService.ResolveFullPath (config.ProjectLocation);
+ cinfo.SolutionPath = new FilePath (config.SolutionLocation).ResolveLinks ();
+ cinfo.ProjectBasePath = new FilePath (config.ProjectLocation).ResolveLinks ();
cinfo.ProjectName = config.ProjectName;
cinfo.SolutionName = config.SolutionName;
cinfo.ParentFolder = parentFolder;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs index 62332a28b5..6c334b9185 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs @@ -40,6 +40,7 @@ using MonoDevelop.Ide.StandardHeader; using System.Text; using MonoDevelop.Ide.Gui.Content; using MonoDevelop.Ide.CodeFormatting; +using MonoDevelop.Ide.Editor; using MonoDevelop.Projects.SharedAssetsProjects; using MonoDevelop.Core.StringParsing; @@ -317,7 +318,7 @@ namespace MonoDevelop.Ide.Templates ms.Write (data, 0, data.Length); } - Mono.TextEditor.TextDocument doc = new Mono.TextEditor.TextDocument (); + var doc = TextEditorFactory.CreateNewDocument (); doc.Text = content; TextStylePolicy textPolicy = policyParent != null ? policyParent.Policies.Get<TextStylePolicy> ("text/plain") @@ -327,7 +328,7 @@ namespace MonoDevelop.Ide.Templates var tabToSpaces = textPolicy.TabsToSpaces? new string (' ', textPolicy.TabWidth) : null; - foreach (Mono.TextEditor.DocumentLine line in doc.Lines) { + foreach (var line in doc.GetLines ()) { var lineText = doc.GetTextAt (line.Offset, line.Length); if (tabToSpaces != null) lineText = lineText.Replace ("\t", tabToSpaces); @@ -400,8 +401,8 @@ namespace MonoDevelop.Ide.Templates } } - tags ["Namespace"] = ns;
- if (policyParent != null)
+ tags ["Namespace"] = ns; + if (policyParent != null) tags ["SolutionName"] = policyParent.Name; if (project != null) { tags ["ProjectName"] = project.Name; @@ -418,7 +419,7 @@ namespace MonoDevelop.Ide.Templates if (languageExtension.Length > 0) tags ["LanguageExtension"] = languageExtension; - if (fileName != FilePath.Null) {
+ if (fileName != FilePath.Null) { FilePath fileDirectory = Path.GetDirectoryName (fileName); if (project != null && project.BaseDirectory != FilePath.Null && fileDirectory.IsChildPathOf (project.BaseDirectory)) tags ["ProjectRelativeDirectory"] = fileDirectory.ToRelative (project.BaseDirectory); |