void (@NotNull final InitialInfo initialInfo, @Nullable final Editor editor) { final PsiClass owner = PsiUtil.getContextClass(initialInfo.getContext()); LOG.assertTrue(owner!=null); final ExtractMethodInfoHelper helper = getSettings(initialInfo, owner); if (helper == null) return; CommandProcessor.getInstance().executeCommand(helper.getProject(), () -> WriteAction.run(() -> { createMethod(helper, owner); GrStatementOwner declarationOwner = helper.getStringPartInfo() == null ? GroovyRefactoringUtil.getDeclarationOwner(helper.getStatements()[0]) : null; GrStatement realStatement = ExtractUtil.replaceStatement(declarationOwner, helper); // move to offset if (editor != null) { PsiDocumentManager.getInstance(helper.getProject()).commitDocument(editor.getDocument()); editor.getSelectionModel().removeSelection(); editor.getCaretModel().moveToOffset(ExtractUtil.getCaretOffset(realStatement)); } }), getRefactoringName(), null); }