void () { List<DuplicateNode> enabledNodes = myTree.getModel().getEnabledDuplicates(); PsiElement[] pattern = getPatternElements(); if (pattern.length == 0) { // todo suggest re-running the refactoring CommonRefactoringUtil.showErrorHint(myProject, null, JavaRefactoringBundle.message("refactoring.extract.method.preview.failed"), ExtractMethodHandler.getRefactoringName(), HelpID.EXTRACT_METHOD); return; } JavaDuplicatesExtractMethodProcessor processor = new JavaDuplicatesExtractMethodProcessor(pattern, ExtractMethodHandler.getRefactoringName()); if (!processor.prepareFromSnapshot(mySnapshot, true)) { return; } WriteCommandAction.runWriteCommandAction(myProject, ExtractMethodHandler.getRefactoringName(), null, () -> doExtractImpl(processor, enabledNodes), pattern[0].getContainingFile()); }