Presentation (final AnActionEvent e) { final Presentation presentation = e.getPresentation(); final Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { Module module = e.getData(PlatformCoreDataKeys.MODULE); if (module == null) { Module[] modules = ModuleManager.getInstance(project).getModules(); module = modules.length == 0 ? null : modules [0]; } if (module != null) { final Sdk sdk = PythonSdkUtil.findPythonSdk(module); if (sdk != null) { final List<PyPackage> packages = PyPackageManager.getInstance(sdk).getPackages(); final PyPackage sphinx = packages != null ? PyPsiPackageUtil.findPackage(packages, "Sphinx") : null; presentation.setEnabled(sphinx != null); } } } return presentation; }