diff options
Diffstat (limited to 'main/src/addins/TextTemplating/MonoDevelop.TextTemplating')
3 files changed, 9 insertions, 7 deletions
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFileGenerator.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFileGenerator.cs index ce0582208c..5b37d5c0b2 100644 --- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFileGenerator.cs +++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFileGenerator.cs @@ -28,14 +28,15 @@ using System; using MonoDevelop.Ide.CustomTools; using MonoDevelop.Projects; using MonoDevelop.Core; +using System.Threading.Tasks; namespace MonoDevelop.TextTemplating { public class TextTemplatingFileGenerator : ISingleFileCustomTool { - public IAsyncOperation Generate (IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result) + public Task Generate (ProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result) { - return new ThreadAsyncOperation (delegate { + return Task.Factory.StartNew (delegate { using (var host = new ProjectFileTemplatingHost (file)) { host.AddMonoDevelopHostImport (); var defaultOutputName = file.FilePath.ChangeExtension (".cs"); //cs extension for VS compat @@ -50,7 +51,7 @@ namespace MonoDevelop.TextTemplating foreach (var err in host.Errors) monitor.Log.WriteLine (err); } - }, result); + }); } } } diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFilePreprocessor.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFilePreprocessor.cs index bf08fb5dff..e1887f35b2 100644 --- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFilePreprocessor.cs +++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingFilePreprocessor.cs @@ -33,14 +33,15 @@ using MonoDevelop.Ide; using MonoDevelop.Ide.CustomTools; using MonoDevelop.Projects; using MonoDevelop.Projects.Policies; +using System.Threading.Tasks; namespace MonoDevelop.TextTemplating { public class TextTemplatingFilePreprocessor : ISingleFileCustomTool { - public IAsyncOperation Generate (IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result) + public Task Generate (ProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result) { - return new ThreadAsyncOperation (delegate { + return Task.Factory.StartNew (delegate { var host = new ProjectFileTemplatingHost (file); var dnp = file.Project as DotNetProject; @@ -74,7 +75,7 @@ namespace MonoDevelop.TextTemplating result.Errors.AddRange (host.Errors); foreach (var err in host.Errors) monitor.Log.WriteLine (err); - }, result); + }); } static bool warningLogged; diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs index e434450482..34892038ad 100644 --- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs +++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs @@ -39,7 +39,7 @@ namespace MonoDevelop.TextTemplating TaskService.Errors.Clear (); foreach (CompilerError err in errors) { - TaskService.Errors.Add (new Task (err.FileName, err.ErrorText, err.Column, err.Line, + TaskService.Errors.Add (new UserTask (err.FileName, err.ErrorText, err.Column, err.Line, err.IsWarning? TaskSeverity.Warning : TaskSeverity.Error)); } TaskService.ShowErrors (); |