public void Init()
        {
            treeViewContainer = new XmlTreeViewContainerControl();

            XmlTextReader reader = ResourceManager.GetXhtmlStrictSchema();
            XmlSchemaCompletionData xhtmlSchema = new XmlSchemaCompletionData(reader);
            XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
            XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xhtmlSchema, String.Empty);

            treeViewContainer.LoadXml("<!-- comment --><html><body class='a'><p>Text</p></body></html>", provider);
            doc = treeViewContainer.Document;
            treeView = treeViewContainer.TreeView;

            commentTreeNode = (XmlCommentTreeNode)treeView.Nodes[0];
            htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[1];
            htmlTreeNode.Expanding();

            bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0];
            bodyTreeNode.Expanding();

            paraTreeNode = (XmlElementTreeNode)bodyTreeNode.Nodes[0];
            paraTreeNode.Expanding();

            textTreeNode = (XmlTextTreeNode)paraTreeNode.Nodes[0];
        }
		public void SetUpFixture()
		{
			using (XmlTreeViewContainerControl treeViewContainer = new XmlTreeViewContainerControl()) {
				
				XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
				treeViewContainer.LoadXml("<test/>", completionDataProvider);
				
				doc = treeViewContainer.Document;
				XmlTreeViewControl treeView = treeViewContainer.TreeView;
				
				treeViewContainer.Document = doc;
				initialElementSelected = treeView.SelectedElement;
				initialIsElementSelected = treeView.IsElementSelected;
				
				// Set the document element again to make sure the existing node 
				// is removed.
				doc.LoadXml("<root/>");
				treeViewContainer.Document = null;
				treeViewContainer.Document = doc;
				documentElement = treeViewContainer.Document.DocumentElement;
				
				rootNode = (XmlElementTreeNode)treeView.Nodes[0];
				nodeCount = treeView.Nodes.Count;
			}
		}
		public void SetUp()
		{
			XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
			treeViewContainerControl = new XmlTreeViewContainerControl();
			treeView = treeViewContainerControl.TreeView;
			treeViewContainerControl.LoadXml(GetXml(), completionDataProvider);
			doc = treeViewContainerControl.Document;
			
			clipboardHandler = treeViewContainerControl as IClipboardHandler;
			
			htmlElement = doc.DocumentElement;
			bodyElement = htmlElement.FirstChild as XmlElement;
			paragraphElement = bodyElement.SelectSingleNode("p") as XmlElement;
			paragraphText = paragraphElement.SelectSingleNode("text()") as XmlText;
			bodyComment = bodyElement.SelectSingleNode("comment()") as XmlComment;
			
			htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
			htmlTreeNode.PerformInitialization();
			bodyTreeNode = htmlTreeNode.FirstNode as XmlElementTreeNode;
			bodyTreeNode.PerformInitialization();
			bodyCommentTreeNode = bodyTreeNode.FirstNode as XmlCommentTreeNode;
			paragraphTreeNode = bodyTreeNode.LastNode as XmlElementTreeNode;
			paragraphTreeNode.PerformInitialization();
			paragraphTextTreeNode = paragraphTreeNode.FirstNode as XmlTextTreeNode;
		}
		public void SetUp()
		{
			treeViewContainerControl = new XmlTreeViewContainerControl();
			treeView = treeViewContainerControl.TreeView;
			treeViewContainerControl.LoadXml("<root><child></child></root>", new XmlSchemaCompletionCollection(), null);
			doc = treeViewContainerControl.Document;
		}
		public void SetUp()
		{
			XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
			treeViewContainerControl = new XmlTreeViewContainerControl();
			treeView = treeViewContainerControl.TreeView;
			treeViewContainerControl.LoadXml("<root><child></child></root>", completionDataProvider);
			doc = treeViewContainerControl.Document;
		}
        public override void Run()
        {
            XmlTreeViewContainerControl view = Owner as XmlTreeViewContainerControl;

            if (view != null)
            {
                view.AddAttribute();
            }
        }
        public override void Run()
        {
            XmlTreeViewContainerControl view = Owner as XmlTreeViewContainerControl;

            if (view != null)
            {
                view.InsertCommentBefore();
            }
        }
        public override void Run()
        {
            XmlTreeViewContainerControl view = Owner as XmlTreeViewContainerControl;

            if (view != null)
            {
                view.AppendChildTextNode();
            }
        }
Beispiel #9
0
        public override void Run()
        {
            XmlTreeViewContainerControl view = Owner as XmlTreeViewContainerControl;

            if (view != null)
            {
                view.AddChildElement();
            }
        }
        public override void Run()
        {
            XmlTreeViewContainerControl view = Owner as XmlTreeViewContainerControl;

            if (view != null)
            {
                view.ExpandAll();
            }
        }
Beispiel #11
0
        public override void Run()
        {
            XmlTreeViewContainerControl view = Owner as XmlTreeViewContainerControl;

            if (view != null)
            {
                view.InsertTextNodeAfter();
            }
        }
Beispiel #12
0
        public XmlTreeView(IViewContent parent, XmlSchemaCompletionCollection schemas, XmlSchemaCompletion defaultSchema)
            : base(parent)
        {
            this.schemas       = schemas;
            this.defaultSchema = defaultSchema;

            this.TabPageText       = "${res:ICSharpCode.XmlEditor.XmlTreeView.Title}";
            this.treeViewContainer = new XmlTreeViewContainerControl(schemas, defaultSchema);
            this.treeViewContainer.DirtyChanged += TreeViewContainerDirtyChanged;
            treeViewContainer.AttributesGrid.ContextMenuStrip = MenuService.CreateContextMenu(treeViewContainer, "/AddIns/XmlEditor/XmlTree/AttributesGrid/ContextMenu");
            treeViewContainer.TreeView.ContextMenuStrip       = MenuService.CreateContextMenu(treeViewContainer, "/AddIns/XmlEditor/XmlTree/ContextMenu");
        }
Beispiel #13
0
		public XmlTreeView(IViewContent parent, XmlSchemaCompletionCollection schemas, XmlSchemaCompletion defaultSchema)
			: base(parent)
		{
			this.schemas = schemas;
			this.defaultSchema = defaultSchema;
			
			this.TabPageText = "${res:ICSharpCode.XmlEditor.XmlTreeView.Title}";
			this.treeViewContainer = new XmlTreeViewContainerControl(schemas, defaultSchema);
			this.treeViewContainer.DirtyChanged += TreeViewContainerDirtyChanged;
			treeViewContainer.AttributesGrid.ContextMenuStrip = MenuService.CreateContextMenu(treeViewContainer, "/AddIns/XmlEditor/XmlTree/AttributesGrid/ContextMenu");
			treeViewContainer.TreeView.ContextMenuStrip = MenuService.CreateContextMenu(treeViewContainer, "/AddIns/XmlEditor/XmlTree/ContextMenu");
		}
		public void SetUpFixture()
		{
			using (XmlTreeViewContainerControl treeViewContainer = new XmlTreeViewContainerControl()) {
				XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
				treeViewContainer.LoadXml("<root/>", completionDataProvider);
				
				doc = treeViewContainer.Document;
				XmlTreeViewControl treeView = treeViewContainer.TreeView;
				
				//treeView.DocumentElement = doc.DocumentElement;
				rootNode = (XmlElementTreeNode)treeView.Nodes[0];

				// No node selected in treeview - adding a child 
				// node should do nothing.
				treeView.SelectedNode = null;
				XmlElement testElement = doc.CreateElement("test");
				treeViewContainer.AppendChildElement(testElement);
				
				treeView.SelectedNode = rootNode;
				XmlElement childElement = doc.CreateElement("child");
				treeViewContainer.AppendChildElement(childElement);
				
				// No node selected in treeview - inserting a node 
				// node should do nothing.
				treeView.SelectedNode = null;
				treeViewContainer.AppendChildElement(testElement);

				XmlElementTreeNode childNode = (XmlElementTreeNode)rootNode.Nodes[0];
				treeView.SelectedNode = childNode;
				XmlElement beforeElement = doc.CreateElement("before");
				treeViewContainer.InsertElementBefore(beforeElement);	
				
				// No node selected in treeview - inserting a node 
				// node should do nothing.
				treeView.SelectedNode = null;
				treeViewContainer.AppendChildElement(testElement);

				treeView.SelectedNode = childNode;
				XmlElement afterElement = doc.CreateElement("after");
				treeViewContainer.InsertElementAfter(afterElement);	
			}
		}
		public void SetUp()
		{
			MockOpenedFile openedFile = new MockOpenedFile("test.xml");
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			xmlView = new MockXmlViewContent(openedFile);
			view = new XmlTreeView(xmlView, schemas, null);
			treeViewContainer = (XmlTreeViewContainerControl)view.Control;
			treeView = treeViewContainer.TreeView;
			clipboardHandler = view as IClipboardHandler;
			xmlView.GetDocumentForFile(null).Text = "<html><body><p></p></body></html>";
			openedFile.SwitchToView(view);
			
			htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
			htmlTreeNode.PerformInitialization();
			bodyTreeNode = htmlTreeNode.Nodes[0] as XmlElementTreeNode;
			bodyTreeNode.PerformInitialization();
			paragraphTreeNode = bodyTreeNode.Nodes[0] as XmlElementTreeNode;

			treeView.SelectedNode = null;
		}
		public void SetUp()
		{
			MockOpenedFile openedFile = new MockOpenedFile("test.xml");
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			xmlView = new XmlView(new DefaultTextEditorProperties(), schemas);
			xmlView.SetPrimaryFileUnitTestMode(openedFile);
			view = new XmlTreeView(xmlView, null, null);
			treeViewContainer = (XmlTreeViewContainerControl)view.Control;
			treeView = treeViewContainer.TreeView;
			clipboardHandler = view as IClipboardHandler;
			
			xmlView.XmlEditor.Text = "<html><body><p></p></body></html>";
			openedFile.SwitchToView(view);
			
			htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
			htmlTreeNode.PerformInitialization();
			bodyTreeNode = htmlTreeNode.Nodes[0] as XmlElementTreeNode;
			bodyTreeNode.PerformInitialization();
			paragraphTreeNode = bodyTreeNode.Nodes[0] as XmlElementTreeNode;

			treeView.SelectedNode = null;
		}
		public void SetUp()
		{
			XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
			treeViewContainerControl = new XmlTreeViewContainerControl();
			treeView = treeViewContainerControl.TreeView;
			treeViewContainerControl.LoadXml("<root><top>text</top><bottom><child>text</child></bottom></root>", completionDataProvider);
			doc = treeViewContainerControl.Document;
			
			ExtTreeNode rootNode = (ExtTreeNode)treeView.Nodes[0];
			rootNode.Expanding();
			
			topElementTreeNode = (XmlElementTreeNode)rootNode.Nodes[0];
			topElementTreeNode.Expanding();
			
			topTextTreeNode = (XmlTextTreeNode)topElementTreeNode.Nodes[0];
			
			ExtTreeNode bottomNode = (ExtTreeNode)rootNode.Nodes[1];
			bottomNode.Expanding();
			
			childElementTreeNode = (XmlElementTreeNode)bottomNode.Nodes[0];
			childElementTreeNode.Expanding();
		}
		public void SetUp()
		{
			treeViewContainerControl = new XmlTreeViewContainerControl();
			treeView = treeViewContainerControl.TreeView;
			string xml = "<root><top>text</top><bottom><child>text</child></bottom></root>";
			treeViewContainerControl.LoadXml(xml, new XmlSchemaCompletionCollection(), null);
			doc = treeViewContainerControl.Document;
			
			ExtTreeNode rootNode = (ExtTreeNode)treeView.Nodes[0];
			rootNode.Expanding();
			
			topElementTreeNode = (XmlElementTreeNode)rootNode.Nodes[0];
			topElementTreeNode.Expanding();
			
			topTextTreeNode = (XmlTextTreeNode)topElementTreeNode.Nodes[0];
			
			ExtTreeNode bottomNode = (ExtTreeNode)rootNode.Nodes[1];
			bottomNode.Expanding();
			
			childElementTreeNode = (XmlElementTreeNode)bottomNode.Nodes[0];
			childElementTreeNode.Expanding();
		}
		public void Init()
		{
			treeViewContainer = new XmlTreeViewContainerControl();
							
			XmlSchemaCompletion xhtmlSchema = new XmlSchemaCompletion(ResourceManager.ReadXhtmlStrictSchema());
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			
			treeViewContainer.LoadXml("<!-- comment --><html><body class='a'><p>Text</p></body></html>", schemas, null);
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			commentTreeNode = (XmlCommentTreeNode)treeView.Nodes[0];
			htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[1];
			htmlTreeNode.Expanding();
			
			bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0];
			bodyTreeNode.Expanding();
			
			paraTreeNode = (XmlElementTreeNode)bodyTreeNode.Nodes[0];
			paraTreeNode.Expanding();
			
			textTreeNode = (XmlTextTreeNode)paraTreeNode.Nodes[0];
		}