diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java b/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java index 73cf99808862..e379a4282622 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java @@ -145,12 +145,13 @@ public abstract class CreateTemplateInPackageAction extend public static boolean isInContentRoot(VirtualFile file, ProjectFileIndex index) { return file.equals(index.getContentRootForFile(file)) && - moduleHasNoSourceRoots(file, index); + projectHasNoSourceRoots(file, index); } - private static boolean moduleHasNoSourceRoots(VirtualFile file, ProjectFileIndex index) { + private static boolean projectHasNoSourceRoots(VirtualFile file, ProjectFileIndex index) { Module module = index.getModuleForFile(file); - return module != null && ModuleRootManager.getInstance(module).getSourceRoots().length == 0; + return module != null && ModuleRootManager.getInstance(module).getSourceRoots().length == 0 && + ProjectRootManager.getInstance(module.getProject()).getContentSourceRoots().length == 0; } protected abstract boolean checkPackageExists(PsiDirectory directory);