Ejemplo n.º 1
0
 /// <summary>
 /// User has changed the namespace prefix.
 /// </summary>
 void NamespacePrefixTextBoxTextChanged(object source, EventArgs e)
 {
     if (!ignoreNamespacePrefixTextChanges)
     {
         XmlSchemaAssociationListBoxItem item = fileExtensionComboBox.SelectedItem as XmlSchemaAssociationListBoxItem;
         if (item != null)
         {
             item.NamespacePrefix = namespacePrefixTextBox.Text;
             item.IsDirty         = true;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Allows the user to change the schema associated with an xml file
 /// extension.
 /// </summary>
 void ChangeSchemaButtonClick(object source, EventArgs e)
 {
     string[] namespaces = GetSchemaListBoxNamespaces();
     using (SelectXmlSchemaForm form = new SelectXmlSchemaForm(namespaces)) {
         form.SelectedNamespaceUri = schemaTextBox.Text;
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             schemaTextBox.Text = form.SelectedNamespaceUri;
             XmlSchemaAssociationListBoxItem item = (XmlSchemaAssociationListBoxItem)fileExtensionComboBox.SelectedItem;
             item.NamespaceUri = form.SelectedNamespaceUri;
             item.IsDirty      = true;
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Reads the configured xml file extensions and their associated namespaces.
        /// </summary>
        void PopulateFileExtensionComboBox()
        {
            string [] extensions = XmlView.GetXmlFileExtensions();

            foreach (string extension in extensions)
            {
                XmlSchemaAssociation            association = XmlEditorAddInOptions.GetSchemaAssociation(extension);
                XmlSchemaAssociationListBoxItem item        = new XmlSchemaAssociationListBoxItem(association.Extension, association.NamespaceUri, association.NamespacePrefix);
                fileExtensionComboBox.Items.Add(item);
            }

            if (fileExtensionComboBox.Items.Count > 0)
            {
                fileExtensionComboBox.SelectedIndex = 0;
                FileExtensionComboBoxSelectedIndexChanged(this, new EventArgs());
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Shows the namespace associated with the selected xml file extension.
        /// </summary>
        void FileExtensionComboBoxSelectedIndexChanged(object source, EventArgs e)
        {
            schemaTextBox.Text = String.Empty;
            ignoreNamespacePrefixTextChanges = true;
            namespacePrefixTextBox.Text      = String.Empty;

            try {
                XmlSchemaAssociationListBoxItem association = fileExtensionComboBox.SelectedItem as XmlSchemaAssociationListBoxItem;
                if (association != null)
                {
                    schemaTextBox.Text          = association.NamespaceUri;
                    namespacePrefixTextBox.Text = association.NamespacePrefix;
                }
            } finally {
                ignoreNamespacePrefixTextChanges = false;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Reads the configured xml file extensions and their associated namespaces.
        /// </summary>
        void PopulateFileExtensionComboBox()
        {
            string [] extensions = XmlView.GetXmlFileExtensions();

            foreach (string extension in extensions) {
                XmlSchemaAssociation association = XmlEditorAddInOptions.GetSchemaAssociation(extension);
                XmlSchemaAssociationListBoxItem item = new XmlSchemaAssociationListBoxItem(association.Extension, association.NamespaceUri, association.NamespacePrefix);
                fileExtensionComboBox.Items.Add(item);
            }

            if (fileExtensionComboBox.Items.Count > 0) {
                fileExtensionComboBox.SelectedIndex = 0;
                FileExtensionComboBoxSelectedIndexChanged(this, new EventArgs());
            }
        }