Search in sources :

Example 1 with DocValuesIterator

use of com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator in project intellij-community by JetBrains.

the class JavaCompilingVisitor method visitDocTag.

@Override
public void visitDocTag(PsiDocTag psiDocTag) {
    super.visitDocTag(psiDocTag);
    NodeIterator sons = new DocValuesIterator(psiDocTag.getFirstChild());
    while (sons.hasNext()) {
        myCompilingVisitor.setHandler(sons.current(), new DocDataHandler());
        sons.advance();
    }
}
Also used : NodeIterator(com.intellij.dupLocator.iterators.NodeIterator) DocValuesIterator(com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator)

Example 2 with DocValuesIterator

use of com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator in project intellij-community by JetBrains.

the class JavaMatchingVisitor method visitDocTag.

@Override
public void visitDocTag(final PsiDocTag tag) {
    final PsiDocTag tag2 = (PsiDocTag) myMatchingVisitor.getElement();
    final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(tag.getNameElement());
    myMatchingVisitor.setResult(isTypedVar || tag.getName().equals(tag2.getName()));
    PsiElement psiDocTagValue = tag.getValueElement();
    boolean isTypedValue = false;
    if (myMatchingVisitor.getResult() && psiDocTagValue != null) {
        final PsiElement[] children = psiDocTagValue.getChildren();
        if (children.length == 1) {
            psiDocTagValue = children[0];
        }
        isTypedValue = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(psiDocTagValue);
        if (isTypedValue) {
            if (tag2.getValueElement() != null) {
                myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(psiDocTagValue, tag2.getValueElement()));
            } else {
                myMatchingVisitor.setResult(myMatchingVisitor.allowsAbsenceOfMatch(psiDocTagValue));
            }
        }
    }
    if (myMatchingVisitor.getResult() && !isTypedValue) {
        myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(new DocValuesIterator(tag.getFirstChild()), new DocValuesIterator(tag2.getFirstChild())));
    }
    if (myMatchingVisitor.getResult() && isTypedVar) {
        myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(tag.getNameElement(), tag2.getNameElement()));
    }
}
Also used : PsiDocTag(com.intellij.psi.javadoc.PsiDocTag) DocValuesIterator(com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator)

Aggregations

DocValuesIterator (com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator)2 NodeIterator (com.intellij.dupLocator.iterators.NodeIterator)1 PsiDocTag (com.intellij.psi.javadoc.PsiDocTag)1