SchemaType (Project project, VirtualFile... files) { if (files.length == 0) return null; final VirtualFile file = files[0]; final FileType type = file.getFileType(); if (type == XmlFileType.INSTANCE) { final PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (psiFile instanceof XmlFile) { final XmlDocument document = ((XmlFile)psiFile).getDocument(); if (document != null && document.getRootTag() != null) { final XmlTag rootTag = document.getRootTag(); assert rootTag != null; final String uri = rootTag.getNamespace(); if (RelaxNgMetaDataContributor.RNG_NAMESPACE.equals(uri) && files.length == 1) { return SchemaType.RNG; } } } if (files.length > 1) { for (VirtualFile virtualFile : files) { if (!FileTypeRegistry.getInstance().isFileOfType(virtualFile, XmlFileType.INSTANCE) || getInputType(project, virtualFile) != null) { return null; } } } return SchemaType.XML; } else if (type == DTDFileType.INSTANCE && files.length == 1) { return SchemaType.DTD; } else if (type == RncFileType.getInstance() && files.length == 1) { return SchemaType.RNC; } return null; }