Ejemplo n.º 1
0
 public XmlCompletionDataProvider(XmlSchemaCompletionDataCollection schemaCompletionDataItems, XmlSchemaCompletionData defaultSchemaCompletionData, string defaultNamespacePrefix)
 {
     this.schemaCompletionDataItems   = schemaCompletionDataItems;
     this.defaultSchemaCompletionData = defaultSchemaCompletionData;
     this.defaultNamespacePrefix      = defaultNamespacePrefix;
     DefaultIndex = 0;
 }
		public XmlCompletionDataProvider(XmlSchemaCompletionDataCollection schemaCompletionDataItems, XmlSchemaCompletionData defaultSchemaCompletionData, string defaultNamespacePrefix)
		{
			this.schemaCompletionDataItems = schemaCompletionDataItems;
			this.defaultSchemaCompletionData = defaultSchemaCompletionData;
			this.defaultNamespacePrefix = defaultNamespacePrefix;
			DefaultIndex = 0;
		}
Ejemplo n.º 3
0
 /// <summary>
 ///   Adds the contents of another <see cref='XmlSchemaCompletionDataCollection'/> to the end of the collection.
 /// </summary>
 /// <param name='val'>
 ///    A <see cref='XmlSchemaCompletionDataCollection'/> containing the objects to add to the collection.
 /// </param>
 /// <seealso cref='XmlSchemaCompletionDataCollection.Add'/>
 public void AddRange(XmlSchemaCompletionDataCollection val)
 {
     for (int i = 0; i < val.Count; i++)
     {
         this.Add(val[i]);
     }
 }
        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 override void FixtureInit()
		{
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			schemas.Add(SchemaCompletionData);
			XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, SchemaCompletionData, String.Empty);
			string xml = "<note xmlns='http://www.w3schools.com' name=''></note>";
			schemaAttribute = (XmlSchemaAttribute)XmlView.GetSchemaObjectSelected(xml, xml.IndexOf("name"), provider);
		}
		public void SetUpFixture()
		{
			schemas = new XmlSchemaCompletionDataCollection();
			XmlSchemaCompletionData completionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
			expectedNamespace = completionData.NamespaceUri;
			completionData.FileName = @"C:\Schemas\MySchema.xsd";
			schemas.Add(completionData);
			
			provider = new XmlCompletionDataProvider(schemas, completionData, String.Empty);
		}
		public override void FixtureInit()
		{
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			schemas.Add(SchemaCompletionData);
			XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
			schemas.Add(xsdSchemaCompletionData);
			XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
			
			string xml = GetSchema();			
			int index = xml.IndexOf("ref=\"coreattrs\"");
			index = xml.IndexOf("coreattrs", index);
			schemaAttributeGroup = (XmlSchemaAttributeGroup)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
		}
        public void FixtureInit()
        {
            XmlSchemaCompletionDataCollection items = new XmlSchemaCompletionDataCollection();

            StringReader reader = new StringReader(GetSchema(firstNamespace));
            XmlSchemaCompletionData schema = new XmlSchemaCompletionData(reader);
            items.Add(schema);

            reader = new StringReader(GetSchema(secondNamespace));
            schema = new XmlSchemaCompletionData(reader);
            items.Add(schema);
            namespaceCompletionData = items.GetNamespaceCompletionData();
        }
        public override void FixtureInit()
        {
            XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
            schemas.Add(SchemaCompletionData);
            XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
            schemas.Add(xsdSchemaCompletionData);
            XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);

            string xml = GetSchema();
            int index = xml.IndexOf("type=\"dir\"/>");
            index = xml.IndexOf("dir", index);
            schemaSimpleType = (XmlSchemaSimpleType)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
        }
        public override void FixtureInit()
        {
            XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
            schemas.Add(SchemaCompletionData);
            XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
            schemas.Add(xsdSchemaCompletionData);
            XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);

            string xml = GetSchema();

            int index = xml.IndexOf("ref=\"xs:list");
            index = xml.IndexOf("xs", index);
            referencedSchemaElement = (XmlSchemaElement)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
        }
		public void SetUpFixture()
		{
			Form parentForm = new Form();
			parentForm.CreateControl();
			
			XmlSchemaCompletionData schema = new XmlSchemaCompletionData(ResourceManager.GetXhtmlStrictSchema());
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			schemas.Add(schema);
			provider = new XmlCompletionDataProvider(schemas, schema, String.Empty);
			TextEditorControl textEditor = new TextEditorControl();
			completionDataItems = provider.GenerateCompletionData(@"C:\Test.xml", textEditor.ActiveTextAreaControl.TextArea, '<');
			using (CodeCompletionWindow completionWindow = CodeCompletionWindow.ShowCompletionWindow(parentForm, textEditor, @"C:\Test.xml", provider, '<')) {
				CodeCompletionListView listView = (CodeCompletionListView)completionWindow.Controls[0];
				selectedCompletionData = listView.SelectedCompletionData;
				completionWindow.Close();
			}
		}
Ejemplo n.º 12
0
 public ScriptEditor()
 {
     InitializeComponent();
     #if DEBUG
     const string folderName = @"..\..\..\Schemas";
     #else
     const string folderName = @"..\Data\Schemas";
     #endif
     string path = Path.Combine(Utils.RunDirectory, folderName);
     if (Directory.Exists(path))
     {
         List<XmlSchemaCompletionData> datas = GetSchemas(path,  new List<XmlSchemaCompletionData>());
         //DefaultSchemaCompletionData = data;
         SchemaCompletionDataItems = new XmlSchemaCompletionDataCollection(datas.ToArray());
         CodeCompletionPopupCommand command = new CodeCompletionPopupCommand();
         editactions.Add(Keys.Space | Keys.Control, command);
     }
 }
		public void Init()
		{
			treeViewContainer = new DerivedXmlTreeViewContainerControl();
							
			XmlTextReader reader = ResourceManager.GetXhtmlStrictSchema();
			XmlSchemaCompletionData xhtmlSchema = new XmlSchemaCompletionData(reader);
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xhtmlSchema, String.Empty);
			
			treeViewContainer.LoadXml("<html><body></body></html>", provider);
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0];
			htmlTreeNode.Expanding();
			bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0];
			
			bodyElement = (XmlElement)doc.SelectSingleNode("/html/body");
		}
		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 Init()
		{
			treeViewContainer = new DerivedXmlTreeViewContainerControl();
			treeViewContainer.DirtyChanged += TreeViewContainerDirtyChanged;
							
			XmlTextReader reader = ResourceManager.GetXhtmlStrictSchema();
			XmlSchemaCompletionData xhtmlSchema = new XmlSchemaCompletionData(reader);
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			provider = new XmlCompletionDataProvider(schemas, xhtmlSchema, String.Empty);
			
			treeViewContainer.LoadXml("<html id='a'>text<body></body></html>", provider);
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0];
			htmlTreeNode.Expanding();
			textTreeNode = (XmlTextTreeNode)htmlTreeNode.Nodes[0];

			splitContainer = (SplitContainer)treeViewContainer.Controls["splitContainer"];
			
			textBox = (RichTextBox)splitContainer.Panel2.Controls["textBox"];
			errorMessageTextBox = (RichTextBox)splitContainer.Panel2.Controls["errorMessageTextBox"];
			attributesGrid = (PropertyGrid)splitContainer.Panel2.Controls["attributesGrid"];
		}
Ejemplo n.º 16
0
 /// <summary>
 ///   Initializes a new instance of <see cref='XmlSchemaCompletionDataCollection'/> based on another <see cref='XmlSchemaCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>
 ///   A <see cref='XmlSchemaCompletionDataCollection'/> from which the contents are copied
 /// </param>
 public XmlSchemaCompletionDataCollection(XmlSchemaCompletionDataCollection val)
 {
     this.AddRange(val);
 }
Ejemplo n.º 17
0
 /// <summary>
 ///   Initializes a new instance of <see cref='XmlSchemaCompletionDataEnumerator'/>.
 /// </summary>
 public XmlSchemaCompletionDataEnumerator(XmlSchemaCompletionDataCollection mappings)
 {
     this.temp           = ((System.Collections.IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }
Ejemplo n.º 18
0
		public void Init()
		{
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			provider = new XmlCompletionDataProvider(schemas, null, null);
		}
 /// <summary>
 ///   Initializes a new instance of <see cref='XmlSchemaCompletionDataCollection'/> based on another <see cref='XmlSchemaCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>
 ///   A <see cref='XmlSchemaCompletionDataCollection'/> from which the contents are copied
 /// </param>
 public XmlSchemaCompletionDataCollection(XmlSchemaCompletionDataCollection val)
 {
     this.AddRange(val);
 }
 /// <summary>
 ///   Initializes a new instance of <see cref='XmlSchemaCompletionDataEnumerator'/>.
 /// </summary>
 public XmlSchemaCompletionDataEnumerator(XmlSchemaCompletionDataCollection mappings)
 {
     this.temp = ((System.Collections.IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Creates an XmlView that is independent of SharpDevelop. This
        /// constructor does rely on SharpDevelop being available and is
        /// only used for testing the XmlView.
        /// </summary>
        public XmlView(ITextEditorProperties textEditorProperties, XmlSchemaCompletionDataCollection schemas)
        {
            this.TabPageText = "XML";

            TextEditorDisplayBinding.InitializeSyntaxModes();

            xmlEditor = new XmlEditorControl();
            xmlEditor.Dock = DockStyle.Fill;

            xmlEditor.TextEditorProperties = textEditorProperties;
            xmlEditor.SchemaCompletionDataItems = schemas;
            xmlEditor.Document.DocumentChanged += DocumentChanged;
        }
 /// <summary>
 ///   Adds the contents of another <see cref='XmlSchemaCompletionDataCollection'/> to the end of the collection.
 /// </summary>
 /// <param name='val'>
 ///    A <see cref='XmlSchemaCompletionDataCollection'/> containing the objects to add to the collection.
 /// </param>
 /// <seealso cref='XmlSchemaCompletionDataCollection.Add'/>
 public void AddRange(XmlSchemaCompletionDataCollection val)
 {
     for (int i = 0; i < val.Count; i++)
     {
         this.Add(val[i]);
     }
 }