Search in sources :

Example 56 with XmlDocument

use of com.intellij.psi.xml.XmlDocument in project intellij-plugins by JetBrains.

the class FlexSchemaHandler method getIllegalNamespaces.

private static Collection<String> getIllegalNamespaces(final XmlFile file) {
    final XmlDocument document = file.getDocument();
    final XmlTag rootTag = document == null ? null : document.getRootTag();
    final String[] knownNamespaces = rootTag == null ? null : rootTag.knownNamespaces();
    final Collection<String> illegalNamespaces = new ArrayList<>();
    if (knownNamespaces != null) {
        if (ArrayUtil.contains(JavaScriptSupportLoader.MXML_URI, knownNamespaces)) {
            ContainerUtil.addAll(illegalNamespaces, MxmlJSClass.FLEX_4_NAMESPACES);
        } else if (ArrayUtil.contains(JavaScriptSupportLoader.MXML_URI3, knownNamespaces)) {
            illegalNamespaces.add(JavaScriptSupportLoader.MXML_URI);
        }
    }
    return illegalNamespaces;
}
Also used : ArrayList(java.util.ArrayList) XmlDocument(com.intellij.psi.xml.XmlDocument) XmlTag(com.intellij.psi.xml.XmlTag)

Example 57 with XmlDocument

use of com.intellij.psi.xml.XmlDocument in project intellij-plugins by JetBrains.

the class Struts2GlobalVariableProvider method installTaglibSupport.

private static void installTaglibSupport(@NotNull final List<FtlVariable> result, @NotNull final Module module, @NotNull @NonNls final String taglibUri, @NotNull @NonNls final String taglibPrefix) {
    final XmlFile xmlFile = JspManager.getInstance(module.getProject()).getTldFileByUri(taglibUri, module, null);
    if (xmlFile == null) {
        return;
    }
    final XmlDocument document = xmlFile.getDocument();
    if (document == null) {
        return;
    }
    final XmlNSDescriptor descriptor = (XmlNSDescriptor) document.getMetaData();
    if (descriptor == null) {
        return;
    }
    PsiElement declaration = descriptor.getDeclaration();
    if (declaration == null) {
        declaration = xmlFile;
    }
    result.add(new MyFtlLightVariable(taglibPrefix, declaration, new FtlXmlNamespaceType(descriptor)));
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) XmlNSDescriptor(com.intellij.xml.XmlNSDescriptor) XmlDocument(com.intellij.psi.xml.XmlDocument) FtlXmlNamespaceType(com.intellij.freemarker.psi.files.FtlXmlNamespaceType)

Aggregations

XmlDocument (com.intellij.psi.xml.XmlDocument)57 XmlTag (com.intellij.psi.xml.XmlTag)39 XmlFile (com.intellij.psi.xml.XmlFile)32 PsiElement (com.intellij.psi.PsiElement)13 Nullable (org.jetbrains.annotations.Nullable)11 XmlNSDescriptor (com.intellij.xml.XmlNSDescriptor)9 PsiFile (com.intellij.psi.PsiFile)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 ArrayList (java.util.ArrayList)6 XmlAttribute (com.intellij.psi.xml.XmlAttribute)5 PsiMetaData (com.intellij.psi.meta.PsiMetaData)4 IncorrectOperationException (com.intellij.util.IncorrectOperationException)4 NotNull (org.jetbrains.annotations.NotNull)4 Project (com.intellij.openapi.project.Project)3 XmlText (com.intellij.psi.xml.XmlText)3 XmlElementDescriptor (com.intellij.xml.XmlElementDescriptor)3 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)2 Editor (com.intellij.openapi.editor.Editor)2 PsiErrorElement (com.intellij.psi.PsiErrorElement)2 FilterElementProcessor (com.intellij.psi.scope.processor.FilterElementProcessor)2