public void XmlSchemaListItemCanBeRetrievedAfterAddingToPanel()
		{
			XmlSchemaListItem item = new XmlSchemaListItem("namespace", true);
			panel.AddXmlSchemaListItem(item);
			
			Assert.AreSame(item, panel.GetXmlSchemaListItem(0));
		}		
		void PopulateSchemaList()
		{
			foreach (XmlSchemaCompletion schema in registeredXmlSchemas.Schemas) {
				XmlSchemaListItem item = new XmlSchemaListItem(schema.NamespaceUri, schema.IsReadOnly);
				schemasPanel.AddXmlSchemaListItem(item);
			}
			schemasPanel.AddXmlSchemaListSortDescription("NamespaceUri", ListSortDirection.Ascending);
		}
 void PopulateSchemaList()
 {
     foreach (XmlSchemaCompletion schema in registeredXmlSchemas.Schemas)
     {
         XmlSchemaListItem item = new XmlSchemaListItem(schema.NamespaceUri, schema.IsReadOnly);
         schemasPanel.AddXmlSchemaListItem(item);
     }
     schemasPanel.AddXmlSchemaListSortDescription("NamespaceUri", ListSortDirection.Ascending);
 }
        public void RemoveSelectedSchema()
        {
            XmlSchemaListItem item = schemasPanel.GetSelectedXmlSchemaListItem();

            if (item != null)
            {
                RemoveSchema(item.NamespaceUri);
            }
        }
		public void RemoveSchemaListItem()
		{
			XmlSchemaListItem itemToRemove = new XmlSchemaListItem("b");
			panel.AddXmlSchemaListItem(itemToRemove);
			panel.AddXmlSchemaListItem(new XmlSchemaListItem("a"));
			panel.RemoveXmlSchemaListItem(itemToRemove);
						
			Assert.AreEqual(1, panel.XmlSchemaListItemCount);
		}
        /// <summary>
        /// Loads the specified schema and adds it to an internal collection.
        /// </summary>
        /// <remarks>The schema file is not copied to the user's schema folder
        /// until they click the OK button.</remarks>
        void AddSchema(XmlSchemaCompletion schema)
        {
            XmlSchemaListItem schemaListItem = new XmlSchemaListItem(schema.NamespaceUri, false);
            int index = schemasPanel.AddXmlSchemaListItem(schemaListItem);

            schemasPanel.SelectedXmlSchemaListItemIndex = index;
            addedSchemas.Add(schema);

            schemasChanged = true;
        }
        public void SchemaListSelectionChanged()
        {
            bool removeSchemaButtonEnabled = false;
            XmlSchemaListItem item         = schemasPanel.GetSelectedXmlSchemaListItem();

            if (item != null)
            {
                removeSchemaButtonEnabled = !item.ReadOnly;
            }
            schemasPanel.RemoveSchemaButtonEnabled = removeSchemaButtonEnabled;
        }
 void RemoveSchemaListItem(string namespaceUri)
 {
     for (int i = 0; i < schemasPanel.XmlSchemaListItemCount; ++i)
     {
         XmlSchemaListItem item = schemasPanel.GetXmlSchemaListItem(i);
         if (item.NamespaceUri == namespaceUri)
         {
             schemasPanel.RemoveXmlSchemaListItem(item);
             break;
         }
     }
 }
		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 int AddXmlSchemaListItem(XmlSchemaListItem schema)
		{
			return schemaListBox.Items.Add(schema);
		}
Esempio n. 11
0
 public void ScrollXmlSchemaListItemIntoView(XmlSchemaListItem schemaListItem)
 {
     schemaListBox.ScrollIntoView(schemaListItem);
 }
Esempio n. 12
0
 public void RemoveXmlSchemaListItem(XmlSchemaListItem schemaListItem)
 {
     schemaListBox.Items.Remove(schemaListItem);
 }
        public void SelectXmlSchemaByNamespace()
        {
            panel.AddXmlSchemaListItem(new XmlSchemaListItem("a"));
            XmlSchemaListItem listItemToBeSelected = new XmlSchemaListItem("b");
            panel.AddXmlSchemaListItem(listItemToBeSelected);

            panel.SelectSchemaListItem("b");

            Assert.AreSame(listItemToBeSelected, panel.GetSelectedXmlSchemaListItem());
        }
		public void ScrollXmlSchemaListItemIntoView(XmlSchemaListItem schemaListItem)
		{
			xmlSchemaListItemScrolledIntoView = schemaListItem;
		}
		public void AddXmlSchemaListItemAddsItemToListBox()
		{
			XmlSchemaListItem newItem = new XmlSchemaListItem("new");
			int index = schemasPanel.AddXmlSchemaListItem(newItem);
			
			Assert.AreSame(newItem, schemaListBox.Items[index]);
		}
		public void ScrollXmlSchemaListItemIntoView(XmlSchemaListItem schemaListItem)
		{
			schemaListBox.ScrollIntoView(schemaListItem);
		}
		/// <summary>
		/// Loads the specified schema and adds it to an internal collection.
		/// </summary>
		/// <remarks>The schema file is not copied to the user's schema folder
		/// until they click the OK button.</remarks>
		void AddSchema(XmlSchemaCompletion schema)
		{
			XmlSchemaListItem schemaListItem = new XmlSchemaListItem(schema.NamespaceUri, false);
			int index = schemasPanel.AddXmlSchemaListItem(schemaListItem);
			schemasPanel.SelectedXmlSchemaListItemIndex = index;
			addedSchemas.Add(schema);
			
			schemasChanged = true;
		}
 public void ScrollIntoViewXmlSchemaListItemIsSaved()
 {
     XmlSchemaListItem item = new XmlSchemaListItem("a");
     panel.ScrollXmlSchemaListItemIntoView(item);
     Assert.AreSame(item, panel.XmlSchemaListItemScrolledIntoView);
 }
		public void RemoveXmlSchemaListItem(XmlSchemaListItem schema)
		{
			schemaListBox.Items.Remove(schema);
		}
        public void SettingXmlSchemaListSelectedIndexChangesSelectedXmlSchemaListItem()
        {
            XmlSchemaListItem item = new XmlSchemaListItem("namespace", true);
            panel.AddXmlSchemaListItem(item);
            panel.SelectedXmlSchemaListItemIndex = 0;

            Assert.AreEqual("namespace", panel.GetSelectedXmlSchemaListItem().ToString());
        }
Esempio n. 21
0
 public int AddXmlSchemaListItem(XmlSchemaListItem schemaListItem)
 {
     return(schemaListBox.Items.Add(schemaListItem));
 }