Browse Source

- removed xfrms

- implemented basic CC

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/XmlEditor@4122 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
af7878c95c
  1. 38
      src/AddIns/BackendBindings/XmlBinding/Resources/SelectXmlSchema.xfrm
  2. 45
      src/AddIns/BackendBindings/XmlBinding/Resources/XmlEditorOptionsPanel.xfrm
  3. 110
      src/AddIns/BackendBindings/XmlBinding/Resources/XmlSchemasPanel.xfrm
  4. 87
      src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCodeCompletionBinding.cs
  5. 67
      src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionData.cs
  6. 35
      src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataCollection.cs
  7. 114
      src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataProvider.cs
  8. 30
      src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionItemList.cs
  9. 15
      src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml
  10. 4
      src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml.cs
  11. 12
      src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml
  12. 46
      src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml.cs
  13. 37
      src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml
  14. 45
      src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml.cs
  15. 6
      src/AddIns/BackendBindings/XmlBinding/Src/Gui/XmlDisplayBinding.cs
  16. 173
      src/AddIns/BackendBindings/XmlBinding/Src/Parser/QualifiedNameCollection.cs
  17. 2
      src/AddIns/BackendBindings/XmlBinding/Src/Parser/XmlParser.cs
  18. 36
      src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionData.cs
  19. 16
      src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionDataCollection.cs
  20. 15
      src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaManager.cs
  21. 18
      src/AddIns/BackendBindings/XmlBinding/XmlBinding.addin
  22. 32
      src/AddIns/BackendBindings/XmlBinding/XmlBinding.csproj
  23. 53
      src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
  24. 18
      src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs

38
src/AddIns/BackendBindings/XmlBinding/Resources/SelectXmlSchema.xfrm

@ -1,38 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="SelectXmlSchemaForm" />
<ShowInTaskbar value="False" />
<ClientSize value="{Width=376, Height=286}" />
<DockPadding value="" />
<Text value="${res:ICSharpCode.XmlEditor.SelectXmlSchema.DialogTitle}" />
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: ${res:Global.OKButtonText}" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="okButton" />
<Location value="{X=248,Y=256}" />
<Size value="{Width=56, Height=24}" />
<Text value="${res:Global.OKButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="2" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=312,Y=256}" />
<Size value="{Width=56, Height=24}" />
<Text value="${res:Global.CancelButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="1" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ListBox>
<Name value="schemaListBox" />
<Size value="{Width=360, Height=238}" />
<Anchor value="Top, Bottom, Left, Right" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
</System.Windows.Forms.ListBox>
</Controls>
</System.Windows.Forms.Form>
</Components>

45
src/AddIns/BackendBindings/XmlBinding/Resources/XmlEditorOptionsPanel.xfrm

@ -1,45 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlEditorOptionsPanel" />
<DockPadding value="" />
<ClientSize value="{Width=352, Height=336}" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="foldingGroupBox" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=336, Height=56}" />
<Text value="${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.FoldingGroupLabel}" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="showAttributesWhenFoldedCheckBox" />
<Location value="{X=16,Y=26}" />
<Size value="{Width=304, Height=16}" />
<Text value="${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.ShowAttributesWhenFoldedLabel}" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="xmlCompletionGroupBox" />
<TabIndex value="1" />
<Location value="{X=8,Y=72}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=336, Height=56}" />
<Text value="${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.XmlCompletionGroupLabel}" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="showSchemaAnnotationCheckBox" />
<Location value="{X=16,Y=27}" />
<Size value="{Width=304, Height=16}" />
<Text value="${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.ShowSchemaAnnotationLabel}" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

110
src/AddIns/BackendBindings/XmlBinding/Resources/XmlSchemasPanel.xfrm

@ -1,110 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlEditorOptionsPanel" />
<DockPadding value="" />
<ClientSize value="{Width=352, Height=328}" />
<SnapToGrid value="False" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="xmlFileExtensionGroupBox" />
<TabIndex value="4" />
<Location value="{X=8,Y=186}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=336, Height=126}" />
<Text value="${res:ICSharpCode.XmlEditor.XmlSchemaPanel.FileExtensionsGroupBoxText}" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="namespacePrefixTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="10" />
<Location value="{X=80,Y=84}" />
<Size value="{Width=248, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="prefixLabel" />
<Text value="${res:ICSharpCode.XmlEditor.XmlSchemaPanel.NamespacePrefixLabelText}" />
<TextAlign value="MiddleLeft" />
<TabIndex value="9" />
<Size value="{Width=72, Height=16}" />
<Location value="{X=8,Y=84}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="schemaTextBox" />
<ReadOnly value="True" />
<Anchor value="Top, Left, Right" />
<TabIndex value="8" />
<Location value="{X=80,Y=58}" />
<Size value="{Width=216, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.ComboBox>
<Name value="fileExtensionComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="7" />
<Location value="{X=80,Y=34}" />
<Size value="{Width=248, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="schemaLabel" />
<Text value="${res:ICSharpCode.XmlEditor.XmlSchemaPanel.SchemaLabelText}" />
<TextAlign value="MiddleLeft" />
<TabIndex value="1" />
<Size value="{Width=72, Height=16}" />
<Location value="{X=8,Y=58}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Label>
<Name value="fileExtensionLabel" />
<Text value="${res:ICSharpCode.XmlEditor.XmlSchemaPanel.FileExtensionLabelText}" />
<TextAlign value="MiddleLeft" />
<TabIndex value="0" />
<Size value="{Width=72, Height=16}" />
<Location value="{X=8,Y=34}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="changeSchemaButton" />
<Location value="{X=304,Y=58}" />
<Size value="{Width=24, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="6" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="schemasGroupBox" />
<TabIndex value="3" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=336, Height=170}" />
<Text value="${res:ICSharpCode.XmlEditor.XmlSchemaPanel.SchemasGroupBoxText}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="addButton" />
<Location value="{X=160,Y=140}" />
<Size value="{Width=80, Height=24}" />
<Text value="${res:Global.AddButtonText}..." />
<Anchor value="Bottom, Right" />
<TabIndex value="4" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="removeButton" />
<Location value="{X=247,Y=140}" />
<Size value="{Width=80, Height=24}" />
<Text value="${res:Global.RemoveButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="5" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ListBox>
<Name value="schemaListBox" />
<Size value="{Width=320, Height=108}" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=8,Y=29}" />
</System.Windows.Forms.ListBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

87
src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCodeCompletionBinding.cs

@ -0,0 +1,87 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.XmlBinding.Parser;
using ICSharpCode.XmlEditor;
using System.IO;
namespace ICSharpCode.XmlBinding
{
/// <summary>
/// Description of XmlCodeCompletionBinding.
/// </summary>
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;
}
}
}

67
src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionData.cs

@ -5,18 +5,17 @@
// <version>$Revision: 2932 $</version> // <version>$Revision: 2932 $</version>
// </file> // </file>
using ICSharpCode.SharpDevelop.Editor;
using System; using System;
namespace ICSharpCode.XmlEditor namespace ICSharpCode.XmlEditor
{ {
/*
/// <summary> /// <summary>
/// Holds the text for namespace, child element or attribute /// Holds the text for namespace, child element or attribute
/// autocomplete (intellisense). /// autocomplete (intellisense).
/// </summary> /// </summary>
public class XmlCompletionData : ICompletionData public class XmlCompletionItem : DefaultCompletionItem
{ {
string text;
DataType dataType = DataType.XmlElement; DataType dataType = DataType.XmlElement;
string description = String.Empty; string description = String.Empty;
@ -30,76 +29,52 @@ namespace ICSharpCode.XmlEditor
XmlAttributeValue = 4 XmlAttributeValue = 4
} }
public XmlCompletionData(string text) public XmlCompletionItem(string text)
: this(text, String.Empty, DataType.XmlElement) : this(text, String.Empty, DataType.XmlElement)
{ {
} }
public XmlCompletionData(string text, string description) public XmlCompletionItem(string text, string description)
: this(text, description, DataType.XmlElement) : this(text, description, DataType.XmlElement)
{ {
} }
public XmlCompletionData(string text, DataType dataType) public XmlCompletionItem(string text, DataType dataType)
: this(text, String.Empty, 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.description = description;
this.dataType = dataType; this.dataType = dataType;
} }
public int ImageIndex {
get {
return 0;
}
}
public string Text {
get {
return text;
}
set {
text = value;
}
}
/// <summary> /// <summary>
/// Returns the xml item's documentation as retrieved from /// Returns the xml item's documentation as retrieved from
/// the xs:annotation/xs:documentation element. /// the xs:annotation/xs:documentation element.
/// </summary> /// </summary>
public string Description { public override string Description {
get { get {
return description; return description;
} }
} }
public double Priority { public override void Complete(CompletionContext context)
get {
return 0;
}
}
public bool InsertAction(TextArea textArea, char ch)
{ {
if ((dataType == DataType.XmlElement) || (dataType == DataType.XmlAttributeValue)) { base.Complete(context);
textArea.InsertString(text);
} // if (dataType == DataType.NamespaceUri) {
else if (dataType == DataType.NamespaceUri) { // textArea.InsertString(String.Concat("\"", text, "\""));
textArea.InsertString(String.Concat("\"", text, "\"")); // } else {
} else { // // Insert an attribute.
// Insert an attribute. // Caret caret = textArea.Caret;
Caret caret = textArea.Caret; // textArea.InsertString(String.Concat(text, "=\"\""));
textArea.InsertString(String.Concat(text, "=\"\"")); //
// // Move caret into the middle of the attribute quotes.
// Move caret into the middle of the attribute quotes. // caret.Position = textArea.Document.OffsetToPosition(caret.Offset - 1);
caret.Position = textArea.Document.OffsetToPosition(caret.Offset - 1); // }
}
return false;
} }
} }
*/
} }

35
src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataCollection.cs

@ -5,12 +5,12 @@
// <version>$Revision: 1965 $</version> // <version>$Revision: 1965 $</version>
// </file> // </file>
using ICSharpCode.SharpDevelop.Editor;
using System; using System;
using System.Collections; using System.Collections;
namespace ICSharpCode.XmlEditor namespace ICSharpCode.XmlEditor
{ {
/*
/// <summary> /// <summary>
/// A collection that stores <see cref='XmlCompletionData'/> objects. /// A collection that stores <see cref='XmlCompletionData'/> objects.
/// </summary> /// </summary>
@ -41,7 +41,7 @@ namespace ICSharpCode.XmlEditor
/// <param name='val'> /// <param name='val'>
/// A array of <see cref='XmlCompletionData'/> objects with which to intialize the collection /// A array of <see cref='XmlCompletionData'/> objects with which to intialize the collection
/// </param> /// </param>
public XmlCompletionDataCollection(XmlCompletionData[] val) public XmlCompletionDataCollection(XmlCompletionItem[] val)
{ {
this.AddRange(val); this.AddRange(val);
} }
@ -52,9 +52,9 @@ namespace ICSharpCode.XmlEditor
/// <param name='index'>The zero-based index of the entry to locate in the collection.</param> /// <param name='index'>The zero-based index of the entry to locate in the collection.</param>
/// <value>The entry at the specified index of the collection.</value> /// <value>The entry at the specified index of the collection.</value>
/// <exception cref='ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception> /// <exception cref='ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
public XmlCompletionData this[int index] { public XmlCompletionItem this[int index] {
get { get {
return ((XmlCompletionData)(List[index])); return ((XmlCompletionItem)(List[index]));
} }
set { set {
List[index] = value; List[index] = value;
@ -71,7 +71,7 @@ namespace ICSharpCode.XmlEditor
/// <param name='val'>The <see cref='XmlCompletionData'/> to add.</param> /// <param name='val'>The <see cref='XmlCompletionData'/> to add.</param>
/// <returns>The index at which the new element was inserted.</returns> /// <returns>The index at which the new element was inserted.</returns>
/// <seealso cref='XmlCompletionDataCollection.AddRange'/> /// <seealso cref='XmlCompletionDataCollection.AddRange'/>
public int Add(XmlCompletionData val) public int Add(XmlCompletionItem val)
{ {
int index = -1; int index = -1;
if (!Contains(val)) { if (!Contains(val)) {
@ -87,7 +87,7 @@ namespace ICSharpCode.XmlEditor
/// An array of type <see cref='XmlCompletionData'/> containing the objects to add to the collection. /// An array of type <see cref='XmlCompletionData'/> containing the objects to add to the collection.
/// </param> /// </param>
/// <seealso cref='XmlCompletionDataCollection.Add'/> /// <seealso cref='XmlCompletionDataCollection.Add'/>
public void AddRange(XmlCompletionData[] val) public void AddRange(XmlCompletionItem[] val)
{ {
for (int i = 0; i < val.Length; i++) { for (int i = 0; i < val.Length; i++) {
this.Add(val[i]); this.Add(val[i]);
@ -119,7 +119,7 @@ namespace ICSharpCode.XmlEditor
/// otherwise, <see langword='false'/>. /// otherwise, <see langword='false'/>.
/// </returns> /// </returns>
/// <seealso cref='XmlCompletionDataCollection.IndexOf'/> /// <seealso cref='XmlCompletionDataCollection.IndexOf'/>
public bool Contains(XmlCompletionData val) public bool Contains(XmlCompletionItem val)
{ {
if (val.Text != null) { if (val.Text != null) {
if (val.Text.Length > 0) { if (val.Text.Length > 0) {
@ -133,7 +133,7 @@ namespace ICSharpCode.XmlEditor
{ {
bool contains = false; bool contains = false;
foreach (XmlCompletionData data in this) { foreach (XmlCompletionItem data in this) {
if (data.Text != null) { if (data.Text != null) {
if (data.Text.Length > 0) { if (data.Text.Length > 0) {
if (data.Text == name) { if (data.Text == name) {
@ -163,7 +163,7 @@ namespace ICSharpCode.XmlEditor
/// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception> /// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
/// <exception cref='ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception> /// <exception cref='ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
/// <seealso cref='Array'/> /// <seealso cref='Array'/>
public void CopyTo(XmlCompletionData[] array, int index) public void CopyTo(XmlCompletionItem[] array, int index)
{ {
List.CopyTo(array, index); List.CopyTo(array, index);
} }
@ -172,7 +172,7 @@ namespace ICSharpCode.XmlEditor
/// Copies the <see cref='XmlCompletionDataCollection'/> values to a one-dimensional <see cref='Array'/> instance at the /// Copies the <see cref='XmlCompletionDataCollection'/> values to a one-dimensional <see cref='Array'/> instance at the
/// specified index. /// specified index.
/// </summary> /// </summary>
public void CopyTo(ICompletionData[] array, int index) public void CopyTo(ICompletionItem[] array, int index)
{ {
List.CopyTo(array, index); List.CopyTo(array, index);
} }
@ -187,7 +187,7 @@ namespace ICSharpCode.XmlEditor
/// <see cref='XmlCompletionDataCollection'/>, if found; otherwise, -1. /// <see cref='XmlCompletionDataCollection'/>, if found; otherwise, -1.
/// </returns> /// </returns>
/// <seealso cref='XmlCompletionDataCollection.Contains'/> /// <seealso cref='XmlCompletionDataCollection.Contains'/>
public int IndexOf(XmlCompletionData val) public int IndexOf(XmlCompletionItem val)
{ {
return List.IndexOf(val); return List.IndexOf(val);
} }
@ -198,7 +198,7 @@ namespace ICSharpCode.XmlEditor
/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param> /// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
/// <param name='val'>The <see cref='XmlCompletionData'/> to insert.</param> /// <param name='val'>The <see cref='XmlCompletionData'/> to insert.</param>
/// <seealso cref='XmlCompletionDataCollection.Add'/> /// <seealso cref='XmlCompletionDataCollection.Add'/>
public void Insert(int index, XmlCompletionData val) public void Insert(int index, XmlCompletionItem val)
{ {
List.Insert(index, val); List.Insert(index, val);
} }
@ -207,9 +207,9 @@ namespace ICSharpCode.XmlEditor
/// Returns an array of <see cref="ICompletionData"/> items. /// Returns an array of <see cref="ICompletionData"/> items.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ICompletionData[] ToArray() public ICompletionItem[] ToArray()
{ {
ICompletionData[] data = new ICompletionData[Count]; XmlCompletionItem[] data = new XmlCompletionItem[Count];
CopyTo(data, 0); CopyTo(data, 0);
return data; return data;
} }
@ -228,7 +228,7 @@ namespace ICSharpCode.XmlEditor
/// </summary> /// </summary>
/// <param name='val'>The <see cref='XmlCompletionData'/> to remove from the <see cref='XmlCompletionDataCollection'/>.</param> /// <param name='val'>The <see cref='XmlCompletionData'/> to remove from the <see cref='XmlCompletionDataCollection'/>.</param>
/// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception> /// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
public void Remove(XmlCompletionData val) public void Remove(XmlCompletionItem val)
{ {
List.Remove(val); List.Remove(val);
} }
@ -256,9 +256,9 @@ namespace ICSharpCode.XmlEditor
/// <summary> /// <summary>
/// Gets the current <see cref='XmlCompletionData'/> in the <seealso cref='XmlCompletionDataCollection'/>. /// Gets the current <see cref='XmlCompletionData'/> in the <seealso cref='XmlCompletionDataCollection'/>.
/// </summary> /// </summary>
public XmlCompletionData Current { public XmlCompletionItem Current {
get { get {
return ((XmlCompletionData)(baseEnumerator.Current)); return ((XmlCompletionItem)(baseEnumerator.Current));
} }
} }
@ -285,5 +285,4 @@ namespace ICSharpCode.XmlEditor
} }
} }
} }
*/
} }

114
src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionDataProvider.cs

@ -5,19 +5,20 @@
// <version>$Revision: 2760 $</version> // <version>$Revision: 2760 $</version>
// </file> // </file>
using ICSharpCode.XmlBinding.Parser; using ICSharpCode.XmlBinding;
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.XmlBinding.Parser;
namespace ICSharpCode.XmlEditor namespace ICSharpCode.XmlEditor
{ {
/*
/// <summary> /// <summary>
/// Provides the autocomplete (intellisense) data for an /// Provides the autocomplete (intellisense) data for an
/// xml document that specifies a known schema. /// xml document that specifies a known schema.
/// </summary> /// </summary>
public class XmlCompletionDataProvider : AbstractCompletionDataProvider public class XmlCompletionDataProvider
{ {
XmlSchemaCompletionDataCollection schemaCompletionDataItems; XmlSchemaCompletionDataCollection schemaCompletionDataItems;
XmlSchemaCompletionData defaultSchemaCompletionData; XmlSchemaCompletionData defaultSchemaCompletionData;
@ -28,77 +29,13 @@ namespace ICSharpCode.XmlEditor
this.schemaCompletionDataItems = schemaCompletionDataItems; this.schemaCompletionDataItems = schemaCompletionDataItems;
this.defaultSchemaCompletionData = defaultSchemaCompletionData; this.defaultSchemaCompletionData = defaultSchemaCompletionData;
this.defaultNamespacePrefix = defaultNamespacePrefix; this.defaultNamespacePrefix = defaultNamespacePrefix;
DefaultIndex = 0;
} }
public override ImageList ImageList { // public override ImageList ImageList {
get { // get {
return XmlCompletionDataImageList.GetImageList(); // return XmlCompletionDataImageList.GetImageList();
} // }
} // }
/// <summary>
/// Overrides the default behaviour and allows special xml
/// characters such as '.' and ':' to be used as completion data.
/// </summary>
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;
}
/// <summary> /// <summary>
/// Finds the schema given the xml element path. /// Finds the schema given the xml element path.
@ -108,7 +45,7 @@ namespace ICSharpCode.XmlEditor
if (path.Elements.Count > 0) { if (path.Elements.Count > 0) {
string namespaceUri = path.Elements[0].Namespace; string namespaceUri = path.Elements[0].Namespace;
if (namespaceUri.Length > 0) { if (namespaceUri.Length > 0) {
return schemaCompletionDataItems[namespaceUri]; return XmlSchemaManager.SchemaCompletionDataItems[namespaceUri];
} else if (defaultSchemaCompletionData != null) { } else if (defaultSchemaCompletionData != null) {
// Use the default schema namespace if none // Use the default schema namespace if none
@ -143,41 +80,46 @@ namespace ICSharpCode.XmlEditor
return schemaCompletionDataItems.GetSchemaFromFileName(fileName); return schemaCompletionDataItems.GetSchemaFromFileName(fileName);
} }
ICompletionData[] GetChildElementCompletionData(XmlElementPath path) public ICompletionItemList GetChildElementCompletionData(XmlElementPath path)
{ {
ICompletionData[] completionData = null; XmlCompletionItemList list = new XmlCompletionItemList();
XmlSchemaCompletionData schema = FindSchema(path); XmlSchemaCompletionData schema = FindSchema(path);
if (schema != null) { 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); XmlSchemaCompletionData schema = FindSchema(path);
if (schema != null) { 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); XmlSchemaCompletionData schema = FindSchema(path);
if (schema != null) { if (schema != null) {
completionData = schema.GetAttributeValueCompletionData(path, name); list.Items.AddRange(schema.GetAttributeValueCompletionData(path, name));
} }
return completionData; list.SortItems();
return list;
} }
} }
*/
} }

30
src/AddIns/BackendBindings/XmlBinding/Src/CodeCompletion/XmlCompletionItemList.cs

@ -0,0 +1,30 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Editor;
using System;
namespace ICSharpCode.XmlBinding
{
/// <summary>
/// Description of XmlCompletionItemList.
/// </summary>
sealed class XmlCompletionItemList : DefaultCompletionItemList
{
public XmlCompletionItemList()
{
}
public override CompletionItemListKeyResult ProcessInput(char key)
{
if (key == ':' || key == '.')
return CompletionItemListKeyResult.NormalKey;
return base.ProcessInput(key);
}
}
}

15
src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml

@ -1,9 +1,14 @@
<Window x:Class="ICSharpCode.XmlBinding.Gui.SelectXmlSchema" <Window x:Class="ICSharpCode.XmlBinding.Gui.Dialogs.SelectXmlSchema"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ICSharpCode.XmlBinding.Gui" Height="300" Width="300" xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
Title="{sd:Localize ICSharpCode.XmlEditor.SelectXmlSchema.DialogTitle}" Height="365" Width="471"
> >
<Grid> <DockPanel>
<StackPanel DockPanel.Dock="Bottom" Height="25" Orientation="Horizontal" HorizontalAlignment="Right">
</Grid> <Button Margin="3,0" Content="{sd:Localize Global.OKButtonText}" />
<Button Margin="3,0" Content="{sd:Localize Global.CancelButtonText}" />
</StackPanel>
<ListBox Margin="5" />
</DockPanel>
</Window> </Window>

4
src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/SelectXmlSchema.xaml.cs

@ -11,15 +11,13 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
namespace ICSharpCode.XmlBinding.Gui namespace ICSharpCode.XmlBinding.Gui.Dialogs
{ {
/// <summary> /// <summary>
/// Interaction logic for SelectXmlSchema.xaml /// Interaction logic for SelectXmlSchema.xaml
/// </summary> /// </summary>
public partial class SelectXmlSchema : Window public partial class SelectXmlSchema : Window
{ {
public SelectXmlSchema() public SelectXmlSchema()
{ {
InitializeComponent(); InitializeComponent();

12
src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlEditorOptionsPanel.xaml

@ -1,7 +1,13 @@
<UserControl x:Class="ICSharpCode.XmlBinding.Gui.Dialogs.XmlEditorOptionsPanel" <UserControl x:Class="ICSharpCode.XmlBinding.Gui.Dialogs.XmlEditorOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid> <StackPanel>
<GroupBox Margin="5" Header="{sd:Localize ICSharpCode.XmlEditor.XmlEditorOptionsPanel.FoldingGroupLabel}">
</Grid> <CheckBox x:Name="chkShowAttributesWhenFolded" Content="{sd:Localize ICSharpCode.XmlEditor.XmlEditorOptionsPanel.ShowAttributesWhenFoldedLabel}" />
</GroupBox>
<GroupBox Margin="5" Header="{sd:Localize ICSharpCode.XmlEditor.XmlEditorOptionsPanel.XmlCompletionGroupLabel}">
<CheckBox x:Name="chkShowSchemaAnnotation" Content="{sd:Localize ICSharpCode.XmlEditor.XmlEditorOptionsPanel.ShowSchemaAnnotationLabel}" />
</GroupBox>
</StackPanel>
</UserControl> </UserControl>

46
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.Collections.Generic;
using System.Text; using System.Text;
using System.Windows; using System.Windows;
@ -10,19 +11,40 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.XmlBinding.Gui.Dialogs namespace ICSharpCode.XmlBinding.Gui.Dialogs
{ {
/// <summary> /// <summary>
/// Interaction logic for XmlEditorOptionsPanel.xaml /// Interaction logic for XmlEditorOptionsPanel.xaml
/// </summary> /// </summary>
public partial class XmlEditorOptionsPanel : UserControl, IOptionPanel
{
public XmlEditorOptionsPanel()
{
InitializeComponent();
}
public partial class XmlEditorOptionsPanel : UserControl public object Owner { get; set; }
{
public XmlEditorOptionsPanel() public object Control {
{ get {
InitializeComponent(); 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;
}
}
} }

37
src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml

@ -1,7 +1,38 @@
<UserControl x:Class="ICSharpCode.XmlBinding.Gui.Dialogs.XmlSchemasPanel" <UserControl x:Class="ICSharpCode.XmlBinding.Gui.Dialogs.XmlSchemasPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid> <StackPanel>
<GroupBox Header="{sd:Localize ICSharpCode.XmlEditor.XmlSchemaPanel.SchemasGroupBoxText}">
</Grid> <DockPanel>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right">
<Button Margin="3,0" Content="{sd:StringParse ${res:Global.AddButtonText}...}" />
<Button Margin="3,0" Content="{sd:Localize Global.RemoveButtonText}" />
</StackPanel>
<ListBox Height="100" Margin="5" />
</DockPanel>
</GroupBox>
<GroupBox Header="{sd:Localize ICSharpCode.XmlEditor.XmlSchemaPanel.FileExtensionsGroupBoxText}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{sd:Localize ICSharpCode.XmlEditor.XmlSchemaPanel.FileExtensionLabelText}" />
<Label Grid.Column="0" Grid.Row="1" Content="{sd:Localize ICSharpCode.XmlEditor.XmlSchemaPanel.SchemaLabelText}" />
<Label Grid.Column="0" Grid.Row="2" Content="{sd:Localize ICSharpCode.XmlEditor.XmlSchemaPanel.NamespacePrefixLabelText}" />
<ComboBox Grid.Column="1" Grid.Row="0" />
<DockPanel Grid.Column="1" Grid.Row="1">
<Button DockPanel.Dock="Right" Margin="3,0,0,0" Padding="5,0" Content="..." />
<TextBox />
</DockPanel>
<TextBox Grid.Column="1" Grid.Row="2" />
</Grid>
</GroupBox>
</StackPanel>
</UserControl> </UserControl>

45
src/AddIns/BackendBindings/XmlBinding/Src/Gui/Dialogs/XmlSchemasPanel.xaml.cs

@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Drawing;
using System.Text; using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -11,18 +13,37 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.XmlEditor;
namespace ICSharpCode.XmlBinding.Gui.Dialogs namespace ICSharpCode.XmlBinding.Gui.Dialogs
{ {
/// <summary> /// <summary>
/// Interaction logic for XmlSchemasPanel.xaml /// Interaction logic for XmlSchemasPanel.xaml
/// </summary> /// </summary>
public partial class XmlSchemasPanel : UserControl, IOptionPanel
public partial class XmlSchemasPanel : UserControl {
{ public XmlSchemasPanel()
public XmlSchemasPanel() {
{ InitializeComponent();
InitializeComponent(); }
}
public object Owner { get; set; }
}
public object Control {
get {
return this;
}
}
public void LoadOptions()
{
}
public bool SaveOptions()
{
return false;
}
}
} }

6
src/AddIns/BackendBindings/XmlBinding/Src/Gui/XmlDisplayBinding.cs

@ -57,9 +57,7 @@ namespace ICSharpCode.XmlBinding.Gui
/// Gets the known xml file extensions. /// Gets the known xml file extensions.
/// </summary> /// </summary>
public static string[] GetXmlFileExtensions() public static string[] GetXmlFileExtensions()
{ {
return new string[] { ".xml" };
foreach (ParserDescriptor parser in AddInTree.BuildItems<ParserDescriptor>("/Workspace/Parser", null, false)) { foreach (ParserDescriptor parser in AddInTree.BuildItems<ParserDescriptor>("/Workspace/Parser", null, false)) {
if (parser.Codon.Id == "XmlFoldingParser") { if (parser.Codon.Id == "XmlFoldingParser") {
return parser.Supportedextensions; return parser.Supportedextensions;
@ -73,7 +71,7 @@ namespace ICSharpCode.XmlBinding.Gui
// return strategy.Extensions; // return strategy.Extensions;
// } // }
return new string[0]; return new string[] { ".xml", ".addin" };
} }
public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent) public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)

173
src/AddIns/BackendBindings/XmlBinding/Src/Parser/QualifiedNameCollection.cs

@ -17,15 +17,12 @@ namespace ICSharpCode.XmlBinding.Parser
/// A collection that stores <see cref='QualifiedName'/> objects. /// A collection that stores <see cref='QualifiedName'/> objects.
/// </summary> /// </summary>
[Serializable()] [Serializable()]
public class QualifiedNameCollection : Collection<QualifiedName> { public class QualifiedNameCollection : Collection<QualifiedName> {
List<QualifiedName> list;
/// <summary> /// <summary>
/// Initializes a new instance of <see cref='QualifiedNameCollection'/>. /// Initializes a new instance of <see cref='QualifiedNameCollection'/>.
/// </summary> /// </summary>
public QualifiedNameCollection() public QualifiedNameCollection()
{ {
this.list = new List<QualifiedName>();
} }
/// <summary> /// <summary>
@ -50,30 +47,14 @@ namespace ICSharpCode.XmlBinding.Parser
this.AddRange(val); this.AddRange(val);
} }
/// <summary> public override string ToString()
/// Represents the entry at the specified index of the <see cref='QualifiedName'/>.
/// </summary>
/// <param name='index'>The zero-based index of the entry to locate in the collection.</param>
/// <value>The entry at the specified index of the collection.</value>
/// <exception cref='ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
public QualifiedName this[int index] {
get {
return ((QualifiedName)(this.list[index]));
}
set {
this.list[index] = value;
}
}
/// <summary>
/// Adds a <see cref='QualifiedName'/> with the specified value to the
/// <see cref='QualifiedNameCollection'/>.
/// </summary>
/// <param name='val'>The <see cref='QualifiedName'/> to add.</param>
/// <seealso cref='QualifiedNameCollection.AddRange'/>
public void Add(QualifiedName val)
{ {
this.list.Add(val); string text = "";
for (int i = 0; i < this.Count; i++)
text += (i == 0) ? this[i] + "" : " > " + this[i];
return text;
} }
/// <summary> /// <summary>
@ -85,9 +66,8 @@ namespace ICSharpCode.XmlBinding.Parser
/// <seealso cref='QualifiedNameCollection.Add'/> /// <seealso cref='QualifiedNameCollection.Add'/>
public void AddRange(QualifiedName[] val) 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]); this.Add(val[i]);
}
} }
/// <summary> /// <summary>
@ -100,90 +80,7 @@ namespace ICSharpCode.XmlBinding.Parser
public void AddRange(QualifiedNameCollection val) public void AddRange(QualifiedNameCollection val)
{ {
for (int i = 0; i < val.Count; i++) for (int i = 0; i < val.Count; i++)
{
this.Add(val[i]); this.Add(val[i]);
}
}
/// <summary>
/// Gets a value indicating whether the
/// <see cref='QualifiedNameCollection'/> contains the specified <see cref='QualifiedName'/>.
/// </summary>
/// <param name='val'>The <see cref='QualifiedName'/> to locate.</param>
/// <returns>
/// <see langword='true'/> if the <see cref='QualifiedName'/> is contained in the collection;
/// otherwise, <see langword='false'/>.
/// </returns>
/// <seealso cref='QualifiedNameCollection.IndexOf'/>
public bool Contains(QualifiedName val)
{
return this.list.Contains(val);
}
/// <summary>
/// Copies the <see cref='QualifiedNameCollection'/> values to a one-dimensional <see cref='Array'/> instance at the
/// specified index.
/// </summary>
/// <param name='array'>The one-dimensional <see cref='Array'/> that is the destination of the values copied from <see cref='QualifiedNameCollection'/>.</param>
/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
/// <exception cref='ArgumentException'>
/// <para><paramref name='array'/> is multidimensional.</para>
/// <para>-or-</para>
/// <para>The number of elements in the <see cref='QualifiedNameCollection'/> is greater than
/// the available space between <paramref name='arrayIndex'/> and the end of
/// <paramref name='array'/>.</para>
/// </exception>
/// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
/// <exception cref='ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
/// <seealso cref='Array'/>
public void CopyTo(QualifiedName[] array, int index)
{
this.list.CopyTo(array, index);
}
/// <summary>
/// Returns the index of a <see cref='QualifiedName'/> in
/// the <see cref='QualifiedNameCollection'/>.
/// </summary>
/// <param name='val'>The <see cref='QualifiedName'/> to locate.</param>
/// <returns>
/// The index of the <see cref='QualifiedName'/> of <paramref name='val'/> in the
/// <see cref='QualifiedNameCollection'/>, if found; otherwise, -1.
/// </returns>
/// <seealso cref='QualifiedNameCollection.Contains'/>
public int IndexOf(QualifiedName val)
{
return this.list.IndexOf(val);
}
/// <summary>
/// Inserts a <see cref='QualifiedName'/> into the <see cref='QualifiedNameCollection'/> at the specified index.
/// </summary>
/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
/// <param name='val'>The <see cref='QualifiedName'/> to insert.</param>
/// <seealso cref='QualifiedNameCollection.Add'/>
public void Insert(int index, QualifiedName val)
{
this.list.Insert(index, val);
}
/// <summary>
/// Returns an enumerator that can iterate through the <see cref='QualifiedNameCollection'/>.
/// </summary>
/// <seealso cref='IEnumerator'/>
public new QualifiedNameEnumerator GetEnumerator()
{
return new QualifiedNameEnumerator(this);
}
/// <summary>
/// Removes a specific <see cref='QualifiedName'/> from the <see cref='QualifiedNameCollection'/>.
/// </summary>
/// <param name='val'>The <see cref='QualifiedName'/> to remove from the <see cref='QualifiedNameCollection'/>.</param>
/// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
public void Remove(QualifiedName val)
{
this.list.Remove(val);
} }
/// <summary> /// <summary>
@ -218,57 +115,5 @@ namespace ICSharpCode.XmlBinding.Parser
return String.Empty; return String.Empty;
} }
} }
/// <summary>
/// Enumerator that can iterate through a QualifiedNameCollection.
/// </summary>
/// <seealso cref='IEnumerator'/>
/// <seealso cref='QualifiedNameCollection'/>
/// <seealso cref='QualifiedName'/>
public class QualifiedNameEnumerator : IEnumerator
{
IEnumerator baseEnumerator;
IEnumerable temp;
/// <summary>
/// Initializes a new instance of <see cref='QualifiedNameEnumerator'/>.
/// </summary>
public QualifiedNameEnumerator(QualifiedNameCollection mappings)
{
this.temp = ((IEnumerable)(mappings));
this.baseEnumerator = temp.GetEnumerator();
}
/// <summary>
/// Gets the current <see cref='QualifiedName'/> in the <seealso cref='QualifiedNameCollection'/>.
/// </summary>
public QualifiedName Current {
get {
return ((QualifiedName)(baseEnumerator.Current));
}
}
object IEnumerator.Current {
get {
return baseEnumerator.Current;
}
}
/// <summary>
/// Advances the enumerator to the next <see cref='QualifiedName'/> of the <see cref='QualifiedNameCollection'/>.
/// </summary>
public bool MoveNext()
{
return baseEnumerator.MoveNext();
}
/// <summary>
/// Sets the enumerator to its initial position, which is before the first element in the <see cref='QualifiedNameCollection'/>.
/// </summary>
public void Reset()
{
baseEnumerator.Reset();
}
}
} }
} }

2
src/AddIns/BackendBindings/XmlBinding/Src/Parser/XmlParser.cs

@ -100,7 +100,7 @@ namespace ICSharpCode.XmlBinding.Parser
QualifiedNameCollection namespaces = new QualifiedNameCollection(); QualifiedNameCollection namespaces = new QualifiedNameCollection();
return GetActiveElementStartPathAtIndex(xml, index, namespaces); return GetActiveElementStartPathAtIndex(xml, index, namespaces);
} }
/// <summary> /// <summary>
/// Gets the parent element path based on the index position. /// Gets the parent element path based on the index position.
/// </summary> /// </summary>

36
src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionData.cs

File diff suppressed because one or more lines are too long

16
src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaCompletionDataCollection.cs

@ -5,13 +5,14 @@
// <version>$Revision: 1965 $</version> // <version>$Revision: 1965 $</version>
// </file> // </file>
using ICSharpCode.XmlBinding;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.XmlEditor namespace ICSharpCode.XmlEditor
{ {
/*
/// <summary> /// <summary>
/// A collection that stores <see cref='XmlSchemaCompletionData'/> objects. /// A collection that stores <see cref='XmlSchemaCompletionData'/> objects.
/// </summary> /// </summary>
@ -62,16 +63,18 @@ namespace ICSharpCode.XmlEditor
} }
} }
public ICompletionData[] GetNamespaceCompletionData() public ICompletionItemList GetNamespaceCompletionData()
{ {
List<ICompletionData> completionItems = new List<ICompletionData>(); XmlCompletionItemList list = new XmlCompletionItemList();
foreach (XmlSchemaCompletionData schema in this) { foreach (XmlSchemaCompletionData schema in this) {
XmlCompletionData completionData = new XmlCompletionData(schema.NamespaceUri, XmlCompletionData.DataType.NamespaceUri); XmlCompletionItem completionData = new XmlCompletionItem(schema.NamespaceUri, XmlCompletionItem.DataType.NamespaceUri);
completionItems.Add(completionData); list.Items.Add(completionData);
} }
return completionItems.ToArray(); list.SortItems();
return list;
} }
/// <summary> /// <summary>
@ -288,5 +291,4 @@ namespace ICSharpCode.XmlEditor
return matchedItem; return matchedItem;
} }
} }
*/
} }

15
src/AddIns/BackendBindings/XmlBinding/Src/Src/XmlSchemaManager.cs

@ -13,7 +13,7 @@ using ICSharpCode.Core;
namespace ICSharpCode.XmlEditor namespace ICSharpCode.XmlEditor
{ {
/*
/// <summary> /// <summary>
/// Keeps track of all the schemas that the Xml Editor is aware /// Keeps track of all the schemas that the Xml Editor is aware
/// of. /// of.
@ -28,10 +28,6 @@ namespace ICSharpCode.XmlEditor
public static event EventHandler UserSchemaAdded; public static event EventHandler UserSchemaAdded;
public static event EventHandler UserSchemaRemoved; public static event EventHandler UserSchemaRemoved;
XmlSchemaManager()
{
}
/// <summary> /// <summary>
/// Determines whether the specified namespace is actually the W3C namespace for /// Determines whether the specified namespace is actually the W3C namespace for
@ -50,7 +46,7 @@ namespace ICSharpCode.XmlEditor
if (schemas == null) { if (schemas == null) {
schemas = new XmlSchemaCompletionDataCollection(); schemas = new XmlSchemaCompletionDataCollection();
manager = new XmlSchemaManager(); manager = new XmlSchemaManager();
manager.ReadSchemas(); ReadSchemas();
} }
return schemas; return schemas;
@ -132,7 +128,7 @@ namespace ICSharpCode.XmlEditor
/// <summary> /// <summary>
/// Reads the system and user added schemas. /// Reads the system and user added schemas.
/// </summary> /// </summary>
void ReadSchemas() static void ReadSchemas()
{ {
// MSBuild schemas are in framework directory: // MSBuild schemas are in framework directory:
ReadSchemas(RuntimeEnvironment.GetRuntimeDirectory(), true); ReadSchemas(RuntimeEnvironment.GetRuntimeDirectory(), true);
@ -143,7 +139,7 @@ namespace ICSharpCode.XmlEditor
/// <summary> /// <summary>
/// Reads all .xsd files in the specified folder. /// Reads all .xsd files in the specified folder.
/// </summary> /// </summary>
void ReadSchemas(string folder, bool readOnly) static void ReadSchemas(string folder, bool readOnly)
{ {
if (Directory.Exists(folder)) { if (Directory.Exists(folder)) {
foreach (string fileName in Directory.GetFiles(folder, "*.xsd")) { foreach (string fileName in Directory.GetFiles(folder, "*.xsd")) {
@ -158,7 +154,7 @@ namespace ICSharpCode.XmlEditor
/// <remarks> /// <remarks>
/// If the schema namespace exists in the collection it is not added. /// If the schema namespace exists in the collection it is not added.
/// </remarks> /// </remarks>
void ReadSchema(string fileName, bool readOnly) static void ReadSchema(string fileName, bool readOnly)
{ {
try { try {
string baseUri = XmlSchemaCompletionData.GetUri(fileName); string baseUri = XmlSchemaCompletionData.GetUri(fileName);
@ -219,5 +215,4 @@ namespace ICSharpCode.XmlEditor
} }
} }
} }
*/
} }

18
src/AddIns/BackendBindings/XmlBinding/XmlBinding.addin

@ -5,11 +5,7 @@
addInManagerHidden = "preinstalled"> addInManagerHidden = "preinstalled">
<Runtime> <Runtime>
<Import assembly = "XmlBinding.dll"/> <Import assembly = "XmlBinding.dll">
</Runtime>
<Runtime>
<Import assembly = "XmlEditor.dll">
<ConditionEvaluator name = "StylesheetAssigned" class = "ICSharpCode.XmlEditor.StylesheetAssignedCondition"/> <ConditionEvaluator name = "StylesheetAssigned" class = "ICSharpCode.XmlEditor.StylesheetAssignedCondition"/>
</Import> </Import>
<Import assembly = ":ICSharpCode.SharpDevelop"/> <Import assembly = ":ICSharpCode.SharpDevelop"/>
@ -19,6 +15,14 @@
<Class id ="XmlFormatter" class = "ICSharpCode.XmlBinding.XmlFormattingStrategy"/> <Class id ="XmlFormatter" class = "ICSharpCode.XmlBinding.XmlFormattingStrategy"/>
</Path> </Path>
<Path name = "/AddIns/DefaultTextEditor/CodeCompletion">
<CodeCompletionBinding
id = "Xml"
extensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco"
class = "ICSharpCode.XmlBinding.XmlCodeCompletionBinding"
/>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings"> <Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "XmlTreeView" <DisplayBinding id = "XmlTreeView"
type = "Secondary" type = "Secondary"
@ -153,12 +157,12 @@
<OptionPanel id = "XmlSchemasPanel" <OptionPanel id = "XmlSchemasPanel"
insertafter = "Markers" insertafter = "Markers"
label = "${res:ICSharpCode.XmlEditor.XmlSchemasPanel.Title}" label = "${res:ICSharpCode.XmlEditor.XmlSchemasPanel.Title}"
class = "ICSharpCode.XmlEditor.XmlSchemasPanel" /> class = "ICSharpCode.XmlBinding.Gui.Dialogs.XmlSchemasPanel" />
<OptionPanel id = "XmlEditorOptionsPanel" <OptionPanel id = "XmlEditorOptionsPanel"
insertafter = "Markers" insertafter = "Markers"
insertbefore = "XmlSchemasPanel" insertbefore = "XmlSchemasPanel"
label = "${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.Title}" label = "${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.Title}"
class = "ICSharpCode.XmlEditor.XmlEditorOptionsPanel" /> class = "ICSharpCode.XmlBinding.Gui.Dialogs.XmlEditorOptionsPanel" />
</Path> </Path>
<Path path = "/AddIns/XmlEditor/EditActions"> <Path path = "/AddIns/XmlEditor/EditActions">

32
src/AddIns/BackendBindings/XmlBinding/XmlBinding.csproj

@ -69,6 +69,8 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<Compile Include="Configuration\AssemblyInfo.cs" /> <Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\CodeCompletion\XmlCodeCompletionBinding.cs" />
<Compile Include="Src\CodeCompletion\XmlCompletionItemList.cs" />
<Compile Include="Src\Gui\Dialogs\SelectXmlSchema.xaml.cs"> <Compile Include="Src\Gui\Dialogs\SelectXmlSchema.xaml.cs">
<DependentUpon>SelectXmlSchema.xaml</DependentUpon> <DependentUpon>SelectXmlSchema.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
@ -107,16 +109,19 @@
<Compile Include="Src\Commands\RemoveXPathHighlightingCommand.cs" /> <Compile Include="Src\Commands\RemoveXPathHighlightingCommand.cs" />
<Compile Include="Src\Commands\RunXslTransformCommand.cs" /> <Compile Include="Src\Commands\RunXslTransformCommand.cs" />
<Compile Include="Src\Commands\ValidateXmlCommand.cs" /> <Compile Include="Src\Commands\ValidateXmlCommand.cs" />
<Compile Include="Src\Gui\AddXmlNodeDialog.cs" /> <Compile Include="Src\Gui\AddXmlNodeDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\GoToSchemaDefinitionEditAction.cs" /> <Compile Include="Src\Gui\GoToSchemaDefinitionEditAction.cs" />
<Compile Include="Src\Gui\IAddXmlNodeDialog.cs" /> <Compile Include="Src\Gui\IAddXmlNodeDialog.cs" />
<Compile Include="Src\Gui\IXmlTreeView.cs" /> <Compile Include="Src\Gui\IXmlTreeView.cs" />
<Compile Include="Src\Gui\SelectXmlSchemaForm.cs"> <Compile Include="Src\Gui\SelectXmlSchemaForm.cs">
<SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Src\Gui\XmlDisplayBinding.cs" /> <Compile Include="Src\Gui\XmlDisplayBinding.cs" />
<Compile Include="Src\Gui\XmlTreeView.cs" /> <Compile Include="Src\Gui\XmlTreeView.cs" />
<Compile Include="Src\Gui\XPathQueryControl.cs" /> <Compile Include="Src\Gui\XPathQueryControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Gui\XPathQueryPad.cs"> <Compile Include="Src\Gui\XPathQueryPad.cs">
</Compile> </Compile>
<Compile Include="Src\Gui\XslOutputView.cs" /> <Compile Include="Src\Gui\XslOutputView.cs" />
@ -131,7 +136,6 @@
<Compile Include="Src\Src\XmlCommentTreeNode.cs" /> <Compile Include="Src\Src\XmlCommentTreeNode.cs" />
<Compile Include="Src\Src\XmlEditorAddInOptions.cs" /> <Compile Include="Src\Src\XmlEditorAddInOptions.cs" />
<Compile Include="Src\Src\XmlEditorOptionsPanel.cs"> <Compile Include="Src\Src\XmlEditorOptionsPanel.cs">
<SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Src\Src\XmlElementTreeNode.cs" /> <Compile Include="Src\Src\XmlElementTreeNode.cs" />
<Compile Include="Src\Src\XmlSchemaAssociation.cs" /> <Compile Include="Src\Src\XmlSchemaAssociation.cs" />
@ -146,7 +150,9 @@
<Compile Include="Src\Src\XmlTextTreeNode.cs" /> <Compile Include="Src\Src\XmlTextTreeNode.cs" />
<Compile Include="Src\Src\XmlTreeEditor.cs"> <Compile Include="Src\Src\XmlTreeEditor.cs">
</Compile> </Compile>
<Compile Include="Src\Src\XmlTreeViewContainerControl.cs" /> <Compile Include="Src\Src\XmlTreeViewContainerControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Src\XmlTreeViewControl.cs" /> <Compile Include="Src\Src\XmlTreeViewControl.cs" />
<Compile Include="Src\Src\XPathNodeMatch.cs" /> <Compile Include="Src\Src\XPathNodeMatch.cs" />
<Compile Include="Src\Src\XPathNodeTextMarker.cs" /> <Compile Include="Src\Src\XPathNodeTextMarker.cs" />
@ -155,23 +161,11 @@
<Compile Include="Src\Xml\EncodedStringWriter.cs" /> <Compile Include="Src\Xml\EncodedStringWriter.cs" />
<Compile Include="Src\Xml\XmlEncoder.cs" /> <Compile Include="Src\Xml\XmlEncoder.cs" />
<Compile Include="Src\Xml\XmlNamespace.cs" /> <Compile Include="Src\Xml\XmlNamespace.cs" />
<EmbeddedResource Include="Resources\SelectXmlSchema.xfrm" />
<EmbeddedResource Include="Resources\XmlCommentTreeNodeIcon.png" /> <EmbeddedResource Include="Resources\XmlCommentTreeNodeIcon.png" />
<EmbeddedResource Include="Resources\XmlEditorOptionsPanel.xfrm" />
<EmbeddedResource Include="Resources\XmlElementTreeNodeIcon.png" /> <EmbeddedResource Include="Resources\XmlElementTreeNodeIcon.png" />
<EmbeddedResource Include="Resources\XmlSchemasPanel.xfrm" />
<EmbeddedResource Include="Resources\XmlTextTreeNodeIcon.png" /> <EmbeddedResource Include="Resources\XmlTextTreeNodeIcon.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Resources" />
<Folder Include="Src" />
<Folder Include="Src\CodeCompletion" />
<Folder Include="Src\Commands" />
<Folder Include="Src\Gui" />
<Folder Include="Src\Gui\Dialogs" />
<Folder Include="Src\Xml" />
<Folder Include="Src\Parser" />
<Folder Include="Src\Src" />
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> <ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> <Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name> <Name>ICSharpCode.SharpDevelop</Name>
@ -180,6 +174,10 @@
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> <Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name> <Name>ICSharpCode.Core</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj"> <ProjectReference Include="..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project> <Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name> <Name>ICSharpCode.Core.WinForms</Name>

53
src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin

@ -8,37 +8,37 @@
<Identity name = "ICSharpCode.XmlEditor"/> <Identity name = "ICSharpCode.XmlEditor"/>
</Manifest> </Manifest>
<Runtime> <!-- <Runtime>
<Import assembly = "XmlEditor.dll"> <Import assembly = "XmlEditor.dll">
<ConditionEvaluator name = "StylesheetAssigned" class = "ICSharpCode.XmlEditor.StylesheetAssignedCondition"/> <ConditionEvaluator name = "StylesheetAssigned" class = "ICSharpCode.XmlEditor.StylesheetAssignedCondition"/>
</Import> </Import>
<Import assembly = ":ICSharpCode.SharpDevelop"/> <Import assembly = ":ICSharpCode.SharpDevelop"/>
</Runtime> </Runtime>-->
<!-- Xml Editor View --> <!-- Xml Editor View -->
<Path name = "/SharpDevelop/Workbench/DisplayBindings"> <!-- <Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "XmlEditor" <DisplayBinding id = "XmlEditor"
insertbefore = "Text" insertbefore = "Text"
title = "${res:Gui.ProjectBrowser.OpenWith.Bindings.XmlEditor}" title = "${res:Gui.ProjectBrowser.OpenWith.Bindings.XmlEditor}"
class = "ICSharpCode.XmlEditor.XmlDisplayBinding"/> class = "ICSharpCode.XmlEditor.XmlDisplayBinding"/>
</Path> </Path>-->
<!-- Xml parser used to initiate the folding update --> <!-- Xml parser used to initiate the folding update -->
<Path name = "/Workspace/Parser"> <!-- <Path name = "/Workspace/Parser">
<Parser id = "XmlFoldingParser" <Parser id = "XmlFoldingParser"
supportedextensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco" supportedextensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco"
class = "ICSharpCode.XmlEditor.Parser"/> class = "ICSharpCode.XmlEditor.Parser"/>
</Path> </Path>-->
<!-- Extra project browser icons --> <!-- Extra project browser icons -->
<Path name = "/Workspace/Icons"> <!-- <Path name = "/Workspace/Icons">
<Icon id = "ExtraXmlFileIcon" <Icon id = "ExtraXmlFileIcon"
extensions = ".manifest;.config;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco" extensions = ".manifest;.config;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco"
resource = "FileIcons.XmlIcon" /> resource = "FileIcons.XmlIcon" />
</Path> </Path>-->
<!-- Xml file filter --> <!-- Xml file filter -->
<Path name = "/SharpDevelop/Workbench/FileFilter"> <!-- <Path name = "/SharpDevelop/Workbench/FileFilter">
<FileFilter id = "Xml" <FileFilter id = "Xml"
insertbefore="AllFiles" insertbefore="AllFiles"
name = "${res:SharpDevelop.FileFilter.XmlFiles}" name = "${res:SharpDevelop.FileFilter.XmlFiles}"
@ -47,10 +47,10 @@
insertbefore="AllFiles" insertbefore="AllFiles"
name = "${res:SharpDevelop.FileFilter.XslFiles} (*.xsl;*.xslt)" name = "${res:SharpDevelop.FileFilter.XslFiles} (*.xsl;*.xslt)"
extensions = "*.xsl;*.xslt"/> extensions = "*.xsl;*.xslt"/>
</Path> </Path>-->
<!-- XML menu --> <!-- XML menu -->
<Path name = "/SharpDevelop/Workbench/MainMenu"> <!--<Path name = "/SharpDevelop/Workbench/MainMenu">
<Condition name = "WindowActive" activewindow="ICSharpCode.XmlEditor.XmlView"> <Condition name = "WindowActive" activewindow="ICSharpCode.XmlEditor.XmlView">
<MenuItem id = "Xml" insertafter="View" insertbefore="Tools" label="&amp;XML" type = "Menu"> <MenuItem id = "Xml" insertafter="View" insertbefore="Tools" label="&amp;XML" type = "Menu">
<MenuItem id = "CreateSchema" <MenuItem id = "CreateSchema"
@ -69,7 +69,6 @@
label="${res:ICSharpCode.XmlEditor.AssignXSLT}" label="${res:ICSharpCode.XmlEditor.AssignXSLT}"
class="ICSharpCode.XmlEditor.AssignStylesheetCommand"/> class="ICSharpCode.XmlEditor.AssignStylesheetCommand"/>
<ComplexCondition action="Disable"> <ComplexCondition action="Disable">
<!-- evaluate StylesheetAssigned only when XmlView is active - important for lazy loading! -->
<And> <And>
<Condition name = "WindowActive" activewindow = "ICSharpCode.XmlEditor.XmlView"/> <Condition name = "WindowActive" activewindow = "ICSharpCode.XmlEditor.XmlView"/>
<Condition name = "StylesheetAssigned" action="Disable"/> <Condition name = "StylesheetAssigned" action="Disable"/>
@ -89,10 +88,10 @@
class = "ICSharpCode.XmlEditor.FormatXmlCommand" /> class = "ICSharpCode.XmlEditor.FormatXmlCommand" />
</MenuItem> </MenuItem>
</Condition> </Condition>
</Path> </Path>-->
<!-- Right click menu --> <!-- Right click menu -->
<Path name = "/SharpDevelop/ViewContent/XmlEditor/ContextMenu"> <!--<Path name = "/SharpDevelop/ViewContent/XmlEditor/ContextMenu">
<MenuItem id = "Cut" <MenuItem id = "Cut"
label = "${res:XML.TextAreaContextMenu.Cut}" label = "${res:XML.TextAreaContextMenu.Cut}"
icon = "Icons.16x16.CutIcon" icon = "Icons.16x16.CutIcon"
@ -143,10 +142,10 @@
label = "${res:XML.TextAreaContextMenu.BufferOptions}" label = "${res:XML.TextAreaContextMenu.BufferOptions}"
icon = "Icons.16x16.PropertiesIcon" icon = "Icons.16x16.PropertiesIcon"
class ="ICSharpCode.SharpDevelop.DefaultEditor.Commands.ShowBufferOptions"/> class ="ICSharpCode.SharpDevelop.DefaultEditor.Commands.ShowBufferOptions"/>
</Path> </Path>-->
<!-- Options panel --> <!-- Options panel -->
<Path path = "/SharpDevelop/Dialogs/OptionsDialog/TextEditorOptions"> <!-- <Path path = "/SharpDevelop/Dialogs/OptionsDialog/TextEditorOptions">
<OptionPanel id = "XmlSchemasPanel" <OptionPanel id = "XmlSchemasPanel"
insertafter = "Markers" insertafter = "Markers"
label = "${res:ICSharpCode.XmlEditor.XmlSchemasPanel.Title}" label = "${res:ICSharpCode.XmlEditor.XmlSchemasPanel.Title}"
@ -156,15 +155,15 @@
insertbefore = "XmlSchemasPanel" insertbefore = "XmlSchemasPanel"
label = "${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.Title}" label = "${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.Title}"
class = "ICSharpCode.XmlEditor.XmlEditorOptionsPanel" /> class = "ICSharpCode.XmlEditor.XmlEditorOptionsPanel" />
</Path> </Path>-->
<Path path = "/AddIns/XmlEditor/EditActions"> <!-- <Path path = "/AddIns/XmlEditor/EditActions">
<EditAction id = "XmlCompletionPopup" class = "ICSharpCode.XmlEditor.CodeCompletionPopupCommand" keys = "Control|Space"/> <EditAction id = "XmlCompletionPopup" class = "ICSharpCode.XmlEditor.CodeCompletionPopupCommand" keys = "Control|Space"/>
<EditAction id = "GoToDefinition" class = "ICSharpCode.XmlEditor.GoToSchemaDefinitionEditAction" keys = "Control|Enter"/> <EditAction id = "GoToDefinition" class = "ICSharpCode.XmlEditor.GoToSchemaDefinitionEditAction" keys = "Control|Enter"/>
</Path> </Path>-->
<!-- XPath Query pad --> <!-- XPath Query pad -->
<Path name = "/SharpDevelop/Workbench/Pads"> <!-- <Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "XPathQueryPad" <Pad id = "XPathQueryPad"
category = "Tools" category = "Tools"
icon = "PadIcons.XPathQuery" icon = "PadIcons.XPathQuery"
@ -172,20 +171,20 @@
insertafter = "UnitTestingPad" insertafter = "UnitTestingPad"
class = "ICSharpCode.XmlEditor.XPathQueryPad" class = "ICSharpCode.XmlEditor.XPathQueryPad"
defaultPosition = "Bottom, Hidden" /> defaultPosition = "Bottom, Hidden" />
</Path> </Path>-->
<!-- Menu options to turn off XPath Query result highlighting --> <!-- Menu options to turn off XPath Query result highlighting -->
<Path name = "/SharpDevelop/Workbench/MainMenu/Edit/Format"> <!-- <Path name = "/SharpDevelop/Workbench/MainMenu/Edit/Format">
<Condition name = "WindowActive" activewindow="ICSharpCode.XmlEditor.XmlView"> <Condition name = "WindowActive" activewindow="ICSharpCode.XmlEditor.XmlView">
<MenuItem id = "RemoveXPathHighlighting" <MenuItem id = "RemoveXPathHighlighting"
insertafter = "ShowCodeCoverage" insertafter = "ShowCodeCoverage"
label = "${res:ICSharpCode.XmlEditor.HideXPathResults}" label = "${res:ICSharpCode.XmlEditor.HideXPathResults}"
class = "ICSharpCode.XmlEditor.RemoveXPathHighlightingCommand"/> class = "ICSharpCode.XmlEditor.RemoveXPathHighlightingCommand"/>
</Condition> </Condition>
</Path> </Path>-->
<!-- XML Tree context menu options --> <!-- XML Tree context menu options -->
<Path name = "/AddIns/XmlEditor/XmlTree/AttributesGrid/ContextMenu"> <!-- <Path name = "/AddIns/XmlEditor/XmlTree/AttributesGrid/ContextMenu">
<Condition name = "Ownerstate" ownerstate="ElementSelected" action="Disable"> <Condition name = "Ownerstate" ownerstate="ElementSelected" action="Disable">
<MenuItem id = "AddAttribute" <MenuItem id = "AddAttribute"
label = "${res:ICSharpCode.XmlEditor.XmlTreeView.AddAttributeMenuLabel}" label = "${res:ICSharpCode.XmlEditor.XmlTreeView.AddAttributeMenuLabel}"
@ -197,9 +196,9 @@
icon = "Icons.16x16.DeleteIcon" icon = "Icons.16x16.DeleteIcon"
class = "ICSharpCode.XmlEditor.RemoveAttributeCommand"/> class = "ICSharpCode.XmlEditor.RemoveAttributeCommand"/>
</Condition> </Condition>
</Path> </Path>-->
<Path name = "/AddIns/XmlEditor/XmlTree/ContextMenu"> <!--<Path name = "/AddIns/XmlEditor/XmlTree/ContextMenu">
<MenuItem id = "Cut" <MenuItem id = "Cut"
label = "${res:XML.TextAreaContextMenu.Cut}" label = "${res:XML.TextAreaContextMenu.Cut}"
icon = "Icons.16x16.CutIcon" icon = "Icons.16x16.CutIcon"
@ -285,5 +284,5 @@
label = "${res:ICSharpCode.XmlEditor.XmlTreeView.AddChildCommentMenuLabel}" label = "${res:ICSharpCode.XmlEditor.XmlTreeView.AddChildCommentMenuLabel}"
class = "ICSharpCode.XmlEditor.AddChildCommentCommand"/> class = "ICSharpCode.XmlEditor.AddChildCommentCommand"/>
</Condition> </Condition>
</Path> </Path>-->
</AddIn> </AddIn>

18
src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs

@ -27,4 +27,22 @@ namespace ICSharpCode.Core.Presentation
return ResourceService.GetString(key); return ResourceService.GetString(key);
} }
} }
/// <summary>
/// Markup extension that works like StringParser.Parse
/// </summary>
public class StringParseExtension : MarkupExtension
{
protected string text;
public StringParseExtension(string text)
{
this.text = text;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return StringParser.Parse(text);
}
}
} }

Loading…
Cancel
Save