Collection<Variant> (@NotNull PsiDirectory directory) { Project project = directory.getProject(); Module module = ProjectFileIndex.getInstance(project).getModuleForFile(directory.getVirtualFile()); if (module == null) return Collections.emptyList(); MavenProjectsManager mavenManager = MavenProjectsManager.getInstance(project); if (!mavenManager.isMavenizedModule(module)) return Collections.emptyList(); MavenProject mavenProject = mavenManager.findProject(module); if (mavenProject == null) return Collections.emptyList(); List<Variant> result = new ArrayList<>(); mavenProject.getSources().forEach(it -> result.add(new Variant(it, JavaSourceRootType.SOURCE))); mavenProject.getTestSources().forEach(it -> result.add(new Variant(it, JavaSourceRootType.TEST_SOURCE))); mavenProject.getResources().forEach(it -> result.add(new Variant(it.getDirectory(), JavaResourceRootType.RESOURCE))); mavenProject.getTestResources().forEach(it -> result.add(new Variant(it.getDirectory(), JavaResourceRootType.TEST_RESOURCE))); return result; }