Ejemplo n.º 1
0
 public override Widget CreatePanelWidget()
 {
     widget = new XmlSchemasPanelWidget();
     widget.LoadUserSchemas(XmlSchemaManager.UserSchemas);
     widget.AddFileExtensions(XmlFileAssociationManager.GetAssociations());
     return(widget);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the namespace prefix that is associated with the
        /// specified file extension.
        /// </summary>
        public static string GetNamespacePrefixForFileName(string filename)
        {
            var association = XmlFileAssociationManager.GetAssociationForFileName(filename);

            if (association != null)
            {
                return(association.NamespacePrefix);
            }
            return(String.Empty);
        }
        /// <summary>
        /// Determines whether the file can be displayed by
        /// the xml editor.
        /// </summary>
        static bool IsFileNameHandled(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return(false);
            }

            string mimeType = DesktopService.GetMimeTypeForUri(fileName);

            if (IsMimeTypeHandled(mimeType))
            {
                return(true);
            }

            return(XmlFileAssociationManager.IsXmlFileName(fileName));
        }
Ejemplo n.º 4
0
        public static XmlSchemaCompletionData GetSchemaCompletionDataForFileName(string filename)
        {
            var association = XmlFileAssociationManager.GetAssociationForFileName(filename);

            if (association == null || association.NamespaceUri.Length == 0)
            {
                return(null);
            }
            var u = new Uri(association.NamespaceUri);

            if (u.IsFile)
            {
                return(ReadLocalSchema(u));
            }
            else
            {
                return(SchemaCompletionDataItems [association.NamespaceUri]);
            }
        }
        public bool PreferLegacyEditor(FileDescriptor modelDescriptor)
        {
            var mimeType = modelDescriptor.MimeType;

            if (string.IsNullOrEmpty(mimeType))
            {
                mimeType = MimeTypeCatalog.Instance.FindMimeTypeForFile(modelDescriptor.FilePath)?.Id;
            }

            if (!string.IsNullOrEmpty(mimeType) && MimeTypeCatalog.Instance.GetMimeTypeIsSubtype(
                    mimeType,
                    MimeTypeCatalog.ApplicationXml))
            {
                return(true);
            }


            return(XmlFileAssociationManager.GetAssociationForFileName(modelDescriptor.FilePath) != null);
        }