diff --git a/src/AddIns/BackendBindings/XmlBinding/Resources/SelectXmlSchema.xfrm b/src/AddIns/BackendBindings/XmlBinding/Resources/SelectXmlSchema.xfrm
deleted file mode 100644
index 574ab19744..0000000000
--- a/src/AddIns/BackendBindings/XmlBinding/Resources/SelectXmlSchema.xfrm
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Resources/XmlEditorOptionsPanel.xfrm b/src/AddIns/BackendBindings/XmlBinding/Resources/XmlEditorOptionsPanel.xfrm
deleted file mode 100644
index 7a9cebae60..0000000000
--- a/src/AddIns/BackendBindings/XmlBinding/Resources/XmlEditorOptionsPanel.xfrm
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Resources/XmlSchemasPanel.xfrm b/src/AddIns/BackendBindings/XmlBinding/Resources/XmlSchemasPanel.xfrm
deleted file mode 100644
index 6c3d2eaf57..0000000000
--- a/src/AddIns/BackendBindings/XmlBinding/Resources/XmlSchemasPanel.xfrm
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCodeCompletionBinding.cs b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCodeCompletionBinding.cs
new file mode 100644
index 0000000000..6faa0d6a9a
--- /dev/null
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCodeCompletionBinding.cs
@@ -0,0 +1,87 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using ICSharpCode.SharpDevelop.Editor;
+using ICSharpCode.XmlBinding.Parser;
+using ICSharpCode.XmlEditor;
+using System.IO;
+
+namespace ICSharpCode.XmlBinding
+{
+ ///
+ /// Description of XmlCodeCompletionBinding.
+ ///
+ public class XmlCodeCompletionBinding : ICodeCompletionBinding
+ {
+ public XmlCodeCompletionBinding()
+ {
+ }
+
+ public CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch)
+ {
+ string text = String.Concat(editor.Document.GetText(0, editor.Caret.Offset), ch);
+ string extension = Path.GetExtension(editor.FileName);
+ string defaultNamespacePrefix = XmlSchemaManager.GetNamespacePrefix(extension);
+ XmlSchemaCompletionData defaultSchemaCompletionData = XmlSchemaManager.GetSchemaCompletionData(extension);
+ XmlCompletionDataProvider provider = new XmlCompletionDataProvider(XmlSchemaManager.SchemaCompletionDataItems,
+ defaultSchemaCompletionData,
+ defaultNamespacePrefix);
+
+ switch (ch) {
+ case '=':
+ // Namespace completion.
+ if (XmlParser.IsNamespaceDeclaration(text, text.Length)) {
+ editor.ShowCompletionWindow(XmlSchemaManager.SchemaCompletionDataItems.GetNamespaceCompletionData());
+ return CodeCompletionKeyPressResult.Completed;
+ }
+ break;
+ case '<':
+ // Child element completion.
+ XmlElementPath parentPath = XmlParser.GetParentElementPath(text);
+ if (parentPath.Elements.Count > 0) {
+ editor.ShowCompletionWindow(provider.GetChildElementCompletionData(parentPath));
+ return CodeCompletionKeyPressResult.Completed;
+ } else if (defaultSchemaCompletionData != null) {
+ editor.ShowCompletionWindow(defaultSchemaCompletionData.GetElementCompletionData(defaultNamespacePrefix));
+ return CodeCompletionKeyPressResult.Completed;
+ }
+ break;
+ case ' ':
+ // Attribute completion.
+ if (!XmlParser.IsInsideAttributeValue(text, text.Length)) {
+ XmlElementPath path = XmlParser.GetActiveElementStartPath(text, text.Length);
+ if (path.Elements.Count > 0) {
+ editor.ShowCompletionWindow(provider.GetAttributeCompletionData(path));
+ return CodeCompletionKeyPressResult.Completed;
+ }
+ }
+ break;
+ default:
+ // Attribute value completion.
+ if (XmlParser.IsAttributeValueChar(ch)) {
+ string attributeName = XmlParser.GetAttributeName(text, text.Length);
+ if (attributeName.Length > 0) {
+ XmlElementPath elementPath = XmlParser.GetActiveElementStartPath(text, text.Length);
+ if (elementPath.Elements.Count > 0) {
+ editor.ShowCompletionWindow(provider.GetAttributeValueCompletionData(elementPath, attributeName));
+ return CodeCompletionKeyPressResult.CompletedIncludeKeyInCompletion;
+ }
+ }
+ }
+ break;
+ }
+
+ return CodeCompletionKeyPressResult.None;
+ }
+
+ public bool CtrlSpace(ITextEditor editor)
+ {
+ return false;
+ }
+ }
+}
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionData.cs b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionData.cs
index 563c93ce93..b6785979f6 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionData.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionData.cs
@@ -5,18 +5,17 @@
// $Revision: 2932 $
//
+using ICSharpCode.SharpDevelop.Editor;
using System;
namespace ICSharpCode.XmlEditor
{
- /*
///
/// Holds the text for namespace, child element or attribute
/// autocomplete (intellisense).
///
- public class XmlCompletionData : ICompletionData
+ public class XmlCompletionItem : DefaultCompletionItem
{
- string text;
DataType dataType = DataType.XmlElement;
string description = String.Empty;
@@ -30,76 +29,52 @@ namespace ICSharpCode.XmlEditor
XmlAttributeValue = 4
}
- public XmlCompletionData(string text)
+ public XmlCompletionItem(string text)
: this(text, String.Empty, DataType.XmlElement)
{
}
- public XmlCompletionData(string text, string description)
+ public XmlCompletionItem(string text, string description)
: this(text, description, DataType.XmlElement)
{
}
- public XmlCompletionData(string text, DataType dataType)
+ public XmlCompletionItem(string text, DataType dataType)
: this(text, String.Empty, dataType)
{
}
- public XmlCompletionData(string text, string description, DataType dataType)
+ public XmlCompletionItem(string text, string description, DataType dataType)
+ : base(text)
{
- this.text = text;
this.description = description;
this.dataType = dataType;
}
- public int ImageIndex {
- get {
- return 0;
- }
- }
-
- public string Text {
- get {
- return text;
- }
- set {
- text = value;
- }
- }
-
///
/// Returns the xml item's documentation as retrieved from
/// the xs:annotation/xs:documentation element.
///
- public string Description {
+ public override string Description {
get {
return description;
}
}
- public double Priority {
- get {
- return 0;
- }
- }
-
- public bool InsertAction(TextArea textArea, char ch)
+ public override void Complete(CompletionContext context)
{
- if ((dataType == DataType.XmlElement) || (dataType == DataType.XmlAttributeValue)) {
- textArea.InsertString(text);
- }
- else if (dataType == DataType.NamespaceUri) {
- textArea.InsertString(String.Concat("\"", text, "\""));
- } else {
- // Insert an attribute.
- Caret caret = textArea.Caret;
- textArea.InsertString(String.Concat(text, "=\"\""));
-
- // Move caret into the middle of the attribute quotes.
- caret.Position = textArea.Document.OffsetToPosition(caret.Offset - 1);
- }
- return false;
+ base.Complete(context);
+
+// if (dataType == DataType.NamespaceUri) {
+// textArea.InsertString(String.Concat("\"", text, "\""));
+// } else {
+// // Insert an attribute.
+// Caret caret = textArea.Caret;
+// textArea.InsertString(String.Concat(text, "=\"\""));
+//
+// // Move caret into the middle of the attribute quotes.
+// caret.Position = textArea.Document.OffsetToPosition(caret.Offset - 1);
+// }
}
}
- */
}
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataCollection.cs b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataCollection.cs
index 1e25ac20dd..a32a25013b 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataCollection.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataCollection.cs
@@ -5,12 +5,12 @@
// $Revision: 1965 $
//
+using ICSharpCode.SharpDevelop.Editor;
using System;
using System.Collections;
namespace ICSharpCode.XmlEditor
{
- /*
///
/// A collection that stores objects.
///
@@ -41,7 +41,7 @@ namespace ICSharpCode.XmlEditor
///
/// A array of objects with which to intialize the collection
///
- public XmlCompletionDataCollection(XmlCompletionData[] val)
+ public XmlCompletionDataCollection(XmlCompletionItem[] val)
{
this.AddRange(val);
}
@@ -52,9 +52,9 @@ namespace ICSharpCode.XmlEditor
/// The zero-based index of the entry to locate in the collection.
/// The entry at the specified index of the collection.
/// is outside the valid range of indexes for the collection.
- public XmlCompletionData this[int index] {
+ public XmlCompletionItem this[int index] {
get {
- return ((XmlCompletionData)(List[index]));
+ return ((XmlCompletionItem)(List[index]));
}
set {
List[index] = value;
@@ -71,7 +71,7 @@ namespace ICSharpCode.XmlEditor
/// The to add.
/// The index at which the new element was inserted.
///
- public int Add(XmlCompletionData val)
+ public int Add(XmlCompletionItem val)
{
int index = -1;
if (!Contains(val)) {
@@ -87,7 +87,7 @@ namespace ICSharpCode.XmlEditor
/// An array of type containing the objects to add to the collection.
///
///
- public void AddRange(XmlCompletionData[] val)
+ public void AddRange(XmlCompletionItem[] val)
{
for (int i = 0; i < val.Length; i++) {
this.Add(val[i]);
@@ -119,7 +119,7 @@ namespace ICSharpCode.XmlEditor
/// otherwise, .
///
///
- public bool Contains(XmlCompletionData val)
+ public bool Contains(XmlCompletionItem val)
{
if (val.Text != null) {
if (val.Text.Length > 0) {
@@ -133,7 +133,7 @@ namespace ICSharpCode.XmlEditor
{
bool contains = false;
- foreach (XmlCompletionData data in this) {
+ foreach (XmlCompletionItem data in this) {
if (data.Text != null) {
if (data.Text.Length > 0) {
if (data.Text == name) {
@@ -163,7 +163,7 @@ namespace ICSharpCode.XmlEditor
/// is .
/// is less than 's lowbound.
///
- public void CopyTo(XmlCompletionData[] array, int index)
+ public void CopyTo(XmlCompletionItem[] array, int index)
{
List.CopyTo(array, index);
}
@@ -172,7 +172,7 @@ namespace ICSharpCode.XmlEditor
/// Copies the values to a one-dimensional instance at the
/// specified index.
///
- public void CopyTo(ICompletionData[] array, int index)
+ public void CopyTo(ICompletionItem[] array, int index)
{
List.CopyTo(array, index);
}
@@ -187,7 +187,7 @@ namespace ICSharpCode.XmlEditor
/// , if found; otherwise, -1.
///
///
- public int IndexOf(XmlCompletionData val)
+ public int IndexOf(XmlCompletionItem val)
{
return List.IndexOf(val);
}
@@ -198,7 +198,7 @@ namespace ICSharpCode.XmlEditor
/// The zero-based index where should be inserted.
/// The to insert.
///
- public void Insert(int index, XmlCompletionData val)
+ public void Insert(int index, XmlCompletionItem val)
{
List.Insert(index, val);
}
@@ -207,9 +207,9 @@ namespace ICSharpCode.XmlEditor
/// Returns an array of items.
///
///
- public ICompletionData[] ToArray()
+ public ICompletionItem[] ToArray()
{
- ICompletionData[] data = new ICompletionData[Count];
+ XmlCompletionItem[] data = new XmlCompletionItem[Count];
CopyTo(data, 0);
return data;
}
@@ -228,7 +228,7 @@ namespace ICSharpCode.XmlEditor
///
/// The to remove from the .
/// is not found in the Collection.
- public void Remove(XmlCompletionData val)
+ public void Remove(XmlCompletionItem val)
{
List.Remove(val);
}
@@ -256,9 +256,9 @@ namespace ICSharpCode.XmlEditor
///
/// Gets the current in the .
///
- public XmlCompletionData Current {
+ public XmlCompletionItem Current {
get {
- return ((XmlCompletionData)(baseEnumerator.Current));
+ return ((XmlCompletionItem)(baseEnumerator.Current));
}
}
@@ -285,5 +285,4 @@ namespace ICSharpCode.XmlEditor
}
}
}
- */
}
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataProvider.cs b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataProvider.cs
index 40c58604aa..84e16434ba 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataProvider.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataProvider.cs
@@ -5,19 +5,20 @@
// $Revision: 2760 $
//
-using ICSharpCode.XmlBinding.Parser;
+using ICSharpCode.XmlBinding;
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
+using ICSharpCode.SharpDevelop.Editor;
+using ICSharpCode.XmlBinding.Parser;
namespace ICSharpCode.XmlEditor
{
- /*
///
/// Provides the autocomplete (intellisense) data for an
/// xml document that specifies a known schema.
///
- public class XmlCompletionDataProvider : AbstractCompletionDataProvider
+ public class XmlCompletionDataProvider
{
XmlSchemaCompletionDataCollection schemaCompletionDataItems;
XmlSchemaCompletionData defaultSchemaCompletionData;
@@ -28,77 +29,13 @@ namespace ICSharpCode.XmlEditor
this.schemaCompletionDataItems = schemaCompletionDataItems;
this.defaultSchemaCompletionData = defaultSchemaCompletionData;
this.defaultNamespacePrefix = defaultNamespacePrefix;
- DefaultIndex = 0;
}
- public override ImageList ImageList {
- get {
- return XmlCompletionDataImageList.GetImageList();
- }
- }
-
- ///
- /// Overrides the default behaviour and allows special xml
- /// characters such as '.' and ':' to be used as completion data.
- ///
- public override CompletionDataProviderKeyResult ProcessKey(char key)
- {
- if (key == '\r' || key == '\t') {
- return CompletionDataProviderKeyResult.InsertionKey;
- }
- return CompletionDataProviderKeyResult.NormalKey;
- }
-
- public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
- {
- preSelection = null;
- string text = String.Concat(textArea.Document.GetText(0, textArea.Caret.Offset), charTyped);
-
- switch (charTyped) {
- case '=':
- // Namespace intellisense.
- if (XmlParser.IsNamespaceDeclaration(text, text.Length)) {
- return schemaCompletionDataItems.GetNamespaceCompletionData();;
- }
- break;
- case '<':
- // Child element intellisense.
- XmlElementPath parentPath = XmlParser.GetParentElementPath(text);
- if (parentPath.Elements.Count > 0) {
- return GetChildElementCompletionData(parentPath);
- } else if (defaultSchemaCompletionData != null) {
- return defaultSchemaCompletionData.GetElementCompletionData(defaultNamespacePrefix);
- }
- break;
-
- case ' ':
- // Attribute intellisense.
- if (!XmlParser.IsInsideAttributeValue(text, text.Length)) {
- XmlElementPath path = XmlParser.GetActiveElementStartPath(text, text.Length);
- if (path.Elements.Count > 0) {
- return GetAttributeCompletionData(path);
- }
- }
- break;
-
- default:
-
- // Attribute value intellisense.
- if (XmlParser.IsAttributeValueChar(charTyped)) {
- string attributeName = XmlParser.GetAttributeName(text, text.Length);
- if (attributeName.Length > 0) {
- XmlElementPath elementPath = XmlParser.GetActiveElementStartPath(text, text.Length);
- if (elementPath.Elements.Count > 0) {
- preSelection = charTyped.ToString();
- return GetAttributeValueCompletionData(elementPath, attributeName);
- }
- }
- }
- break;
- }
-
- return null;
- }
+// public override ImageList ImageList {
+// get {
+// return XmlCompletionDataImageList.GetImageList();
+// }
+// }
///
/// Finds the schema given the xml element path.
@@ -108,7 +45,7 @@ namespace ICSharpCode.XmlEditor
if (path.Elements.Count > 0) {
string namespaceUri = path.Elements[0].Namespace;
if (namespaceUri.Length > 0) {
- return schemaCompletionDataItems[namespaceUri];
+ return XmlSchemaManager.SchemaCompletionDataItems[namespaceUri];
} else if (defaultSchemaCompletionData != null) {
// Use the default schema namespace if none
@@ -143,41 +80,46 @@ namespace ICSharpCode.XmlEditor
return schemaCompletionDataItems.GetSchemaFromFileName(fileName);
}
- ICompletionData[] GetChildElementCompletionData(XmlElementPath path)
+ public ICompletionItemList GetChildElementCompletionData(XmlElementPath path)
{
- ICompletionData[] completionData = null;
+ XmlCompletionItemList list = new XmlCompletionItemList();
XmlSchemaCompletionData schema = FindSchema(path);
if (schema != null) {
- completionData = schema.GetChildElementCompletionData(path);
+ list.Items.AddRange(schema.GetChildElementCompletionData(path));
}
- return completionData;
+ list.SortItems();
+
+ return list;
}
- ICompletionData[] GetAttributeCompletionData(XmlElementPath path)
+ public ICompletionItemList GetAttributeCompletionData(XmlElementPath path)
{
- ICompletionData[] completionData = null;
+ var list = new XmlCompletionItemList();
XmlSchemaCompletionData schema = FindSchema(path);
if (schema != null) {
- completionData = schema.GetAttributeCompletionData(path);
+ list.Items.AddRange(schema.GetAttributeCompletionData(path));
}
- return completionData;
+ list.SortItems();
+
+ return list;
}
- ICompletionData[] GetAttributeValueCompletionData(XmlElementPath path, string name)
+ public ICompletionItemList GetAttributeValueCompletionData(XmlElementPath path, string name)
{
- ICompletionData[] completionData = null;
+ var list = new XmlCompletionItemList();
XmlSchemaCompletionData schema = FindSchema(path);
if (schema != null) {
- completionData = schema.GetAttributeValueCompletionData(path, name);
+ list.Items.AddRange(schema.GetAttributeValueCompletionData(path, name));
}
- return completionData;
+ list.SortItems();
+
+ return list;
}
}
- */
}
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionItemList.cs b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionItemList.cs
new file mode 100644
index 0000000000..7d9f035f1e
--- /dev/null
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionItemList.cs
@@ -0,0 +1,30 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using ICSharpCode.SharpDevelop.Editor;
+using System;
+
+namespace ICSharpCode.XmlBinding
+{
+ ///
+ /// Description of XmlCompletionItemList.
+ ///
+ sealed class XmlCompletionItemList : DefaultCompletionItemList
+ {
+ public XmlCompletionItemList()
+ {
+ }
+
+ public override CompletionItemListKeyResult ProcessInput(char key)
+ {
+ if (key == ':' || key == '.')
+ return CompletionItemListKeyResult.NormalKey;
+
+ return base.ProcessInput(key);
+ }
+ }
+}
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml
index c3f3ee69d0..0921289ab7 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml
@@ -1,9 +1,14 @@
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml.cs
index 93a5cd31c8..567d891e52 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml.cs
@@ -11,15 +11,13 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes;
-namespace ICSharpCode.XmlBinding.Gui
+namespace ICSharpCode.XmlBinding.Gui.Dialogs
{
///
/// Interaction logic for SelectXmlSchema.xaml
///
-
public partial class SelectXmlSchema : Window
{
-
public SelectXmlSchema()
{
InitializeComponent();
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml
index 723a4374c9..b85288f1e3 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml
@@ -1,7 +1,13 @@
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml.cs
index 8efadc161a..67fab157cc 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using ICSharpCode.XmlEditor;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
@@ -10,19 +11,40 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using ICSharpCode.SharpDevelop;
namespace ICSharpCode.XmlBinding.Gui.Dialogs
{
- ///
- /// Interaction logic for XmlEditorOptionsPanel.xaml
- ///
+ ///
+ /// Interaction logic for XmlEditorOptionsPanel.xaml
+ ///
+ public partial class XmlEditorOptionsPanel : UserControl, IOptionPanel
+ {
+ public XmlEditorOptionsPanel()
+ {
+ InitializeComponent();
+ }
- public partial class XmlEditorOptionsPanel : UserControl
- {
- public XmlEditorOptionsPanel()
- {
- InitializeComponent();
- }
-
- }
+ public object Owner { get; set; }
+
+ public object Control {
+ get {
+ return this;
+ }
+ }
+
+ public void LoadOptions()
+ {
+ chkShowAttributesWhenFolded.IsChecked = XmlEditorAddInOptions.ShowAttributesWhenFolded;
+ chkShowSchemaAnnotation.IsChecked = XmlEditorAddInOptions.ShowSchemaAnnotation;
+ }
+
+ public bool SaveOptions()
+ {
+ XmlEditorAddInOptions.ShowAttributesWhenFolded = chkShowAttributesWhenFolded.IsChecked == true;
+ XmlEditorAddInOptions.ShowSchemaAnnotation = chkShowSchemaAnnotation.IsChecked == true;
+
+ return true;
+ }
+ }
}
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml
index 42256a8f76..f2f44f31da 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml
@@ -1,7 +1,38 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml.cs
index 05693dd29b..556824dd0f 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml.cs
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Drawing;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@@ -11,18 +13,37 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.XmlEditor;
+
namespace ICSharpCode.XmlBinding.Gui.Dialogs
{
- ///
- /// Interaction logic for XmlSchemasPanel.xaml
- ///
-
- public partial class XmlSchemasPanel : UserControl
- {
- public XmlSchemasPanel()
- {
- InitializeComponent();
- }
-
- }
+ ///
+ /// Interaction logic for XmlSchemasPanel.xaml
+ ///
+ public partial class XmlSchemasPanel : UserControl, IOptionPanel
+ {
+ public XmlSchemasPanel()
+ {
+ InitializeComponent();
+ }
+
+ public object Owner { get; set; }
+
+ public object Control {
+ get {
+ return this;
+ }
+ }
+
+ public void LoadOptions()
+ {
+ }
+
+ public bool SaveOptions()
+ {
+ return false;
+ }
+ }
}
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/XmlDisplayBinding.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/XmlDisplayBinding.cs
index f904b9eb8f..0ba91f9287 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Gui/XmlDisplayBinding.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Gui/XmlDisplayBinding.cs
@@ -57,9 +57,7 @@ namespace ICSharpCode.XmlBinding.Gui
/// Gets the known xml file extensions.
///
public static string[] GetXmlFileExtensions()
- {
- return new string[] { ".xml" };
-
+ {
foreach (ParserDescriptor parser in AddInTree.BuildItems("/Workspace/Parser", null, false)) {
if (parser.Codon.Id == "XmlFoldingParser") {
return parser.Supportedextensions;
@@ -73,7 +71,7 @@ namespace ICSharpCode.XmlBinding.Gui
// return strategy.Extensions;
// }
- return new string[0];
+ return new string[] { ".xml", ".addin" };
}
public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Parser/QualifiedNameCollection.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Parser/QualifiedNameCollection.cs
index 0340f6d975..25b226dee8 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Parser/QualifiedNameCollection.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Parser/QualifiedNameCollection.cs
@@ -17,15 +17,12 @@ namespace ICSharpCode.XmlBinding.Parser
/// A collection that stores objects.
///
[Serializable()]
- public class QualifiedNameCollection : Collection {
- List list;
-
+ public class QualifiedNameCollection : Collection {
///
/// Initializes a new instance of .
///
public QualifiedNameCollection()
{
- this.list = new List();
}
///
@@ -50,30 +47,14 @@ namespace ICSharpCode.XmlBinding.Parser
this.AddRange(val);
}
- ///
- /// Represents the entry at the specified index of the .
- ///
- /// The zero-based index of the entry to locate in the collection.
- /// The entry at the specified index of the collection.
- /// is outside the valid range of indexes for the collection.
- public QualifiedName this[int index] {
- get {
- return ((QualifiedName)(this.list[index]));
- }
- set {
- this.list[index] = value;
- }
- }
-
- ///
- /// Adds a with the specified value to the
- /// .
- ///
- /// The to add.
- ///
- public void Add(QualifiedName val)
+ public override string ToString()
{
- this.list.Add(val);
+ string text = "";
+
+ for (int i = 0; i < this.Count; i++)
+ text += (i == 0) ? this[i] + "" : " > " + this[i];
+
+ return text;
}
///
@@ -85,9 +66,8 @@ namespace ICSharpCode.XmlBinding.Parser
///
public void AddRange(QualifiedName[] val)
{
- for (int i = 0; i < val.Length; i++) {
+ for (int i = 0; i < val.Length; i++)
this.Add(val[i]);
- }
}
///
@@ -100,90 +80,7 @@ namespace ICSharpCode.XmlBinding.Parser
public void AddRange(QualifiedNameCollection val)
{
for (int i = 0; i < val.Count; i++)
- {
this.Add(val[i]);
- }
- }
-
- ///
- /// Gets a value indicating whether the
- /// contains the specified .
- ///
- /// The to locate.
- ///
- /// if the is contained in the collection;
- /// otherwise, .
- ///
- ///
- public bool Contains(QualifiedName val)
- {
- return this.list.Contains(val);
- }
-
- ///
- /// Copies the values to a one-dimensional instance at the
- /// specified index.
- ///
- /// The one-dimensional that is the destination of the values copied from .
- /// The index in where copying begins.
- ///
- /// is multidimensional.
- /// -or-
- /// The number of elements in the is greater than
- /// the available space between and the end of
- /// .
- ///
- /// is .
- /// is less than 's lowbound.
- ///
- public void CopyTo(QualifiedName[] array, int index)
- {
- this.list.CopyTo(array, index);
- }
-
- ///
- /// Returns the index of a in
- /// the .
- ///
- /// The to locate.
- ///
- /// The index of the of in the
- /// , if found; otherwise, -1.
- ///
- ///
- public int IndexOf(QualifiedName val)
- {
- return this.list.IndexOf(val);
- }
-
- ///
- /// Inserts a into the at the specified index.
- ///
- /// The zero-based index where should be inserted.
- /// The to insert.
- ///
- public void Insert(int index, QualifiedName val)
- {
- this.list.Insert(index, val);
- }
-
- ///
- /// Returns an enumerator that can iterate through the .
- ///
- ///
- public new QualifiedNameEnumerator GetEnumerator()
- {
- return new QualifiedNameEnumerator(this);
- }
-
- ///
- /// Removes a specific from the .
- ///
- /// The to remove from the .
- /// is not found in the Collection.
- public void Remove(QualifiedName val)
- {
- this.list.Remove(val);
}
///
@@ -218,57 +115,5 @@ namespace ICSharpCode.XmlBinding.Parser
return String.Empty;
}
}
-
- ///
- /// Enumerator that can iterate through a QualifiedNameCollection.
- ///
- ///
- ///
- ///
- public class QualifiedNameEnumerator : IEnumerator
- {
- IEnumerator baseEnumerator;
- IEnumerable temp;
-
- ///
- /// Initializes a new instance of .
- ///
- public QualifiedNameEnumerator(QualifiedNameCollection mappings)
- {
- this.temp = ((IEnumerable)(mappings));
- this.baseEnumerator = temp.GetEnumerator();
- }
-
- ///
- /// Gets the current in the .
- ///
- public QualifiedName Current {
- get {
- return ((QualifiedName)(baseEnumerator.Current));
- }
- }
-
- object IEnumerator.Current {
- get {
- return baseEnumerator.Current;
- }
- }
-
- ///
- /// Advances the enumerator to the next of the .
- ///
- public bool MoveNext()
- {
- return baseEnumerator.MoveNext();
- }
-
- ///
- /// Sets the enumerator to its initial position, which is before the first element in the .
- ///
- public void Reset()
- {
- baseEnumerator.Reset();
- }
- }
}
}
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Parser/XmlParser.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Parser/XmlParser.cs
index 780234f279..23b9541e50 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Parser/XmlParser.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Parser/XmlParser.cs
@@ -100,7 +100,7 @@ namespace ICSharpCode.XmlBinding.Parser
QualifiedNameCollection namespaces = new QualifiedNameCollection();
return GetActiveElementStartPathAtIndex(xml, index, namespaces);
}
-
+
///
/// Gets the parent element path based on the index position.
///
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionData.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionData.cs
index 4aa2458407..1b763fd5b3 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionData.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionData.cs
@@ -5,16 +5,17 @@
// $Revision: 1965 $
//
-using ICSharpCode.XmlBinding.Parser;
+using ICSharpCode.XmlBinding;
using System;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Schema;
+using ICSharpCode.SharpDevelop.Editor;
+using ICSharpCode.XmlBinding.Parser;
namespace ICSharpCode.XmlEditor
{
- /*
///
/// Holds the completion (intellisense) data for an xml schema.
///
@@ -141,7 +142,7 @@ namespace ICSharpCode.XmlEditor
///
/// Gets the possible root elements for an xml document using this schema.
///
- public ICompletionData[] GetElementCompletionData()
+ public ICompletionItemList GetElementCompletionData()
{
return GetElementCompletionData(String.Empty);
}
@@ -149,7 +150,7 @@ namespace ICSharpCode.XmlEditor
///
/// Gets the possible root elements for an xml document using this schema.
///
- public ICompletionData[] GetElementCompletionData(string namespacePrefix)
+ public ICompletionItemList GetElementCompletionData(string namespacePrefix)
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
@@ -161,14 +162,18 @@ namespace ICSharpCode.XmlEditor
}
}
- return data.ToArray();
+ var list = new XmlCompletionItemList();
+ list.Items.AddRange(data.ToArray());
+ list.SortItems();
+
+ return list;
}
///
/// Gets the attribute completion data for the xml element that exists
/// at the end of the specified path.
///
- public ICompletionData[] GetAttributeCompletionData(XmlElementPath path)
+ public ICompletionItem[] GetAttributeCompletionData(XmlElementPath path)
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
@@ -188,7 +193,7 @@ namespace ICSharpCode.XmlEditor
/// Gets the child element completion data for the xml element that exists
/// at the end of the specified path.
///
- public ICompletionData[] GetChildElementCompletionData(XmlElementPath path)
+ public ICompletionItem[] GetChildElementCompletionData(XmlElementPath path)
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
@@ -206,7 +211,7 @@ namespace ICSharpCode.XmlEditor
///
/// Gets the autocomplete data for the specified attribute value.
///
- public ICompletionData[] GetAttributeValueCompletionData(XmlElementPath path, string name)
+ public ICompletionItem[] GetAttributeValueCompletionData(XmlElementPath path, string name)
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
@@ -608,8 +613,8 @@ namespace ICSharpCode.XmlEditor
if (prefix.Length > 0) {
name = String.Concat(prefix, ":", name);
}
- XmlCompletionData completionData = new XmlCompletionData(name, documentation);
- data.Add(completionData);
+ XmlCompletionItem item = new XmlCompletionItem(name, documentation);
+ data.Add(item);
}
}
@@ -630,7 +635,7 @@ namespace ICSharpCode.XmlEditor
///
void AddElements(XmlCompletionDataCollection lhs, XmlCompletionDataCollection rhs)
{
- foreach (XmlCompletionData data in rhs) {
+ foreach (XmlCompletionItem data in rhs) {
if (!lhs.Contains(data)) {
lhs.Add(data);
}
@@ -817,7 +822,7 @@ namespace ICSharpCode.XmlEditor
if (name != null) {
string documentation = GetDocumentation(attribute.Annotation);
- XmlCompletionData completionData = new XmlCompletionData(name, documentation, XmlCompletionData.DataType.XmlAttribute);
+ XmlCompletionItem completionData = new XmlCompletionItem(name, documentation, XmlCompletionItem.DataType.XmlAttribute);
data.Add(completionData);
}
}
@@ -1270,7 +1275,7 @@ namespace ICSharpCode.XmlEditor
///
void AddAttributeValue(XmlCompletionDataCollection data, string valueText)
{
- XmlCompletionData completionData = new XmlCompletionData(valueText, XmlCompletionData.DataType.XmlAttributeValue);
+ XmlCompletionItem completionData = new XmlCompletionItem(valueText, XmlCompletionItem.DataType.XmlAttributeValue);
data.Add(completionData);
}
@@ -1280,7 +1285,7 @@ namespace ICSharpCode.XmlEditor
void AddAttributeValue(XmlCompletionDataCollection data, string valueText, XmlSchemaAnnotation annotation)
{
string documentation = GetDocumentation(annotation);
- XmlCompletionData completionData = new XmlCompletionData(valueText, documentation, XmlCompletionData.DataType.XmlAttributeValue);
+ XmlCompletionItem completionData = new XmlCompletionItem(valueText, documentation, XmlCompletionItem.DataType.XmlAttributeValue);
data.Add(completionData);
}
@@ -1289,7 +1294,7 @@ namespace ICSharpCode.XmlEditor
///
void AddAttributeValue(XmlCompletionDataCollection data, string valueText, string description)
{
- XmlCompletionData completionData = new XmlCompletionData(valueText, description, XmlCompletionData.DataType.XmlAttributeValue);
+ XmlCompletionItem completionData = new XmlCompletionItem(valueText, description, XmlCompletionItem.DataType.XmlAttributeValue);
data.Add(completionData);
}
@@ -1343,6 +1348,5 @@ namespace ICSharpCode.XmlEditor
return matchedElement;
}
}
- */
}
\ No newline at end of file
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionDataCollection.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionDataCollection.cs
index 6867d8e140..ff03c1b143 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionDataCollection.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionDataCollection.cs
@@ -5,13 +5,14 @@
// $Revision: 1965 $
//
+using ICSharpCode.XmlBinding;
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.XmlEditor
{
- /*
///
/// A collection that stores objects.
///
@@ -62,16 +63,18 @@ namespace ICSharpCode.XmlEditor
}
}
- public ICompletionData[] GetNamespaceCompletionData()
+ public ICompletionItemList GetNamespaceCompletionData()
{
- List completionItems = new List();
+ XmlCompletionItemList list = new XmlCompletionItemList();
foreach (XmlSchemaCompletionData schema in this) {
- XmlCompletionData completionData = new XmlCompletionData(schema.NamespaceUri, XmlCompletionData.DataType.NamespaceUri);
- completionItems.Add(completionData);
+ XmlCompletionItem completionData = new XmlCompletionItem(schema.NamespaceUri, XmlCompletionItem.DataType.NamespaceUri);
+ list.Items.Add(completionData);
}
- return completionItems.ToArray();
+ list.SortItems();
+
+ return list;
}
///
@@ -288,5 +291,4 @@ namespace ICSharpCode.XmlEditor
return matchedItem;
}
}
- */
}
diff --git a/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaManager.cs b/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaManager.cs
index 730ecf8346..9d8699107f 100644
--- a/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaManager.cs
+++ b/src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaManager.cs
@@ -13,7 +13,7 @@ using ICSharpCode.Core;
namespace ICSharpCode.XmlEditor
{
-/*
+
///
/// Keeps track of all the schemas that the Xml Editor is aware
/// of.
@@ -28,10 +28,6 @@ namespace ICSharpCode.XmlEditor
public static event EventHandler UserSchemaAdded;
public static event EventHandler UserSchemaRemoved;
-
- XmlSchemaManager()
- {
- }
///
/// Determines whether the specified namespace is actually the W3C namespace for
@@ -50,7 +46,7 @@ namespace ICSharpCode.XmlEditor
if (schemas == null) {
schemas = new XmlSchemaCompletionDataCollection();
manager = new XmlSchemaManager();
- manager.ReadSchemas();
+ ReadSchemas();
}
return schemas;
@@ -132,7 +128,7 @@ namespace ICSharpCode.XmlEditor
///
/// Reads the system and user added schemas.
///
- void ReadSchemas()
+ static void ReadSchemas()
{
// MSBuild schemas are in framework directory:
ReadSchemas(RuntimeEnvironment.GetRuntimeDirectory(), true);
@@ -143,7 +139,7 @@ namespace ICSharpCode.XmlEditor
///
/// Reads all .xsd files in the specified folder.
///
- void ReadSchemas(string folder, bool readOnly)
+ static void ReadSchemas(string folder, bool readOnly)
{
if (Directory.Exists(folder)) {
foreach (string fileName in Directory.GetFiles(folder, "*.xsd")) {
@@ -158,7 +154,7 @@ namespace ICSharpCode.XmlEditor
///
/// If the schema namespace exists in the collection it is not added.
///
- void ReadSchema(string fileName, bool readOnly)
+ static void ReadSchema(string fileName, bool readOnly)
{
try {
string baseUri = XmlSchemaCompletionData.GetUri(fileName);
@@ -219,5 +215,4 @@ namespace ICSharpCode.XmlEditor
}
}
}
- */
}
diff --git a/src/AddIns/BackendBindings/XmlBinding/XmlBinding.addin b/src/AddIns/BackendBindings/XmlBinding/XmlBinding.addin
index 66f1d2dc09..7028587ecf 100644
--- a/src/AddIns/BackendBindings/XmlBinding/XmlBinding.addin
+++ b/src/AddIns/BackendBindings/XmlBinding/XmlBinding.addin
@@ -5,11 +5,7 @@
addInManagerHidden = "preinstalled">
-
-
-
-
-
+
@@ -19,6 +15,14 @@
+
+
+
+
+ class = "ICSharpCode.XmlBinding.Gui.Dialogs.XmlSchemasPanel" />
+ class = "ICSharpCode.XmlBinding.Gui.Dialogs.XmlEditorOptionsPanel" />
diff --git a/src/AddIns/BackendBindings/XmlBinding/XmlBinding.csproj b/src/AddIns/BackendBindings/XmlBinding/XmlBinding.csproj
index b5663d3a4c..780094b0e8 100644
--- a/src/AddIns/BackendBindings/XmlBinding/XmlBinding.csproj
+++ b/src/AddIns/BackendBindings/XmlBinding/XmlBinding.csproj
@@ -69,6 +69,8 @@
Always
+
+
SelectXmlSchema.xaml
Code
@@ -107,16 +109,19 @@
-
+
+ Form
+
- Form
-
+
+ UserControl
+
@@ -131,7 +136,6 @@
- UserControl
@@ -146,7 +150,9 @@
-
+
+ UserControl
+
@@ -155,23 +161,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
{2748AD25-9C63-4E12-877B-4DCE96FBED54}
ICSharpCode.SharpDevelop
@@ -180,6 +174,10 @@
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}
ICSharpCode.Core
+
+ {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}
+ ICSharpCode.Core.Presentation
+
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}
ICSharpCode.Core.WinForms
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
index d998eeba01..4ffc28ff04 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
@@ -8,37 +8,37 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -89,10 +88,10 @@
class = "ICSharpCode.XmlEditor.FormatXmlCommand" />
-
+ -->
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs b/src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs
index 28187281c6..38fee19842 100644
--- a/src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs
+++ b/src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs
@@ -27,4 +27,22 @@ namespace ICSharpCode.Core.Presentation
return ResourceService.GetString(key);
}
}
+
+ ///
+ /// Markup extension that works like StringParser.Parse
+ ///
+ public class StringParseExtension : MarkupExtension
+ {
+ protected string text;
+
+ public StringParseExtension(string text)
+ {
+ this.text = text;
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return StringParser.Parse(text);
+ }
+ }
}