diff options
author | Lluis Sanchez <lluis@novell.com> | 2007-01-30 21:37:26 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2007-01-30 21:37:26 +0300 |
commit | 94f3e8675dbc1dda20e7e5e1f0311bf0e1b4c01f (patch) | |
tree | d128b73087044ed3d1d38287cf699cde6d6d05a5 /Core/src/MonoDevelop.Ide | |
parent | 54b39aef6faad722cd543c93e3e8c7b13abaaf6b (diff) |
* MonoDevelop.Ide.CodeTemplates/CodeTemplateLoader.cs,
MonoDevelop.Ide.CodeTemplates/CodeTemplateGroup.cs,
MonoDevelop.Ide.Templates/FileTemplate.cs,
MonoDevelop.Ide.Templates/TextTemplate.cs,
MonoDevelop.Ide.ExternalTools/ToolLoader.cs,
MonoDevelop.Ide.Gui/ProjectOperations.cs: Allow comments in the
loaded xml. Patch by atsushi@ximian.com (Atsushi Enomoto). Fixes
bug #80474.
svn path=/trunk/monodevelop/; revision=71993
Diffstat (limited to 'Core/src/MonoDevelop.Ide')
7 files changed, 43 insertions, 9 deletions
diff --git a/Core/src/MonoDevelop.Ide/ChangeLog b/Core/src/MonoDevelop.Ide/ChangeLog index b4f157b512..e001842953 100644 --- a/Core/src/MonoDevelop.Ide/ChangeLog +++ b/Core/src/MonoDevelop.Ide/ChangeLog @@ -1,5 +1,16 @@ 2007-01-30 Lluis Sanchez Gual <lluis@novell.com> + * MonoDevelop.Ide.CodeTemplates/CodeTemplateLoader.cs, + MonoDevelop.Ide.CodeTemplates/CodeTemplateGroup.cs, + MonoDevelop.Ide.Templates/FileTemplate.cs, + MonoDevelop.Ide.Templates/TextTemplate.cs, + MonoDevelop.Ide.ExternalTools/ToolLoader.cs, + MonoDevelop.Ide.Gui/ProjectOperations.cs: Allow comments in the + loaded xml. Patch by atsushi@ximian.com (Atsushi Enomoto). Fixes + bug #80474. + +2007-01-30 Lluis Sanchez Gual <lluis@novell.com> + * MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs, MonoDevelop.Ide.Gui/ProjectOperations.cs, MonoDevelop.Ide.Tasks/TaskService.cs, diff --git a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateGroup.cs b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateGroup.cs index 574188b519..baa4d9e99c 100644 --- a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateGroup.cs +++ b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateGroup.cs @@ -9,6 +9,7 @@ using System; using System.Collections; using System.Xml; using System.Diagnostics; +using MonoDevelop.Core; namespace MonoDevelop.Ide.CodeTemplates { @@ -60,7 +61,10 @@ namespace MonoDevelop.Ide.CodeTemplates foreach (string ext in exts) { extensions.Add(ext); } - foreach (XmlElement childElement in el.ChildNodes) { + foreach (XmlNode childNode in el.ChildNodes) { + XmlElement childElement = childNode as XmlElement; + if (childElement == null) + continue; templates.Add(new CodeTemplate(childElement)); } } diff --git a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateLoader.cs b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateLoader.cs index a82b4e8ce2..938eb60416 100644 --- a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateLoader.cs +++ b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateLoader.cs @@ -67,7 +67,10 @@ namespace MonoDevelop.Ide.CodeTemplates return false; } - foreach (XmlElement el in doc.DocumentElement.ChildNodes) { + foreach (XmlNode node in doc.DocumentElement.ChildNodes) { + XmlElement el = node as XmlElement; + if (el == null) + continue; templateGroups.Add(new CodeTemplateGroup(el)); } } catch (Exception) { diff --git a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ToolLoader.cs b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ToolLoader.cs index 8ea1ddab9f..426afe7c75 100644 --- a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ToolLoader.cs +++ b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ToolLoader.cs @@ -49,8 +49,12 @@ namespace MonoDevelop.Ide.ExternalTools tool = new ArrayList(); XmlNodeList nodes = doc.DocumentElement.ChildNodes; - foreach (XmlElement el in nodes) + foreach (XmlNode node in nodes) { + XmlElement el = node as XmlElement; + if (el == null) + continue; tool.Add(new ExternalTool(el)); + } } catch (Exception) { return false; } diff --git a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs index 31643f532a..882e8775d7 100644 --- a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs +++ b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs @@ -597,7 +597,10 @@ namespace MonoDevelop.Ide.Gui XmlElement root = doc.DocumentElement; if (root["Files"] != null) { - foreach (XmlElement el in root["Files"].ChildNodes) { + foreach (XmlNode node in root["Files"].ChildNodes) { + XmlElement el = node as XmlElement; + if (el == null) + continue; string fileName = Runtime.FileService.RelativeToAbsolutePath(combinepath, el.Attributes["filename"].InnerText); if (File.Exists(fileName)) { IdeApp.Workbench.OpenDocument (fileName, false); @@ -606,7 +609,10 @@ namespace MonoDevelop.Ide.Gui } if (root["Views"] != null) { - foreach (XmlElement el in root["Views"].ChildNodes) { + foreach (XmlNode node in root["Views"].ChildNodes) { + XmlElement el = node as XmlElement; + if (el == null) + continue; foreach (Pad pad in IdeApp.Workbench.Pads) { if (el.GetAttribute ("Id") == pad.Id && pad.Content is IMementoCapable && el.ChildNodes.Count > 0) { IMementoCapable m = (IMementoCapable) pad.Content; diff --git a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs index 4fd51d5339..fe8b6f5150 100644 --- a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs +++ b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs @@ -191,8 +191,11 @@ namespace MonoDevelop.Ide.Templates // load the files XmlElement files = doc.DocumentElement["TemplateFiles"]; XmlNodeList nodes = files.ChildNodes; - foreach (XmlElement filenode in nodes) { - FileDescriptionTemplate template = FileDescriptionTemplate.CreateTemplate (filenode); + foreach (XmlNode filenode in nodes) { + XmlElement fileelem = filenode as XmlElement; + if (fileelem == null) + continue; + FileDescriptionTemplate template = FileDescriptionTemplate.CreateTemplate (fileelem); fileTemplate.files.Add(template); } return fileTemplate; diff --git a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TextTemplate.cs b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TextTemplate.cs index 26683cf38a..ae72373e0b 100644 --- a/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TextTemplate.cs +++ b/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TextTemplate.cs @@ -66,8 +66,11 @@ namespace MonoDevelop.Ide.Templates name = doc.DocumentElement.Attributes["name"].InnerText; XmlNodeList nodes = doc.DocumentElement.ChildNodes; - foreach (XmlElement entrynode in nodes) { - entries.Add(new Entry(entrynode)); + foreach (XmlNode entrynode in nodes) { + XmlElement entryelem = entrynode as XmlElement; + if (entryelem == null) + continue; + entries.Add(new Entry(entryelem)); } } catch (Exception e) { throw new System.IO.FileLoadException("Can't load standard sidebar template file", filename, e); |