private static void collectAllElements(ASTNode atCaret, List<? super ASTNode> res, boolean recurse) {
    res.add(0, atCaret);
    if (doNotStepInto(atCaret)) {
      if (!recurse) return;
      recurse = false;
    }

    final List<ASTNode> children = BasicJavaAstTreeUtil.getChildren(atCaret);
    for (ASTNode child : children) {
      if (BasicJavaAstTreeUtil.is(atCaret, STATEMENT_SET) &&
          BasicJavaAstTreeUtil.is(child, STATEMENT_SET) &&
          !(BasicJavaAstTreeUtil.is(atCaret, BASIC_FOR_STATEMENT)
            && child == (BasicJavaAstTreeUtil.getForInitialization(atCaret)))) {
        continue;
      }
      collectAllElements(child, res, recurse);
    }
  }
private static void collectAllElements(ASTNode atCaret, List<? super ASTNode> res, boolean recurse)