mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IDEA-355836 Create new Java class / new Kotlin class actions should not be available on the top project level
on-demand source root creation restricted to general modules only (cherry picked from commit 9fd1dc32b8888c70af9b384b41cd6e56d752933e) IJ-CR-162668 GitOrigin-RevId: c0d30403b109597d94293a319f104197dab060cd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
da9f0d478e
commit
737852c635
@@ -9,7 +9,9 @@ import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.module.GeneralModuleType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -150,7 +152,9 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
|
||||
private static boolean noSourceRootConfigured(VirtualFile file, ProjectFileIndex index) {
|
||||
Module module = index.getModuleForFile(file);
|
||||
return module != null && ModuleRootManager.getInstance(module).getSourceRoots().length == 0;
|
||||
return module != null &&
|
||||
ModuleType.get(module) instanceof GeneralModuleType &&
|
||||
ModuleRootManager.getInstance(module).getSourceRoots().length == 0;
|
||||
}
|
||||
|
||||
protected abstract boolean checkPackageExists(PsiDirectory directory);
|
||||
|
||||
Reference in New Issue
Block a user