void (final @NotNull AnActionEvent e) { Project project = e.getProject(); EditorSearchSession search = e.getData(EditorSearchSession.SESSION_KEY); Editor editor = search != null ? search.getEditor() : null; e.getPresentation().setIcon(getIcon(project)); e.getPresentation().setEnabled(editor != null && project != null && !project.isDisposed() && search.hasMatches() && PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()) != null); }