VirtualFile (@NotNull Project project, @Nullable Module selectedModule) { Module[] modules = selectedModule != null ? new Module[] {selectedModule} : ModuleManager.getInstance(project).getModules(); VirtualFile resourceRoot = null; VirtualFile sourceRoot = null; for (Module module : modules) { if (resourceRoot == null) { resourceRoot = ContainerUtil.getFirstItem(ModuleRootManager.getInstance(module).getSourceRoots(JavaResourceRootType.RESOURCE)); } if (ArtifactUtil.areResourceFilesFromSourceRootsCopiedToOutput(module) && sourceRoot == null) sourceRoot = ContainerUtil.getFirstItem(ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.SOURCE)); } if (resourceRoot != null) return resourceRoot; if (sourceRoot != null) return sourceRoot; return suggestBaseDir(project, null); }