Search in sources :

Example 6 with FilterElementProcessor

use of com.intellij.psi.scope.processor.FilterElementProcessor in project intellij-community by JetBrains.

the class XmlEnumeratedTypeImpl method getEnumeratedValues.

@Override
public XmlElement[] getEnumeratedValues() {
    final List<XmlElement> result = new ArrayList<>();
    processElements(new FilterElementProcessor(new XmlTokenTypeFilter(XmlTokenType.XML_NAME), result), this);
    return result.toArray(new XmlElement[result.size()]);
}
Also used : FilterElementProcessor(com.intellij.psi.scope.processor.FilterElementProcessor) XmlTokenTypeFilter(com.intellij.psi.filters.position.XmlTokenTypeFilter) ArrayList(java.util.ArrayList) XmlElement(com.intellij.psi.xml.XmlElement)

Example 7 with FilterElementProcessor

use of com.intellij.psi.scope.processor.FilterElementProcessor in project intellij-community by JetBrains.

the class XmlAttlistDeclImpl method getAttributeDecls.

@Override
public XmlAttributeDecl[] getAttributeDecls() {
    final List<XmlAttributeDecl> result = new ArrayList<>();
    processElements(new FilterElementProcessor(new ClassFilter(XmlAttributeDecl.class), result) {

        @Override
        public boolean execute(@NotNull final PsiElement element) {
            if (element instanceof XmlAttributeDecl) {
                if (element.getNextSibling() == null && element.getChildren().length == 1) {
                    return true;
                }
                return super.execute(element);
            }
            return true;
        }
    }, this);
    return result.toArray(new XmlAttributeDecl[result.size()]);
}
Also used : FilterElementProcessor(com.intellij.psi.scope.processor.FilterElementProcessor) ClassFilter(com.intellij.psi.filters.ClassFilter) ArrayList(java.util.ArrayList) PsiElement(com.intellij.psi.PsiElement)

Aggregations

FilterElementProcessor (com.intellij.psi.scope.processor.FilterElementProcessor)7 ArrayList (java.util.ArrayList)4 ClassFilter (com.intellij.psi.filters.ClassFilter)3 PsiElement (com.intellij.psi.PsiElement)2 XmlDocument (com.intellij.psi.xml.XmlDocument)2 XmlFile (com.intellij.psi.xml.XmlFile)2 XmlTag (com.intellij.psi.xml.XmlTag)2 NotNull (org.jetbrains.annotations.NotNull)2 PsiFile (com.intellij.psi.PsiFile)1 XmlTokenTypeFilter (com.intellij.psi.filters.position.XmlTokenTypeFilter)1 XmlElement (com.intellij.psi.xml.XmlElement)1 SmartList (com.intellij.util.SmartList)1 XmlElementDescriptor (com.intellij.xml.XmlElementDescriptor)1 THashSet (gnu.trove.THashSet)1 Collection (java.util.Collection)1