void (@NotNull AnActionEvent e) { DataContext dataContext = e.getDataContext(); Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) { return; } Editor editor = dataContext.getData(CommonDataKeys.EDITOR); if (editor != null && InplaceRefactoringContinuation.tryResumeInplaceContinuation(project, editor, RenameElementAction.class)) { return; } if (!PsiDocumentManager.getInstance(project).commitAllDocumentsUnderProgress()) { return; } List<Renamer> renamers; try (var ignored = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { renamers = getAvailableRenamers(dataContext).collect(Collectors.toList()); } if (renamers.isEmpty()) { String message = RefactoringBundle.getCannotRefactorMessage( RefactoringBundle.message("error.wrong.caret.position.symbol.to.refactor") ); CommonRefactoringUtil.showErrorHint( project, e.getData(CommonDataKeys.EDITOR), message, RefactoringBundle.getCannotRefactorMessage(null), null ); } else if (renamers.size() == 1) { renamers.get(0).performRename(); } else { JBPopupFactory.getInstance() .createPopupChooserBuilder(renamers) .setTitle(RefactoringBundle.message("what.would.you.like.to.do")) .setRenderer(new RenamerRenderer()) .setItemChosenCallback(Renamer::performRename) .createPopup() .showInBestPositionFor(dataContext); } }