Browse Source
- implemented basic CC git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/XmlEditor@4122 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
24 changed files with 420 additions and 634 deletions
@ -1,38 +0,0 @@
@@ -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> |
||||
@ -1,45 +0,0 @@
@@ -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> |
||||
@ -1,110 +0,0 @@
@@ -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> |
||||
@ -0,0 +1,87 @@
@@ -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; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,30 @@
@@ -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); |
||||
} |
||||
} |
||||
} |
||||
@ -1,9 +1,14 @@
@@ -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: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> |
||||
|
||||
</Grid> |
||||
<DockPanel> |
||||
<StackPanel DockPanel.Dock="Bottom" Height="25" Orientation="Horizontal" HorizontalAlignment="Right"> |
||||
<Button Margin="3,0" Content="{sd:Localize Global.OKButtonText}" /> |
||||
<Button Margin="3,0" Content="{sd:Localize Global.CancelButtonText}" /> |
||||
</StackPanel> |
||||
<ListBox Margin="5" /> |
||||
</DockPanel> |
||||
</Window> |
||||
@ -1,7 +1,13 @@
@@ -1,7 +1,13 @@
|
||||
<UserControl x:Class="ICSharpCode.XmlBinding.Gui.Dialogs.XmlEditorOptionsPanel" |
||||
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"> |
||||
<Grid> |
||||
|
||||
</Grid> |
||||
<StackPanel> |
||||
<GroupBox Margin="5" Header="{sd:Localize ICSharpCode.XmlEditor.XmlEditorOptionsPanel.FoldingGroupLabel}"> |
||||
<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> |
||||
@ -1,7 +1,38 @@
@@ -1,7 +1,38 @@
|
||||
<UserControl x:Class="ICSharpCode.XmlBinding.Gui.Dialogs.XmlSchemasPanel" |
||||
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"> |
||||
<Grid> |
||||
|
||||
</Grid> |
||||
<StackPanel> |
||||
<GroupBox Header="{sd:Localize ICSharpCode.XmlEditor.XmlSchemaPanel.SchemasGroupBoxText}"> |
||||
<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> |
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue