diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlDisplayBinding.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlDisplayBinding.cs
index aef868c2a9..e059dc5fe1 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlDisplayBinding.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlDisplayBinding.cs
@@ -58,25 +58,31 @@ namespace ICSharpCode.XmlEditor
}
///
- /// Gets the known xml file extensions.
+ /// Returns the extensions defined in the @extensions property of the first codon in the tree node.
///
- public static string[] GetXmlFileExtensions()
- {
- foreach (ParserDescriptor parser in AddInTree.BuildItems("/Workspace/Parser", null, false)) {
- if (parser.Language == "XmlFoldingParser") {
- return parser.Supportedextensions;
+ public static string[] GetXmlFileExtensions(AddInTreeNode node)
+ {
+ if (node != null) {
+ foreach (Codon codon in node.Codons) {
+ if (codon.Id == "Xml") {
+ List extensions = new List();
+ foreach (string ext in codon.Properties["extensions"].Split(';')) {
+ extensions.Add(ext.Trim());
+ }
+ return extensions.ToArray();
+ }
}
}
-
-// // Did not find the XmlFoldingParser so default to those files defined by the
-// // HighlightingManager.
- // TODO : not supported in AvalonEdit
-// IHighlightingStrategy strategy = HighlightingManager.Manager.FindHighlighter("XML");
-// if (strategy != null) {
-// return strategy.Extensions;
-// }
-
- return new string[] { ".xml", ".addin" };
+ return new string[0];
+ }
+
+ ///
+ /// Gets the known xml file extensions.
+ ///
+ public static string[] GetXmlFileExtensions()
+ {
+ AddInTreeNode node = AddInTree.GetTreeNode("/AddIns/DefaultTextEditor/CodeCompletion", false);
+ return GetXmlFileExtensions(node);
}
public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlLanguageBinding.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlLanguageBinding.cs
index c377fe0cca..3adcc0f287 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlLanguageBinding.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlLanguageBinding.cs
@@ -11,9 +11,6 @@ using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.XmlEditor
{
- ///
- /// Description of XmlLanguageBinding.
- ///
public class XmlLanguageBinding : DefaultLanguageBinding
{
public override IFormattingStrategy FormattingStrategy {
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
index 080329e800..ebb7c1e42d 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
@@ -27,11 +27,11 @@
/>
-
+
+ id = "Xml"
+ class = "ICSharpCode.XmlEditor.XmlLanguageBinding"
+ extensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco" />
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Editor/XmlEditorFileExtensionsTestFixture.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Editor/XmlEditorFileExtensionsTestFixture.cs
new file mode 100644
index 0000000000..fbc21b29cf
--- /dev/null
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Editor/XmlEditorFileExtensionsTestFixture.cs
@@ -0,0 +1,53 @@
+//
+//
+//
+//
+// $Revision: 4723 $
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using ICSharpCode.Core;
+using ICSharpCode.XmlEditor;
+using NUnit.Framework;
+
+namespace XmlEditor.Tests.Editor
+{
+ [TestFixture]
+ public class XmlEditorFileExtensionsTestFixture
+ {
+ AddInTreeNode addinTreeNode;
+
+ [SetUp]
+ public void SetUp()
+ {
+
+ string addinXml = "\r\n" +
+ "";
+
+ using (StringReader reader = new StringReader(addinXml)) {
+ AddIn addin = AddIn.Load(reader);
+
+ addinTreeNode = new AddInTreeNode();
+ addinTreeNode.Codons.Add(new Codon(addin, "CodeCompletionC#", new Properties(), new ICondition[0]));
+
+ Properties properties = new Properties();
+ properties.Set("extensions", " .xml; .xsd ");
+ properties.Set("id", "Xml");
+ addinTreeNode.Codons.Add(new Codon(addin, "CodeCompletionXml", properties, new ICondition[0]));
+ }
+ }
+
+ [Test]
+ public void ExpectedFileExtensions()
+ {
+ string[] expectedExtension = new string[] { ".xml", ".xsd" };
+ Assert.AreEqual(expectedExtension, XmlDisplayBinding.GetXmlFileExtensions(addinTreeNode));
+ }
+ }
+}
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj b/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
index 40319e3959..850a43d7d2 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
@@ -75,6 +75,7 @@
+
@@ -205,6 +206,7 @@
+