void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrIfStatement parentStatement = (GrIfStatement) element; final GrStatement elseBranch = parentStatement.getElseBranch(); GrIfStatement ifStatement = (GrIfStatement)parentStatement.copy(); GrBlockStatement blockStatement = GroovyPsiElementFactory.getInstance(context.project()) .createBlockStatementFromText("{\nabc()\n}", null); GrBlockStatement newBlock = ifStatement.replaceElseBranch(blockStatement); newBlock.getBlock().getStatements()[0].replace(elseBranch); parentStatement.replaceWithStatement(ifStatement); }