From cb9d56b35ae6cecf098cc2e9c65c6c36756691fb Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 19 Oct 2005 11:53:11 +0000 Subject: [PATCH] Update conditions in the AddIn schema. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@598 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- data/schemas/AddIn.xsd | 22 +++++---- doc/technotes/ConditionList.html | 2 +- doc/technotes/DoozerList.html | 7 ++- .../BuildAddinDocumentation/MainClass.cs | 46 +++++++++++++++---- 4 files changed, 52 insertions(+), 25 deletions(-) diff --git a/data/schemas/AddIn.xsd b/data/schemas/AddIn.xsd index da4641fc3b..8100fa2519 100644 --- a/data/schemas/AddIn.xsd +++ b/data/schemas/AddIn.xsd @@ -52,15 +52,6 @@ - - - - - - - - - @@ -70,6 +61,17 @@ + + + + + + + + + + + @@ -347,7 +349,7 @@ Regular expression that specifies the language for which the display binding - will be used. Example: "\Resource Files$" + will be used. Only used for primary display bindings. Example: "\Resource Files$" diff --git a/doc/technotes/ConditionList.html b/doc/technotes/ConditionList.html index 9fd0157eb5..19e87aafb4 100644 --- a/doc/technotes/ConditionList.html +++ b/doc/technotes/ConditionList.html @@ -5,7 +5,7 @@

Condition List

This file was generated by the tool 'BuildAddinDocumentation'. -It is based on SharpDevelop 2.0.0.595.

+It is based on SharpDevelop 2.0.0.597.

  • ActiveContentExtension
  • ActiveViewContentUntitled diff --git a/doc/technotes/DoozerList.html b/doc/technotes/DoozerList.html index 607f959223..970c987a73 100644 --- a/doc/technotes/DoozerList.html +++ b/doc/technotes/DoozerList.html @@ -5,7 +5,7 @@

    Doozer List

    This file was generated by the tool 'BuildAddinDocumentation'. -It is based on SharpDevelop 2.0.0.595.

    +It is based on SharpDevelop 2.0.0.597.

    • Class
    • CodeCompletionBinding @@ -281,7 +281,7 @@ It is based on SharpDevelop 2.0.0.595.

      optional Regular expression that specifies the language for which the display binding - will be used. Example: "\Resource Files$" + will be used. Only used for primary display bindings. Example: "\Resource Files$"
      @@ -312,8 +312,7 @@ It is based on SharpDevelop 2.0.0.595.

      <DisplayBinding id = "FormDesigner" type = "Secondary" class = "ICSharpCode.FormDesigner.FormDesignerSecondaryDisplayBinding" - fileNamePattern = "\.(cs|vb)$" - languagePattern = "^(C#|VBNet)$" /> + fileNamePattern = "\.(cs|vb)$" /> </Path>

      diff --git a/src/Tools/BuildAddinDocumentation/MainClass.cs b/src/Tools/BuildAddinDocumentation/MainClass.cs index 606f2afc8b..a12d18c4da 100644 --- a/src/Tools/BuildAddinDocumentation/MainClass.cs +++ b/src/Tools/BuildAddinDocumentation/MainClass.cs @@ -68,39 +68,65 @@ namespace BuildAddinDocumentation Debug.WriteLine("Building Addin schema"); XmlDocument doc = new XmlDocument(); doc.Load(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd")); - UpdateSchema(doc, doozers); + UpdateSchema(doc, doozers, conditions); doc.Save(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd")); } - static void RecursiveInsertDoozerList(XmlElement e, List doozers) + static void RecursiveInsertDoozerList(XmlElement e, List doozers, List conditionList) { List oldChilds = new List(); - bool foundMark = false; + int foundMark = 0; foreach (XmlNode node in e) { - if (foundMark) { + if (foundMark > 0) { oldChilds.Add(node); } else { - if (node.Value != null && node.Value.Trim() == "!!! INSERT DOOZER LIST !!!") { - foundMark = true; + if (node.Value != null) { + if (node.Value.Trim() == "!!! INSERT DOOZER LIST !!!") { + foundMark = 1; + } else if (node.Value.Trim() == "!!! INSERT CONDITION ATTRIBUTES !!!") { + foundMark = 2; + } } } } - if (foundMark) { + if (foundMark == 1) { foreach (XmlNode node in oldChilds) { e.RemoveChild(node); } foreach (XmlElement doozer in doozers) { CreateChild(e, "element").SetAttribute("ref", doozer.GetAttribute("shortname")); } + } else if (foundMark == 2) { + foreach (XmlNode node in oldChilds) { + e.RemoveChild(node); + } + // create list of attributes + List attributes = new List(); + foreach (XmlElement condition in conditionList) { + foreach (XmlElement attribute in condition) { + if (attribute.Name == "attribute") { + if (!attributes.Contains(attribute.GetAttribute("name"))) { + attributes.Add(attribute.GetAttribute("name")); + } + } + } + } + attributes.Sort(); + foreach (string attribute in attributes) { + XmlElement ae = CreateChild(e, "attribute"); + ae.SetAttribute("name", attribute); + ae.SetAttribute("type", "xs:string"); + ae.SetAttribute("use", "optional"); + } } else { foreach (XmlNode node in e) { if (node is XmlElement) - RecursiveInsertDoozerList((XmlElement)node, doozers); + RecursiveInsertDoozerList((XmlElement)node, doozers, conditionList); } } } - static void UpdateSchema(XmlDocument doc, List doozers) + static void UpdateSchema(XmlDocument doc, List doozers, List conditionList) { List oldChilds = new List(); bool foundMark = false; @@ -116,7 +142,7 @@ namespace BuildAddinDocumentation foreach (XmlNode node in oldChilds) { doc.DocumentElement.RemoveChild(node); } - RecursiveInsertDoozerList(doc.DocumentElement, doozers); + RecursiveInsertDoozerList(doc.DocumentElement, doozers, conditionList); foreach (XmlElement doozer in doozers) { XmlElement e = CreateChild(doc.DocumentElement, "complexType"); e.SetAttribute("name", doozer.GetAttribute("shortname"));