PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { PsiElement parent = element.getParent(); if (!(parent instanceof GrIfStatement)) return false; if (((GrIfStatement)parent).getCondition() == null) return false; if (!"if".equals(element.getText())) return false; return true; } }; }