/// <summary>
        /// Gets the default schema association for the file extension.
        /// </summary>
        /// <remarks>
        /// These defaults are hard coded.
        /// </remarks>
        public static XmlSchemaAssociation GetDefaultAssociation(string extension)
        {
            XmlSchemaAssociation association = null;

            switch (extension.ToLowerInvariant())
            {
            case ".config":
                association = new XmlSchemaAssociation(extension, @"urn:app-config");
                break;

            case ".build":
                association = new XmlSchemaAssociation(extension, @"http://nant.sf.net/release/0.85-rc3/nant.xsd");
                break;

            case ".xsl":
            case ".xslt":
                association = new XmlSchemaAssociation(extension, @"http://www.w3.org/1999/XSL/Transform", "xsl");
                break;

            case ".xsd":
                association = new XmlSchemaAssociation(extension, @"http://www.w3.org/2001/XMLSchema", "xs");
                break;

            default:
                association = new XmlSchemaAssociation(extension);
                break;
            }
            return(association);
        }
        /// <summary>
        /// Gets an association between a schema and a file extension.
        /// </summary>
        /// <remarks>
        /// <para>The property will be an xml element when the SharpDevelopProperties.xml
        /// is read on startup.  The property will be a schema association
        /// if the user changes the schema associated with the file
        /// extension in tools->options.</para>
        /// <para>The normal way of doing things is to
        /// pass the GetProperty method a default value which auto-magically
        /// turns the xml element into a schema association so we would not
        /// have to check for both.  In this case, however, I do not want
        /// a default saved to the SharpDevelopProperties.xml file unless the user
        /// makes a change using Tools->Options.</para>
        /// <para>If we have a file extension that is currently missing a default
        /// schema then if we  ship the schema at a later date the association will
        /// be updated by the code if the user has not changed the settings themselves.
        /// </para>
        /// <para>For example, the initial release of the xml editor add-in had
        /// no default schema for .xsl files, by default it was associated with
        /// no schema and this setting is saved if the user ever viewed the settings
        /// in the tools->options dialog.  Now, after the initial release the
        /// .xsl schema was created and shipped with SharpDevelop, there is
        /// no way to associate this schema to .xsl files by default since
        /// the property exists in the SharpDevelopProperties.xml file.</para>
        /// <para>An alternative way of doing this might be to have the
        /// config info in the schema itself, which a special SharpDevelop
        /// namespace.  I believe this is what Visual Studio does.  This
        /// way is not as flexible since it requires the user to locate
        /// the schema and change the association manually.</para>
        /// </remarks>
        public static XmlSchemaAssociation GetSchemaAssociation(string extension)
        {
            var association = Properties.Get <XmlSchemaAssociation> (AssociationPrefix + extension.ToLowerInvariant());

            if (association == null)
            {
                association = XmlSchemaAssociation.GetDefaultAssociation(extension);
            }

            return(association);
        }
        /// <summary>
        /// Two schema associations are considered equal if their file extension,
        /// prefix and namespaceUri are the same.
        /// </summary>
        public override bool Equals(object obj)
        {
            bool equals = false;

            XmlSchemaAssociation rhs = obj as XmlSchemaAssociation;

            if (rhs != null)
            {
                if ((this.namespacePrefix == rhs.namespacePrefix) &&
                    (this.extension == rhs.extension) &&
                    (this.namespaceUri == rhs.namespaceUri))
                {
                    equals = true;
                }
            }

            return(equals);
        }
 public XmlSchemaAssociationChangedEventArgs(string extension, XmlSchemaAssociation association)
 {
     this.Extension   = extension;
     this.Association = association;
 }
 public static void SetSchemaAssociation(XmlSchemaAssociation association)
 {
     Properties.Set(AssociationPrefix + association.Extension.ToLowerInvariant(), association);
 }
		/// <summary>
		/// Gets the default schema association for the file extension. 
		/// </summary>
		/// <remarks>
		/// These defaults are hard coded.
		/// </remarks>
		public static XmlSchemaAssociation GetDefaultAssociation(string extension)
		{
			XmlSchemaAssociation association = null;
			
			switch (extension.ToLowerInvariant ()) {
				case ".config":
					association = new XmlSchemaAssociation(extension, @"urn:app-config");
					break;
				case ".build":
					association = new XmlSchemaAssociation(extension, @"http://nant.sf.net/release/0.85-rc3/nant.xsd");
					break;
				case ".xsl":
				case ".xslt":
					association = new XmlSchemaAssociation(extension, @"http://www.w3.org/1999/XSL/Transform", "xsl");
					break;
				case ".xsd":
					association = new XmlSchemaAssociation(extension, @"http://www.w3.org/2001/XMLSchema", "xs");
					break;
				default:
					association = new XmlSchemaAssociation(extension);
					break;
			}
			return association;
		}
		public XmlSchemaAssociationChangedEventArgs (string extension, XmlSchemaAssociation association)
		{
			this.Extension = extension;
			this.Association = association;
		}		
		public static void SetSchemaAssociation (XmlSchemaAssociation association)
		{
			Properties.Set (AssociationPrefix + association.Extension.ToLowerInvariant (), association);
		}