SimplifyBooleanExpressionFix (PsiElement element, boolean value) { if (!(element instanceof PsiExpression expression)) return null; if (PsiTreeUtil.findChildOfType(element, PsiAssignmentExpression.class) != null) return null; while (element.getParent() instanceof PsiExpression) { element = element.getParent(); } final SimplifyBooleanExpressionFix fix = new SimplifyBooleanExpressionFix(expression, value); // simplify intention already active if (!fix.isAvailable(expression) || (SimplifyBooleanExpressionFix.canBeSimplified((PsiExpression)element) && expression instanceof PsiLiteralExpression)) { return null; } return fix; }