boolean (@NotNull PsiElement element) { if (!(element instanceof GrIfStatement ifStatement)) { return false; } if (ErrorUtil.containsError(ifStatement)) { return false; } GrStatement thenBranch = ifStatement.getThenBranch(); if (thenBranch == null) { return false; } thenBranch = ConditionalUtils.stripBraces(thenBranch); if (!(thenBranch instanceof GrIfStatement childIfStatement)) { return false; } GrStatement elseBranch = ifStatement.getElseBranch(); if (elseBranch != null) { elseBranch = ConditionalUtils.stripBraces(elseBranch); if (elseBranch != null) { return false; } } return childIfStatement.getElseBranch() == null; }