boolean (ASTNode statement, ASTNode astNode) { ASTNode iterated = BasicJavaAstTreeUtil.getForEachIteratedValue(statement); ASTNode parameter = BasicJavaAstTreeUtil.getForEachIterationParameter(statement); PsiElement iteratedElement = BasicJavaAstTreeUtil.toPsi(iterated); PsiElement parameterElement = BasicJavaAstTreeUtil.toPsi(parameter); PsiElement element = BasicJavaAstTreeUtil.toPsi(astNode); return element != null && (PsiTreeUtil.isAncestor(iteratedElement, element, false) || PsiTreeUtil.isAncestor(parameterElement, element, false)); }