public void Init()
		{
			string addinXml = "<AddIn name     = 'Xml Editor'\r\n" +
       								"author      = ''\r\n" +
       								"copyright   = 'prj:///doc/copyright.txt'\r\n" +
       								"description = ''\r\n" +
       								"addInManagerHidden = 'preinstalled'>\r\n" +
								"</AddIn>";

			using (StringReader reader = new StringReader(addinXml)) {
				var addInTree = MockRepository.GenerateStrictMock<IAddInTree>();
				AddIn addin = AddIn.Load(addInTree, reader);
				
				AddInTreeNode addinTreeNode = new AddInTreeNode();

				Properties properties1 = new Properties();
				properties1.Set<string>("id", ".xml");
				properties1.Set<string>("namespaceUri", "http://example.com");
				
				Properties properties2 = new Properties();
				properties2.Set<string>("id", ".xsl");
				properties2.Set<string>("namespaceUri", "http://example.com/xsl");
				properties2.Set<string>("namespacePrefix", "xs");
				
				addinTreeNode.AddCodons(
					new Codon[] {
						new Codon(addin, "SchemaAssociation", properties1, new ICondition[0]),
						new Codon(addin, "SchemaAssociation", properties2, new ICondition[0])
					});
				
				schemaAssociations = new DefaultXmlSchemaFileAssociations(addinTreeNode);
			}
		}
        public void Init()
        {
            LoadBarSchema();
            LoadFooSchema();
            fooSchemaData.IsReadOnly = true;
            LoadXmlSchema();

            schemas = new XmlSchemaCompletionCollection();
            schemas.Add(fooSchemaData);
            schemas.Add(barSchemaData);
            schemas.Add(xmlSchemaData);

            factory = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], String.Empty, new MockFileSystem(), factory);
            registeredXmlSchemas.Schemas.AddRange(schemas);

            string[] xmlFileExtensions = new string[] { ".foo", ".bar", ".xml" };

            DefaultXmlSchemaFileAssociations defaultSchemaFileAssociations = new DefaultXmlSchemaFileAssociations();

            defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".foo", "http://foo"));
            defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".bar", "http://bar", "b"));

            properties   = new Properties();
            associations = new XmlSchemaFileAssociations(properties, defaultSchemaFileAssociations, new XmlSchemaCompletionCollection());
            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xml", "http://xml"));

            panel         = new MockXmlSchemasPanel();
            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, xmlFileExtensions, associations, panel, factory);
            schemasEditor.LoadOptions();
        }
		public void Init()
		{
			LoadBarSchema();
			LoadFooSchema();
			fooSchemaData.IsReadOnly = true;
			LoadXmlSchema();
			
			schemas = new XmlSchemaCompletionCollection();
			schemas.Add(fooSchemaData);
			schemas.Add(barSchemaData);
			schemas.Add(xmlSchemaData);
			
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], String.Empty, new MockFileSystem(), factory);
			registeredXmlSchemas.Schemas.AddRange(schemas);

			string[] xmlFileExtensions = new string[] { ".foo", ".bar", ".xml" };
			
			DefaultXmlSchemaFileAssociations defaultSchemaFileAssociations = new DefaultXmlSchemaFileAssociations();
			defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".foo", "http://foo"));
			defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".bar", "http://bar", "b"));
			
			properties = new Properties();
			associations = new XmlSchemaFileAssociations(properties, defaultSchemaFileAssociations, new XmlSchemaCompletionCollection());
			associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xml", "http://xml"));
			
			panel = new MockXmlSchemasPanel();
			schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, xmlFileExtensions, associations, panel, factory);
			schemasEditor.LoadOptions();	
		}
Beispiel #4
0
        public void Init()
        {
            string addinXml = "<AddIn name     = 'Xml Editor'\r\n" +
                              "author      = ''\r\n" +
                              "copyright   = 'prj:///doc/copyright.txt'\r\n" +
                              "description = ''\r\n" +
                              "addInManagerHidden = 'preinstalled'>\r\n" +
                              "</AddIn>";

            using (StringReader reader = new StringReader(addinXml)) {
                AddIn addin = AddIn.Load(reader);

                AddInTreeNode addinTreeNode = new AddInTreeNode();

                Properties properties1 = new Properties();
                properties1.Set <string>("id", ".xml");
                properties1.Set <string>("namespaceUri", "http://example.com");

                Properties properties2 = new Properties();
                properties2.Set <string>("id", ".xsl");
                properties2.Set <string>("namespaceUri", "http://example.com/xsl");
                properties2.Set <string>("namespacePrefix", "xs");

                addinTreeNode.AddCodons(
                    new Codon[] {
                    new Codon(addin, "SchemaAssociation", properties1, new ICondition[0]),
                    new Codon(addin, "SchemaAssociation", properties2, new ICondition[0])
                });

                schemaAssociations = new DefaultXmlSchemaFileAssociations(addinTreeNode);
            }
        }
		public void Init()
		{
			schemas = new XmlSchemaCompletionCollection();
			defaultXmlSchemaFileExtensions = CreateDefaultXmlSchemaFileExtensions();
			properties = new Properties();
			associations = new XmlSchemaFileAssociations(properties, defaultXmlSchemaFileExtensions, schemas);
			options = new XmlEditorOptions(properties);
		}
		public XmlSchemaFileAssociations(Properties properties, 
			DefaultXmlSchemaFileAssociations defaultSchemaFileAssociations,
			XmlSchemaCompletionCollection schemas)
		{
			this.properties = properties;
			this.defaultSchemaFileAssociations = defaultSchemaFileAssociations;
			this.schemas = schemas;
		}
 public void Init()
 {
     schemas = new XmlSchemaCompletionCollection();
     defaultXmlSchemaFileExtensions = CreateDefaultXmlSchemaFileExtensions();
     properties   = new Properties();
     associations = new XmlSchemaFileAssociations(properties, defaultXmlSchemaFileExtensions, schemas);
     options      = new XmlEditorOptions(properties);
 }
		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);			
		}
Beispiel #9
0
        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 EmptySchemaFileAssociationListReturnedWhenAddInTreeNodeIsNull()
		{
			DefaultXmlSchemaFileAssociations schemaAssociations = new DefaultXmlSchemaFileAssociations(null);
			Assert.AreEqual(0, schemaAssociations.Count);
		}