use of com.intellij.openapi.module.ModuleUtilCore in project intellij-community by JetBrains.
the class CreateModuleInfoAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
DataContext ctx = e.getDataContext();
boolean available = Optional.ofNullable(LangDataKeys.IDE_VIEW.getData(ctx)).map(view -> getTargetDirectory(ctx, view)).filter(PsiUtil::isLanguageLevel9OrHigher).map(ModuleUtilCore::findModuleForPsiElement).map(module -> FilenameIndex.getVirtualFilesByName(module.getProject(), MODULE_INFO_FILE, module.getModuleScope(false)).isEmpty()).orElse(false);
e.getPresentation().setEnabledAndVisible(available);
}
Aggregations