void (@NotNull AnActionEvent e) { Editor editor = e.getData(CommonDataKeys.EDITOR); PsiFile file = e.getData(CommonDataKeys.PSI_FILE); e.getPresentation().setEnabled(editor != null && file != null); }