Search in sources :

Example 6 with DomFixedChildDescription

use of com.intellij.util.xml.reflect.DomFixedChildDescription in project intellij-community by JetBrains.

the class DomImplUtil method getCustomSubTags.

public static List<XmlTag> getCustomSubTags(final DomInvocationHandler handler, final XmlTag[] subTags, final XmlFile file) {
    if (subTags.length == 0) {
        return Collections.emptyList();
    }
    final DomGenericInfoEx info = handler.getGenericInfo();
    final Set<XmlName> usedNames = new THashSet<>();
    List<? extends DomCollectionChildDescription> collectionChildrenDescriptions = info.getCollectionChildrenDescriptions();
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0, size = collectionChildrenDescriptions.size(); i < size; i++) {
        DomCollectionChildDescription description = collectionChildrenDescriptions.get(i);
        usedNames.add(description.getXmlName());
    }
    List<? extends DomFixedChildDescription> fixedChildrenDescriptions = info.getFixedChildrenDescriptions();
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0, size = fixedChildrenDescriptions.size(); i < size; i++) {
        DomFixedChildDescription description = fixedChildrenDescriptions.get(i);
        usedNames.add(description.getXmlName());
    }
    return ContainerUtil.findAll(subTags, tag -> {
        if (StringUtil.isEmpty(tag.getName()))
            return false;
        for (final XmlName name : usedNames) {
            if (isNameSuitable(name, tag, handler, file)) {
                return false;
            }
        }
        return true;
    });
}
Also used : DomCollectionChildDescription(com.intellij.util.xml.reflect.DomCollectionChildDescription) DomFixedChildDescription(com.intellij.util.xml.reflect.DomFixedChildDescription) THashSet(gnu.trove.THashSet)

Aggregations

DomFixedChildDescription (com.intellij.util.xml.reflect.DomFixedChildDescription)6 DomCollectionChildDescription (com.intellij.util.xml.reflect.DomCollectionChildDescription)5 XmlFile (com.intellij.psi.xml.XmlFile)2 XmlTag (com.intellij.psi.xml.XmlTag)2 NullableComputable (com.intellij.openapi.util.NullableComputable)1 RecursionGuard (com.intellij.openapi.util.RecursionGuard)1 PsiElement (com.intellij.psi.PsiElement)1 XmlElementType (com.intellij.psi.xml.XmlElementType)1 SimpleNode (com.intellij.ui.treeStructure.SimpleNode)1 DomElement (com.intellij.util.xml.DomElement)1 DomFileElement (com.intellij.util.xml.DomFileElement)1 EvaluatedXmlName (com.intellij.util.xml.EvaluatedXmlName)1 EvaluatedXmlNameImpl (com.intellij.util.xml.EvaluatedXmlNameImpl)1 GenericDomValue (com.intellij.util.xml.GenericDomValue)1 XmlName (com.intellij.util.xml.XmlName)1 DomElementAnnotationsManager (com.intellij.util.xml.highlighting.DomElementAnnotationsManager)1 AbstractDomChildrenDescription (com.intellij.util.xml.reflect.AbstractDomChildrenDescription)1 CustomDomChildrenDescription (com.intellij.util.xml.reflect.CustomDomChildrenDescription)1 DomGenericInfo (com.intellij.util.xml.reflect.DomGenericInfo)1 DomStub (com.intellij.util.xml.stubs.DomStub)1