void (@NotNull PsiElement andElement, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { GrBinaryExpression binaryExpression = (GrBinaryExpression) andElement.getParent(); GrIfStatement ifStatement = (GrIfStatement) binaryExpression.getParent(); GrExpression leftOperand = binaryExpression.getLeftOperand(); GrExpression rightOperand = binaryExpression.getRightOperand(); GrStatement thenBranch = ifStatement.getThenBranch(); assert thenBranch != null; assert rightOperand != null; GrStatement newSplittedIfs = GroovyPsiElementFactory.getInstance(context.project()) .createStatementFromText( "if(" + leftOperand.getText() + ") { \n" + " if(" + rightOperand.getText() + ")" + thenBranch.getText() + "\n" + "}" ); ifStatement.replaceWithStatement(newSplittedIfs); }