private static <T extends PsiElement>boolean processChildrenOfType(PsiElement element,Processor<T> processor,Class<T> psiClass,boolean reverseOrder){
  PsiElement child=reverseOrder ? element.getLastChild() : element.getFirstChild();
  while (child != null) {
    if (psiClass.isInstance(child)) {
      if (!processor.process((T)child)) {
        return true;
      }
    }
    if (processChildrenOfType(child,processor,psiClass,reverseOrder)) {
      return true;
    }
    child=reverseOrder ? child.getPrevSibling() : child.getNextSibling();
  }
  return false;
}

private static < T extends PsiElement > boolean processChildrenOfType ( PsiElement element , Processor < T > processor , Class < T > psiClass , boolean reverseOrder ) { PsiElement child = reverseOrder ? element . getLastChild ( ) : element . getFirstChild ( ) ; while ( child != null ) { if ( psiClass . isInstance ( child ) ) { if ( ! processor . process ( ( T ) child ) ) { return true ; } } if ( processChildrenOfType ( child , processor , psiClass , reverseOrder ) ) { return true ; } child = reverseOrder ? child . getPrevSibling ( ) : child . getNextSibling ( ) ; } return false ; }
walk through entire psi tree rooted at ' element ' , processing all children of the given type .
