<AddIn
	name="XML Editor"
	author="Matt Ward"
	copyright="prj:///doc/copyright.txt"
	description="Adds XML completion and formatting support"
	addInManagerHidden="preinstalled">
	
	<Runtime>
		<Import assembly="XmlEditor.dll">
			<ConditionEvaluator name="StylesheetAssigned" class="ICSharpCode.XmlEditor.StylesheetAssignedCondition"/>
		</Import>
		<Import assembly=":ICSharpCode.SharpDevelop"/>
	</Runtime>
	
	<Manifest>
		<Identity name="ICSharpCode.XmlEditor"/>
		<Dependency addin="ICSharpCode.AvalonEdit" requirePreload="true"/>
	</Manifest>
	
	<Path name="/AddIns/DefaultTextEditor/Formatter/XML">
		<Class id="XmlFormatter" class="ICSharpCode.XmlEditor.XmlFormattingStrategy"/>
	</Path>
	
	<Path name="/SharpDevelop/ViewContent/TextEditor/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;.nuspec;.booproj;.fsproj;.pyproj;.rbproj;.vcxproj;.wixproj;.ps1xml"
			class="ICSharpCode.XmlEditor.XmlCodeCompletionBinding"/>
	</Path>
	
	<Path name="/AddIns/XmlEditor/DefaultSchemaFileAssociations">
		<SchemaFileAssociation id=".addin" namespaceUri="http://www.icsharpcode.net/2005/addin"/>
		<SchemaFileAssociation id=".booproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".config" namespaceUri="urn:app-config" />
		<SchemaFileAssociation id=".csproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".fsproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".manifest" namespaceUri="urn:schemas-microsoft-com:asm.v1"/>
		<SchemaFileAssociation id=".nuspec" namespaceUri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"/>
		<SchemaFileAssociation id=".proj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".pyproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".rbproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".vbproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".vcxproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".wixproj" namespaceUri="http://schemas.microsoft.com/developer/msbuild/2003"/>
		<SchemaFileAssociation id=".wxi" namespaceUri="http://schemas.microsoft.com/wix/2003/01/wi"/>
		<SchemaFileAssociation id=".wxl" namespaceUri="http://schemas.microsoft.com/wix/2006/localization"/>
		<SchemaFileAssociation id=".wxs" namespaceUri="http://schemas.microsoft.com/wix/2003/01/wi"/>
		<SchemaFileAssociation id=".xaml" namespaceUri="http://schemas.microsoft.com/winfx/avalon/2005"/>
		<SchemaFileAssociation id=".xsd" namespacePrefix="xs" namespaceUri="http://www.w3.org/2001/XMLSchema"/>
		<SchemaFileAssociation id=".xsl" namespaceUri="http://www.w3.org/1999/XSL/Transform"/>
	</Path>
	
	<Path name="/SharpDevelop/Workbench/LanguageBindings">
		<LanguageBinding
			id="XML"
			class="ICSharpCode.XmlEditor.XmlLanguageBinding"
			extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco;.nuspec;.booproj;.fsproj;.pyproj;.rbproj;.vcxproj;.wixproj;.ps1xml" />
	</Path>
	
	<Path name="/SharpDevelop/ViewContent/TextEditor/Extensions">
		<TextEditorExtension
			id="XML"
			class="ICSharpCode.XmlEditor.XmlTextEditorExtension"
			extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco;.nuspec;.booproj;.fsproj;.pyproj;.rbproj;.vcxproj;.wixproj;.ps1xml" />
	</Path>
	
	<Path name="/SharpDevelop/Workbench/DisplayBindings">
		<DisplayBinding id="XmlTreeView"
		                type="Secondary"
		                insertbefore="Text"
		                class="ICSharpCode.XmlEditor.XmlDisplayBinding"/>
	</Path>
	
	<!-- Extra project browser icons -->
	<Path name="/Workspace/Icons">
		<Icon id="ExtraXmlFileIcon"
		      extensions=".manifest;.config;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.xfrm;.targets;.xpt;.xft;.map;.wsdl;.disco;.xaml;.nuspec;.booproj;.fsproj;.pyproj;.rbproj;.vcxproj;.wixproj;.ps1xml"
		      resource="FileIcons.XmlIcon" />
	</Path>
	
	<!-- Xml file filter -->
	<Path name="/SharpDevelop/Workbench/FileFilter">
		<FileFilter id="Xml"
		            insertbefore="AllFiles"
		            name="${res:SharpDevelop.FileFilter.XmlFiles}"
		            extensions="*.xml"/>
		<FileFilter id="Xsl"
		            insertbefore="AllFiles"
		            name="${res:SharpDevelop.FileFilter.XslFiles} (*.xsl;*.xslt)"
		            extensions="*.xsl;*.xslt"/>
	</Path>
	
	<!-- XML menu -->
	<Path name="/SharpDevelop/Workbench/MainMenu">
		<ComplexCondition>
			<Or>
				<Condition name="WindowActive" activewindow="ICSharpCode.XmlEditor.XmlTreeView"/>
				<Condition name="TextContent" textcontent="XML"/>
			</Or>
			<MenuItem id="Xml" insertafter="View" insertbefore="Tools" label="&amp;XML" type="Menu">
				<MenuItem id="CreateSchema"
				          label="${res:ICSharpCode.XmlEditor.CreateSchemaMenuLabel}"
				          class="ICSharpCode.XmlEditor.CreateSchemaCommand"/>
				<MenuItem id="ValidateXml"
				          label="${res:ICSharpCode.XmlEditor.ValidateXmlMenuLabel}"
				          class="ICSharpCode.XmlEditor.ValidateXmlCommand"/>
				<MenuItem id="GoToDefinition"
				          label="${res:ICSharpCode.NAntAddIn.GotoDefinitionMenuLabel}"
				          class="ICSharpCode.XmlEditor.GoToSchemaDefinitionCommand"/>
				<MenuItem id="Separator1" type="Separator"/>
				<ComplexCondition action="Disable">
					<Not>
						<Condition name="WindowActive" activewindow="ICSharpCode.XmlEditor.XslOutputView"/>
					</Not>
					<MenuItem id="AssignStylesheet"
					          label="${res:ICSharpCode.XmlEditor.AssignXSLT}"
					          class="ICSharpCode.XmlEditor.AssignStylesheetCommand"/>
					<ComplexCondition action="Disable">
						<!-- evaluate StylesheetAssigned only when XmlView is active - important for lazy loading! -->
						<And>
							<Condition name="WindowActive" activewindow="ICSharpCode.XmlEditor.XmlView"/>
							<Condition name="StylesheetAssigned" action="Disable"/>
						</And>
						<MenuItem id="OpenStylesheet"
						          label="${res:ICSharpCode.XmlEditor.OpenXSLT}"
						          class="ICSharpCode.XmlEditor.OpenStylesheetCommand"/>
					</ComplexCondition>
					<MenuItem id="RunTransform"
					          label="${res:ICSharpCode.XmlEditor.RunXSLT}"
					          class="ICSharpCode.XmlEditor.RunXslTransformCommand"
					          shortcut="Control|Shift|T"/>
				</ComplexCondition>
				<MenuItem id="Separator2" type="Separator"/>
				<MenuItem id="HideXPathResults"
				          label="${res:ICSharpCode.XmlEditor.HideXPathResults}"
				          class="ICSharpCode.XmlEditor.RemoveXPathHighlightingCommand"/>
				<MenuItem id="Format"
				          label="${res:XML.MainMenu.EditMenu.FormatMenu}"
				          class="ICSharpCode.XmlEditor.FormatXmlCommand"/>
			</MenuItem>
		</ComplexCondition>
	</Path>
	
	<!-- Options panel -->
	<Path path="/SharpDevelop/Dialogs/OptionsDialog/TextEditorOptions">
		<OptionPanel id="XmlSchemasPanel"
		             insertafter="Markers"
		             label="${res:ICSharpCode.XmlEditor.XmlSchemasPanel.Title}"
		             class="ICSharpCode.XmlEditor.XmlSchemasPanel"/>
		<OptionPanel id="XmlEditorOptionsPanel"
		             insertafter="Markers"
		             insertbefore="XmlSchemasPanel"
		             label="${res:ICSharpCode.XmlEditor.XmlEditorOptionsPanel.Title}"
		             class="ICSharpCode.XmlEditor.XmlEditorOptionsPanel"/>
	</Path>
	
	<!-- XPath Query pad -->
	<Path name="/SharpDevelop/Workbench/Pads">
		<Pad id="XPathQueryPad"
		     category="Tools"
		     icon="PadIcons.XPathQuery"
		     title="${res:ICSharpCode.XmlEditor.XPathQueryPad.Title}"
		     insertafter="UnitTestingPad"
		     class="ICSharpCode.XmlEditor.XPathQueryPad"
		     defaultPosition="Bottom, Hidden"/>
	</Path>
	
	<!-- Menu options to turn off XPath Query result highlighting -->
	<Path name="/SharpDevelop/Workbench/MainMenu/Edit/Format">
		<Condition name="WindowActive" activewindow="ICSharpCode.XmlEditor.XmlView">
			<MenuItem id="RemoveXPathHighlighting"
			          insertafter="ShowCodeCoverage"
			          label="${res:ICSharpCode.XmlEditor.HideXPathResults}"
			          class="ICSharpCode.XmlEditor.RemoveXPathHighlightingCommand"/>
		</Condition>
	</Path>
	
	<!-- XML Tree context menu options -->
	<Path name="/AddIns/XmlEditor/XmlTree/AttributesGrid/ContextMenu">
		<Condition name="Ownerstate" ownerstate="ElementSelected" action="Disable">
			<MenuItem id="AddAttribute"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.AddAttributeMenuLabel}"
			          class="ICSharpCode.XmlEditor.AddAttributeCommand"/>
		</Condition>
		<Condition name="Ownerstate" ownerstate="AttributeSelected" action="Disable">
			<MenuItem id="RemoveAttribute"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.RemoveAttributeMenuLabel}"
			          icon="Icons.16x16.DeleteIcon"
			          class="ICSharpCode.XmlEditor.RemoveAttributeCommand"/>
		</Condition>
	</Path>
	
	<Path name="/AddIns/XmlEditor/XmlTree/ContextMenu">
		<MenuItem id="Cut"
		          label="${res:XML.TextAreaContextMenu.Cut}"
		          icon="Icons.16x16.CutIcon"
		          shortcut="Control|X"
		          class="ICSharpCode.XmlEditor.CutXmlTreeNode"/>
		<MenuItem id="Copy"
		          label="${res:XML.TextAreaContextMenu.Copy}"
		          icon="Icons.16x16.CopyIcon"
		          shortcut="Control|C"
		          class="ICSharpCode.XmlEditor.CopyXmlTreeNode"/>
		<MenuItem id="Paste"
		          label="${res:XML.TextAreaContextMenu.Paste}"
		          icon="Icons.16x16.PasteIcon"
		          shortcut="Control|V"
		          class="ICSharpCode.XmlEditor.PasteXmlTreeNode"/>
		<MenuItem id="Delete"
		          label="${res:XML.MainMenu.EditMenu.Delete}"
		          icon="Icons.16x16.DeleteIcon"
		          class="ICSharpCode.XmlEditor.DeleteXmlTreeNode"/>
		<MenuItem id="EditItemsSeparator" type="Separator"/>
		<MenuItem id="ExpandAll"
		          label="${res:MainWindow.Windows.SearchResultPanel.ExpandAll.ToolTip}"
		          class="ICSharpCode.XmlEditor.ExpandAllCommand"/>
		<MenuItem id="CollapseAll"
		          label="${res:MainWindow.Windows.SearchResultPanel.CollapseAll.ToolTip}"
		          class="ICSharpCode.XmlEditor.CollapseAllCommand"/>
		<MenuItem id="EditItemsSeparator" type="Separator"/>
		<ComplexCondition action="Disable">
			<Or>
				<Condition name="Ownerstate" ownerstate="CommentSelected"/>
				<And>
					<Condition name="Ownerstate" ownerstate="ElementSelected"/>
					<Not>
						<Condition name="Ownerstate" ownerstate="RootElementSelected"/>
					</Not>
				</And>
			</Or>
			<MenuItem id="InsertElementBefore"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.InsertElementBeforeMenuLabel}"
			          class="ICSharpCode.XmlEditor.InsertElementBeforeCommand"/>
			<MenuItem id="InsertElementAfter"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.InsertElementAfterMenuLabel}"
			          class="ICSharpCode.XmlEditor.InsertElementAfterCommand"/>
		</ComplexCondition>
		<Condition name="Ownerstate" ownerstate="ElementSelected" action="Disable">
			<MenuItem id="AddChildElement"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.AddChildElementMenuLabel}"
			          class="ICSharpCode.XmlEditor.AddChildElementCommand"/>
		</Condition>
		<ComplexCondition action="Disable">
			<Or>
				<Condition name="Ownerstate" ownerstate="TextNodeSelected"/>
				<Condition name="Ownerstate" ownerstate="CommentSelected"/>
				<And>
					<Condition name="Ownerstate" ownerstate="ElementSelected"/>
					<Not>
						<Condition name="Ownerstate" ownerstate="RootElementSelected"/>
					</Not>
				</And>
			</Or>
			<MenuItem id="TextNodeCommandsSeparator" type="Separator"/>
			<MenuItem id="InsertTextNodeBefore"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.InsertTextNodeBeforeMenuLabel}"
			          class="ICSharpCode.XmlEditor.InsertTextNodeBeforeCommand"/>
			<MenuItem id="InsertTextNodeAfter"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.InsertTextNodeAfterMenuLabel}"
			          class="ICSharpCode.XmlEditor.InsertTextNodeAfterCommand"/>
		</ComplexCondition>
		<Condition name="Ownerstate" ownerstate="ElementSelected" action="Disable">
			<MenuItem id="AddChildTextNode"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.AddChildTextNodeAfterMenuLabel}"
			          class="ICSharpCode.XmlEditor.AddChildTextNodeCommand"/>
		</Condition>
		<ComplexCondition action="Disable">
			<Or>
				<Condition name="Ownerstate" ownerstate="TextNodeSelected"/>
				<Condition name="Ownerstate" ownerstate="ElementSelected"/>
				<Condition name="Ownerstate" ownerstate="CommentSelected"/>
			</Or>
			<MenuItem id="CommentNodeCommandsSeparator" type="Separator"/>
			<MenuItem id="InsertCommentBefore"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.InsertCommentBeforeMenuLabel}"
			          class="ICSharpCode.XmlEditor.InsertCommentBeforeCommand"/>
			<MenuItem id="InsertCommentAfter"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.InsertCommentAfterMenuLabel}"
			          class="ICSharpCode.XmlEditor.InsertCommentAfterCommand"/>
		</ComplexCondition>
		<Condition name="Ownerstate" ownerstate="ElementSelected" action="Disable">
			<MenuItem id="AddChildCommentNode"
			          label="${res:ICSharpCode.XmlEditor.XmlTreeView.AddChildCommentMenuLabel}"
			          class="ICSharpCode.XmlEditor.AddChildCommentCommand"/>
		</Condition>
	</Path>
</AddIn>
