void (@NotNull AnActionEvent e) { Project project = e.getProject(); Component c = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT); ScratchImplUtil.TextExtractor extractor = ScratchImplUtil.getTextExtractor(c); boolean isFileEditor = EditorUtil.isRealFileEditor(e.getData(CommonDataKeys.EDITOR)); e.getPresentation().setEnabled(project != null && extractor != null && !isFileEditor); }