void (@NotNull AnActionEvent e) { final Editor editor = getEditor(e); final PsiFile file = getPsiFile(e); if (editor == null || file == null) return; final List<T> expressions = getElement(editor, file); T first = ContainerUtil.getFirstItem(expressions); if (expressions.size() > 1) { IntroduceTargetChooser.showChooser( editor, expressions, new Pass<>() { @Override public void pass(@NotNull T expression) { performOnElement(editor, expression); } }, expression -> expression.getText() ); } else if (expressions.size() == 1 && first != null) { performOnElement(editor, first); } else if (expressions.isEmpty()) { showError(editor); } }