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 @@ @@ -52,15 +52,6 @@
<xs:element name="Path" type="Path" />
<xs:complexType name="Condition">
<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:simpleType>
<xs:restriction base="xs:string">
@ -70,6 +61,17 @@ @@ -70,6 +61,17 @@
</xs:restriction>
</xs:simpleType>
</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:complexType>
<xs:element name="Condition" type="Condition">
@ -347,7 +349,7 @@ @@ -347,7 +349,7 @@
<xs:annotation>
<xs:documentation>
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:annotation>
</xs:attribute>

2
doc/technotes/ConditionList.html

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
</head><body>
<h1>Condition List</h1>
<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>
<li><a href="#ActiveContentExtension">ActiveContentExtension</a>
<li><a href="#ActiveViewContentUntitled">ActiveViewContentUntitled</a>

7
doc/technotes/DoozerList.html

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
</head><body>
<h1>Doozer List</h1>
<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>
<li><a href="#Class">Class</a>
<li><a href="#CodeCompletionBinding">CodeCompletionBinding</a>
@ -281,7 +281,7 @@ It is based on SharpDevelop 2.0.0.595.</p> @@ -281,7 +281,7 @@ It is based on SharpDevelop 2.0.0.595.</p>
<td class="userequired">optional</td>
<td>
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>
</tr>
<tr><td colspan=3><hr></td></tr>
@ -312,8 +312,7 @@ It is based on SharpDevelop 2.0.0.595.</p> @@ -312,8 +312,7 @@ It is based on SharpDevelop 2.0.0.595.</p>
&lt;DisplayBinding id = "FormDesigner"
type = "Secondary"
class = "ICSharpCode.FormDesigner.FormDesignerSecondaryDisplayBinding"
fileNamePattern = "\.(cs|vb)$"
languagePattern = "^(C#|VBNet)$" /&gt;
fileNamePattern = "\.(cs|vb)$" /&gt;
&lt;/Path&gt;</pre></p>
</div>
<div>

46
src/Tools/BuildAddinDocumentation/MainClass.cs

@ -68,39 +68,65 @@ namespace BuildAddinDocumentation @@ -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<XmlElement> doozers)
static void RecursiveInsertDoozerList(XmlElement e, List<XmlElement> doozers, List<XmlElement> conditionList)
{
List<XmlNode> oldChilds = new List<XmlNode>();
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<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 {
foreach (XmlNode node in e) {
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>();
bool foundMark = false;
@ -116,7 +142,7 @@ namespace BuildAddinDocumentation @@ -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"));

Loading…
Cancel
Save