void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { GrConditionalExpression parentTernary = findTernary(element); GroovyPsiElementFactory groovyPsiElementFactory = GroovyPsiElementFactory.getInstance(context.project()); GrReturnStatement parentReturn = (GrReturnStatement)parentTernary.getParent(); String condition = parentTernary.getCondition().getText(); GrExpression thenBranch = parentTernary.getThenBranch(); String thenText = thenBranch != null ? thenBranch.getText() : ""; GrExpression elseBranch = parentTernary.getElseBranch(); String elseText = elseBranch != null ? elseBranch.getText() : ""; String text = "if (" + condition + ") { \nreturn " + thenText + "\n} else {\n return " + elseText + "\n}"; GrIfStatement ifStatement = (GrIfStatement)groovyPsiElementFactory.createStatementFromText(text); ifStatement = parentReturn.replaceWithStatement(ifStatement); updater.moveTo(ifStatement.getRParenth().getTextRange().getEndOffset()); }