void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabledAndVisible(false); return; } Editor editor = event.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE); presentation.setEnabledAndVisible(editor != null); }