void (@NotNull final Project project, final Editor editor, @NotNull final ExtractMethodObjectProcessor processor, @NotNull final ExtractMethodObjectProcessor.MyExtractMethodProcessor extractProcessor) { final RangeMarker marker; if (editor != null) { final int offset = editor.getCaretModel().getOffset(); marker = editor.getDocument().createRangeMarker(offset, offset); } else { marker = null; } CommandProcessor.getInstance().executeCommand(project, () -> doRefactoring(project, editor, processor, extractProcessor), JavaRefactoringBundle.message("extract.method.object"), JavaRefactoringBundle.message("extract.method.object")); if (editor != null) { editor.getCaretModel().moveToOffset(marker.getStartOffset()); marker.dispose(); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } }