void (@NotNull ActionContext context, @NotNull PsiJavaToken token, @NotNull ModPsiUpdater updater) { LOG.assertTrue(token.getTokenType() == JavaTokenType.ANDAND || token.getTokenType() == JavaTokenType.OROR); PsiPolyadicExpression expression = (PsiPolyadicExpression)token.getParent(); PsiIfStatement ifStatement = PsiTreeUtil.getParentOfType(expression, PsiIfStatement.class); if (ifStatement == null) return; PsiExpression condition = ifStatement.getCondition(); LOG.assertTrue(PsiTreeUtil.isAncestor(condition, expression, false)); CommentTracker ct = new CommentTracker(); PsiExpression lOperand = getLOperands(expression, token, ct); PsiExpression rOperand = getROperands(expression, token, ct); PsiElementFactory factory = JavaPsiFacade.getElementFactory(expression.getProject()); PsiIfStatement replacement = SplitConditionUtil.create(factory, ifStatement, lOperand, rOperand, token.getTokenType(), ct); if (replacement == null) return; PsiElement result = ct.replaceAndRestoreComments(ifStatement, replacement); result = CodeStyleManager.getInstance(context.project()).reformat(result); if (result instanceof PsiIfStatement resultingIf) { PsiExpression resultCondition = resultingIf.getCondition(); if (resultCondition != null) { updater.moveTo(resultCondition); } } }