boolean (AnActionEvent e) { final DataContext context = e.getDataContext(); final Project project = e.getProject(); if (project == null) { return false; } if (!CopyrightManager.getInstance(project).hasAnyCopyrights()) { return false; } final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(context); final Editor editor = CommonDataKeys.EDITOR.getData(context); if (editor != null) { final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); return FileTypeUtil.isSupportedFile(file); } if (files != null && areFiles(files)) { boolean copyrightEnabled = false; for (VirtualFile vfile : files) { if (vfile != null && FileTypeUtil.isSupportedFile(vfile)) { copyrightEnabled = true; break; } } return copyrightEnabled; } if ((files == null || files.length != 1) && LangDataKeys.MODULE_CONTEXT.getData(context) == null && LangDataKeys.MODULE_CONTEXT_ARRAY.getData(context) == null && PlatformCoreDataKeys.PROJECT_CONTEXT.getData(context) == null) { final PsiElement[] elems = LangDataKeys.PSI_ELEMENT_ARRAY.getData(context); if (elems != null) { boolean copyrightEnabled = false; for (PsiElement elem : elems) { if (!(elem instanceof PsiDirectory)) { final PsiFile file = elem.getContainingFile(); if (file == null || !FileTypeUtil.isSupportedFile(file.getVirtualFile())) { copyrightEnabled = true; break; } } } return copyrightEnabled; } } return true; }