Browse Source

Update conditions in the AddIn schema.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@598 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
cb9d56b35a
  1. 22
      data/schemas/AddIn.xsd
  2. 2
      doc/technotes/ConditionList.html
  3. 7
      doc/technotes/DoozerList.html
  4. 46
      src/Tools/BuildAddinDocumentation/MainClass.cs

22
data/schemas/AddIn.xsd

@ -52,15 +52,6 @@
<xs:element name="Path" type="Path" /> <xs:element name="Path" type="Path" />
<xs:complexType name="Condition"> <xs:complexType name="Condition">
<xs:extension base="Path"> <xs:extension base="Path">
<xs:attribute name="activewindow" type="xs:string" use="optional" />
<xs:attribute name="openwindow" type="xs:string" use="optional" />
<xs:attribute name="iscombineopen" type="xs:string" use="optional" />
<xs:attribute name="activeproject" type="xs:string" use="optional" />
<xs:attribute name="openproject" type="xs:string" use="optional" />
<xs:attribute name="textcontent" type="xs:string" use="optional" />
<xs:attribute name="ownerstate" type="xs:string" use="optional" />
<xs:attribute name="string" type="xs:string" use="optional" />
<xs:attribute name="equals" type="xs:string" use="optional" />
<xs:attribute name="action" use="optional"> <xs:attribute name="action" use="optional">
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
@ -70,6 +61,17 @@
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
<!-- !!! INSERT CONDITION ATTRIBUTES !!! -->
<xs:attribute name="activeextension" type="xs:string" use="optional" />
<xs:attribute name="activeproject" type="xs:string" use="optional" />
<xs:attribute name="activewindow" type="xs:string" use="optional" />
<xs:attribute name="debuggersupports" type="xs:string" use="optional" />
<xs:attribute name="equals" type="xs:string" use="optional" />
<xs:attribute name="openwindow" type="xs:string" use="optional" />
<xs:attribute name="options" type="xs:string" use="optional" />
<xs:attribute name="string" type="xs:string" use="optional" />
<xs:attribute name="textcontent" type="xs:string" use="optional" />
<xs:attribute name="urlRegex" type="xs:string" use="optional" />
</xs:extension> </xs:extension>
</xs:complexType> </xs:complexType>
<xs:element name="Condition" type="Condition"> <xs:element name="Condition" type="Condition">
@ -347,7 +349,7 @@
<xs:annotation> <xs:annotation>
<xs:documentation> <xs:documentation>
Regular expression that specifies the language for which the display binding 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$"
</xs:documentation> </xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>

2
doc/technotes/ConditionList.html

@ -5,7 +5,7 @@
</head><body> </head><body>
<h1>Condition List</h1> <h1>Condition List</h1>
<p class="notice">This file was generated by the tool 'BuildAddinDocumentation'. <p class="notice">This file was generated by the tool 'BuildAddinDocumentation'.
It is based on SharpDevelop 2.0.0.595.</p> It is based on SharpDevelop 2.0.0.597.</p>
<ul> <ul>
<li><a href="#ActiveContentExtension">ActiveContentExtension</a> <li><a href="#ActiveContentExtension">ActiveContentExtension</a>
<li><a href="#ActiveViewContentUntitled">ActiveViewContentUntitled</a> <li><a href="#ActiveViewContentUntitled">ActiveViewContentUntitled</a>

7
doc/technotes/DoozerList.html

@ -5,7 +5,7 @@
</head><body> </head><body>
<h1>Doozer List</h1> <h1>Doozer List</h1>
<p class="notice">This file was generated by the tool 'BuildAddinDocumentation'. <p class="notice">This file was generated by the tool 'BuildAddinDocumentation'.
It is based on SharpDevelop 2.0.0.595.</p> It is based on SharpDevelop 2.0.0.597.</p>
<ul> <ul>
<li><a href="#Class">Class</a> <li><a href="#Class">Class</a>
<li><a href="#CodeCompletionBinding">CodeCompletionBinding</a> <li><a href="#CodeCompletionBinding">CodeCompletionBinding</a>
@ -281,7 +281,7 @@ It is based on SharpDevelop 2.0.0.595.</p>
<td class="userequired">optional</td> <td class="userequired">optional</td>
<td> <td>
Regular expression that specifies the language for which the display binding 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$"
</td> </td>
</tr> </tr>
<tr><td colspan=3><hr></td></tr> <tr><td colspan=3><hr></td></tr>
@ -312,8 +312,7 @@ It is based on SharpDevelop 2.0.0.595.</p>
&lt;DisplayBinding id = "FormDesigner" &lt;DisplayBinding id = "FormDesigner"
type = "Secondary" type = "Secondary"
class = "ICSharpCode.FormDesigner.FormDesignerSecondaryDisplayBinding" class = "ICSharpCode.FormDesigner.FormDesignerSecondaryDisplayBinding"
fileNamePattern = "\.(cs|vb)$" fileNamePattern = "\.(cs|vb)$" /&gt;
languagePattern = "^(C#|VBNet)$" /&gt;
&lt;/Path&gt;</pre></p> &lt;/Path&gt;</pre></p>
</div> </div>
<div> <div>

46
src/Tools/BuildAddinDocumentation/MainClass.cs

@ -68,39 +68,65 @@ namespace BuildAddinDocumentation
Debug.WriteLine("Building Addin schema"); Debug.WriteLine("Building Addin schema");
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.Load(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd")); 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")); doc.Save(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd"));
} }
static void RecursiveInsertDoozerList(XmlElement e, List<XmlElement> doozers) static void RecursiveInsertDoozerList(XmlElement e, List<XmlElement> doozers, List<XmlElement> conditionList)
{ {
List<XmlNode> oldChilds = new List<XmlNode>(); List<XmlNode> oldChilds = new List<XmlNode>();
bool foundMark = false; int foundMark = 0;
foreach (XmlNode node in e) { foreach (XmlNode node in e) {
if (foundMark) { if (foundMark > 0) {
oldChilds.Add(node); oldChilds.Add(node);
} else { } else {
if (node.Value != null && node.Value.Trim() == "!!! INSERT DOOZER LIST !!!") { if (node.Value != null) {
foundMark = true; 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) { foreach (XmlNode node in oldChilds) {
e.RemoveChild(node); e.RemoveChild(node);
} }
foreach (XmlElement doozer in doozers) { foreach (XmlElement doozer in doozers) {
CreateChild(e, "element").SetAttribute("ref", doozer.GetAttribute("shortname")); 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<string> attributes = new List<string>();
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 { } else {
foreach (XmlNode node in e) { foreach (XmlNode node in e) {
if (node is XmlElement) if (node is XmlElement)
RecursiveInsertDoozerList((XmlElement)node, doozers); RecursiveInsertDoozerList((XmlElement)node, doozers, conditionList);
} }
} }
} }
static void UpdateSchema(XmlDocument doc, List<XmlElement> doozers) static void UpdateSchema(XmlDocument doc, List<XmlElement> doozers, List<XmlElement> conditionList)
{ {
List<XmlNode> oldChilds = new List<XmlNode>(); List<XmlNode> oldChilds = new List<XmlNode>();
bool foundMark = false; bool foundMark = false;
@ -116,7 +142,7 @@ namespace BuildAddinDocumentation
foreach (XmlNode node in oldChilds) { foreach (XmlNode node in oldChilds) {
doc.DocumentElement.RemoveChild(node); doc.DocumentElement.RemoveChild(node);
} }
RecursiveInsertDoozerList(doc.DocumentElement, doozers); RecursiveInsertDoozerList(doc.DocumentElement, doozers, conditionList);
foreach (XmlElement doozer in doozers) { foreach (XmlElement doozer in doozers) {
XmlElement e = CreateChild(doc.DocumentElement, "complexType"); XmlElement e = CreateChild(doc.DocumentElement, "complexType");
e.SetAttribute("name", doozer.GetAttribute("shortname")); e.SetAttribute("name", doozer.GetAttribute("shortname"));

Loading…
Cancel
Save