diff options
Diffstat (limited to 'main/src/addins/Xml/Editor')
-rw-r--r-- | main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs | 16 | ||||
-rw-r--r-- | main/src/addins/Xml/Editor/XmlEditorService.cs | 12 | ||||
-rw-r--r-- | main/src/addins/Xml/Editor/XmlTextEditorExtension.cs | 6 |
3 files changed, 21 insertions, 13 deletions
diff --git a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs index 4a1f05cd07..f0395d0aea 100644 --- a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs +++ b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs @@ -61,7 +61,7 @@ namespace MonoDevelop.Xml.Editor MonoDevelop.Ide.Gui.Components.PadTreeView outlineTreeView; TreeStore outlineTreeStore; - List<DotNetProject> ownerProjects; + List<DotNetProject> ownerProjects = new List<DotNetProject> (); #region Setup and teardown @@ -80,7 +80,12 @@ namespace MonoDevelop.Xml.Editor { base.Initialize (); - UpdateOwnerProjects (); + // Delay the execution of UpdateOwnerProjects since it may end calling Document.AttachToProject, + // which shouldn't be called while the extension chain is being initialized. + // TODO: Move handling of owner projects to Document + Application.Invoke (delegate { + UpdateOwnerProjects (); + }); var parser = new XmlParser (CreateRootState (), false); tracker = new DocumentStateTracker<XmlParser> (parser, Editor); @@ -110,7 +115,7 @@ namespace MonoDevelop.Xml.Editor ownerProjects = new List<DotNetProject> (); return; } - var projects = new HashSet<DotNetProject> (IdeApp.Workspace.GetAllSolutionItems<DotNetProject> ().Where (p => p.IsFileInProject (Document.FileName))); + var projects = new HashSet<DotNetProject> (IdeApp.Workspace.GetAllItems<DotNetProject> ().Where (p => p.IsFileInProject (Document.FileName))); if (ownerProjects == null || !projects.SetEquals (ownerProjects)) { ownerProjects = projects.OrderBy (p => p.Name).ToList (); var dnp = Document.Project as DotNetProject; @@ -827,8 +832,11 @@ namespace MonoDevelop.Xml.Editor void UpdatePath () { - List<XObject> l = GetCurrentPath (); + //update timeout could get called after disposed + if (tracker == null) + return; + List<XObject> l = GetCurrentPath (); //build the list var path = new List<PathEntry> (); diff --git a/main/src/addins/Xml/Editor/XmlEditorService.cs b/main/src/addins/Xml/Editor/XmlEditorService.cs index 513b2e7458..c5b0f82730 100644 --- a/main/src/addins/Xml/Editor/XmlEditorService.cs +++ b/main/src/addins/Xml/Editor/XmlEditorService.cs @@ -57,7 +57,7 @@ namespace MonoDevelop.Xml.Editor error.IsWarning = false; //Task task = new Task(fileName, message, column, line); - Task task = new Task (error); + UserTask task = new UserTask (error); TaskService.Errors.Add(task);
}
#endregion
@@ -100,7 +100,7 @@ namespace MonoDevelop.Xml.Editor } }*/ - public static IProgressMonitor GetMonitor () + public static ProgressMonitor GetMonitor () { return IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("XML", "md-xml-file-icon", true, true); }
@@ -198,7 +198,7 @@ namespace MonoDevelop.Xml.Editor /// <summary>
/// Checks that the xml in this view is well-formed.
/// </summary>
- public static XmlDocument ValidateWellFormedness (IProgressMonitor monitor, string xml, string fileName) + public static XmlDocument ValidateWellFormedness (ProgressMonitor monitor, string xml, string fileName) {
monitor.BeginTask (GettextCatalog.GetString ("Validating XML..."), 1); bool error = false;
@@ -227,7 +227,7 @@ namespace MonoDevelop.Xml.Editor /// <summary>
/// Validates the xml against known schemas.
/// </summary> - public static XmlDocument ValidateXml (IProgressMonitor monitor, string xml, string fileName) + public static XmlDocument ValidateXml (ProgressMonitor monitor, string xml, string fileName) { monitor.BeginTask (GettextCatalog.GetString ("Validating XML..."), 1); bool error = false;
@@ -293,7 +293,7 @@ namespace MonoDevelop.Xml.Editor /// <summary>
/// Validates the schema.
/// </summary> - public static XmlSchema ValidateSchema (IProgressMonitor monitor, string xml, string fileName) + public static XmlSchema ValidateSchema (ProgressMonitor monitor, string xml, string fileName) { monitor.BeginTask (GettextCatalog.GetString ("Validating schema..."), 1); bool error = false;
@@ -341,7 +341,7 @@ namespace MonoDevelop.Xml.Editor return error? null: schema;
}
- public static XslCompiledTransform ValidateStylesheet (IProgressMonitor monitor, string xml, string fileName)
+ public static XslCompiledTransform ValidateStylesheet (ProgressMonitor monitor, string xml, string fileName)
{
monitor.BeginTask (GettextCatalog.GetString ("Validating stylesheet..."), 1); bool error = true;
diff --git a/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs b/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs index a9dcf1d6b3..36685f8fa2 100644 --- a/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs +++ b/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs @@ -503,7 +503,7 @@ namespace MonoDevelop.Xml.Editor try {
TaskService.Errors.Clear ();
string xml = Editor.Text; - using (IProgressMonitor monitor = XmlEditorService.GetMonitor ()) { + using (ProgressMonitor monitor = XmlEditorService.GetMonitor ()) { XmlDocument doc = XmlEditorService.ValidateWellFormedness (monitor, xml, FileName); if (doc == null) return; @@ -570,7 +570,7 @@ namespace MonoDevelop.Xml.Editor public void ValidateCommand () { TaskService.Errors.Clear (); - using (IProgressMonitor monitor = XmlEditorService.GetMonitor()) { + using (ProgressMonitor monitor = XmlEditorService.GetMonitor()) { if (IsSchema) XmlEditorService.ValidateSchema (monitor, Editor.Text, FileName); else
@@ -596,7 +596,7 @@ namespace MonoDevelop.Xml.Editor return; } - using (IProgressMonitor monitor = XmlEditorService.GetMonitor()) { + using (ProgressMonitor monitor = XmlEditorService.GetMonitor()) { try { string xsltContent; try { |