public void XmlSchemaFileAssociationCountMatchesNumItemsAddedToPanel()
		{
			XmlSchemaFileAssociationListItem item = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "prefix");
			panel.AddXmlSchemaFileAssociationListItem(item);
			
			Assert.AreEqual(1, panel.XmlSchemaFileAssociationListItemCount);
		}		
		public void XmlSchemaFileAssociationCanBeRetrievedAfterAddingToPanel()
		{
			XmlSchemaFileAssociationListItem item = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "prefix");
			int index = panel.AddXmlSchemaFileAssociationListItem(item);
			
			Assert.AreSame(item, panel.GetXmlSchemaFileAssociationListItem(index));
		}
		void PopulateXmlSchemaFileAssociationList()
		{			
			foreach (string extension in xmlFileExtensions) {
				XmlSchemaFileAssociation association = associations.GetSchemaFileAssociation(extension);
				XmlSchemaFileAssociationListItem item = new XmlSchemaFileAssociationListItem(extension, association.NamespaceUri, association.NamespacePrefix);
				schemasPanel.AddXmlSchemaFileAssociationListItem(item);
			}			
			schemasPanel.AddXmlSchemaFileAssociationListSortDescription("Extension", ListSortDirection.Ascending);			
		}
 void PopulateXmlSchemaFileAssociationList()
 {
     foreach (string extension in xmlFileExtensions)
     {
         XmlSchemaFileAssociation         association = associations.GetSchemaFileAssociation(extension);
         XmlSchemaFileAssociationListItem item        = new XmlSchemaFileAssociationListItem(extension, association.NamespaceUri, association.NamespacePrefix);
         schemasPanel.AddXmlSchemaFileAssociationListItem(item);
     }
     schemasPanel.AddXmlSchemaFileAssociationListSortDescription("Extension", ListSortDirection.Ascending);
 }
        public void XmlSchemaFileAssociationFileExtensionSelectionChanged()
        {
            ignoreNamespacePrefixTextChanges = true;

            XmlSchemaFileAssociationListItem association = schemasPanel.GetSelectedXmlSchemaFileAssociationListItem();

            schemasPanel.SetSelectedSchemaNamespace(association.NamespaceUri);
            schemasPanel.SetSelectedSchemaNamespacePrefix(association.NamespacePrefix);

            ignoreNamespacePrefixTextChanges = false;
        }
 void UpdateXmlSchemaFileAssociations()
 {
     for (int i = 0; i < schemasPanel.XmlSchemaFileAssociationListItemCount; ++i)
     {
         XmlSchemaFileAssociationListItem item = schemasPanel.GetXmlSchemaFileAssociationListItem(i);
         if (item.IsDirty)
         {
             XmlSchemaFileAssociation association = new XmlSchemaFileAssociation(item.Extension, item.NamespaceUri, item.NamespacePrefix);
             associations.SetSchemaFileAssociation(association);
         }
     }
 }
 public void SchemaNamespacePrefixChanged()
 {
     if (!ignoreNamespacePrefixTextChanges)
     {
         XmlSchemaFileAssociationListItem item = schemasPanel.GetSelectedXmlSchemaFileAssociationListItem();
         if (item != null)
         {
             item.NamespacePrefix = schemasPanel.GetSelectedSchemaNamespacePrefix();
             item.IsDirty         = true;
         }
     }
 }
        public void ChangeSchemaAssociation()
        {
            string[] namespaces          = GetSchemaListNamespaces();
            SelectXmlSchemaWindow window = new SelectXmlSchemaWindow(namespaces);

            window.SelectedNamespaceUri = schemasPanel.GetSelectedSchemaNamespace();
            if (schemasPanel.ShowDialog(window) == true)
            {
                schemasPanel.SetSelectedSchemaNamespace(window.SelectedNamespaceUri);
                XmlSchemaFileAssociationListItem item = schemasPanel.GetSelectedXmlSchemaFileAssociationListItem();
                item.NamespaceUri = window.SelectedNamespaceUri;
                item.IsDirty      = true;
            }
        }
		public void Init()
		{
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], String.Empty, null, factory);
			properties = new Properties();
			DefaultXmlSchemaFileAssociations defaultAssociations = new DefaultXmlSchemaFileAssociations(new AddInTreeNode());
			associations = new XmlSchemaFileAssociations(properties, defaultAssociations, new XmlSchemaCompletionCollection());
			schemasPanel = new XmlSchemasPanel(registeredXmlSchemas, new string[0], associations, factory);
			
			schemaListBox = schemasPanel.FindName("schemaListBox") as ListBox;
			fileExtensionComboBox = schemasPanel.FindName("fileExtensionComboBox") as ComboBox;
			removeSchemaButton = schemasPanel.FindName("removeSchemaButton") as Button;
			namespacePrefixTextBox = schemasPanel.FindName("namespacePrefixTextBox") as TextBox;
			schemaNamespaceTextBox = schemasPanel.FindName("schemaNamespaceTextBox") as TextBox;

			schemaListItem = new XmlSchemaListItem("a");
			schemaListBox.Items.Add(schemaListItem);

			fileAssociationItem = new XmlSchemaFileAssociationListItem(".xsd", "ns", "a");
			schemasPanel.AddXmlSchemaFileAssociationListItem(fileAssociationItem);			
		}
        public void WhenSelectedSchemaNamespacePrefixModifiedSchemasEditorSchemaNamespacePrefixChangedMethodCalled()
        {
            XmlSchemaFileAssociationListItem xmlSchemaAssociation = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "x");
            panel.AddXmlSchemaFileAssociationListItem(xmlSchemaAssociation);
            panel.SelectedXmlSchemaFileAssociationListItemIndex = 0;

            bool methodCalled = false;
            panel.SetMethodToCallWhenSchemaNamespacePrefixChanged(delegate() { methodCalled = true; });
            panel.SetSelectedSchemaNamespacePrefix("test");

            Assert.IsTrue(methodCalled);
        }
        public void SelectedXmlSchemaFileAssocationIndexChangesSelectedItem()
        {
            XmlSchemaFileAssociationListItem xmlSchemaAssociation = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "x");
            panel.AddXmlSchemaFileAssociationListItem(xmlSchemaAssociation);
            panel.SelectedXmlSchemaFileAssociationListItemIndex = 0;

            Assert.AreSame(xmlSchemaAssociation, panel.GetSelectedXmlSchemaFileAssociationListItem());
        }
		public void LastXmlFileExtensionIsXml()
		{
			XmlSchemaFileAssociationListItem expectedItem = new XmlSchemaFileAssociationListItem(".xml", "http://xml", String.Empty);
			Assert.AreEqual(expectedItem.ToString(), panel.GetXmlSchemaFileAssociationListItem(2).ToString());
		}
		public void FirstXmlFileExtensionIsBar()
		{
			XmlSchemaFileAssociationListItem expectedItem = new XmlSchemaFileAssociationListItem(".bar", "http://bar", "b");
			Assert.AreEqual(expectedItem.ToString(), panel.GetXmlSchemaFileAssociationListItem(0).ToString());
		}
예제 #14
0
 public int AddXmlSchemaFileAssociationListItem(XmlSchemaFileAssociationListItem schemaFileAssociationListItem)
 {
     return(fileExtensionComboBox.Items.Add(schemaFileAssociationListItem));
 }
예제 #15
0
		public int AddXmlSchemaFileAssociationListItem(XmlSchemaFileAssociationListItem item)
		{
			return schemaFileAssociationsComboBox.Items.Add(item);
		}
		public int AddXmlSchemaFileAssociationListItem(XmlSchemaFileAssociationListItem schemaFileAssociationListItem)
		{
			return fileExtensionComboBox.Items.Add(schemaFileAssociationListItem);
		}