boolean (PsiExpression qualifier) { if (!qualifier.isValid() || qualifier.getText() == null) { return false; } PsiStatement statement = PsiTreeUtil.getParentOfType(qualifier, PsiStatement.class); if (statement == null) return false; PsiElement parent = statement.getParent(); return !(parent instanceof PsiForStatement); }