void (final Project project, final Consumer<? super Pair<SimpleMatch, PsiElement>> replacer, final Pair<SimpleMatch, PsiElement> replacement) { CommandProcessor.getInstance() .executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> replacer.consume(replacement)), RefactoringBundle.message("extract.method.replace.duplicate.command.name"), null); }