void (@NotNull ActionContext context, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiIfStatement ifStatement = PsiTreeUtil.getParentOfType(element, PsiIfStatement.class); LOG.assertTrue(ifStatement != null); PsiElement block = findCodeBlock(ifStatement); LOG.assertTrue(block != null); ControlFlow controlFlow = buildControlFlow(block); ifStatement = setupBranches(ifStatement, controlFlow); if (!ifStatement.isValid()) return; PsiExpression condition = Objects.requireNonNull(ifStatement.getCondition()); final CommentTracker tracker = new CommentTracker(); final String negatedCondition = BoolUtils.getNegatedExpressionText(condition, tracker); tracker.replaceAndRestoreComments(condition, negatedCondition); formatIf(ifStatement); }