String (@NotNull PsiDirectory psiDirectory, boolean includeUrl, boolean includeRootType) { StringBuilder result = new StringBuilder(); final VirtualFile directory = psiDirectory.getVirtualFile(); if (ProjectRootsUtil.isLibraryRoot(directory, psiDirectory.getProject())) { result.append(ProjectBundle.message("module.paths.root.node", "library").toLowerCase(Locale.getDefault())); } else if (includeRootType) { SourceFolder sourceRoot = ProjectRootsUtil.getModuleSourceRoot(psiDirectory.getVirtualFile(), psiDirectory.getProject()); if (sourceRoot != null) { ModuleSourceRootEditHandler<?> handler = ModuleSourceRootEditHandler.getEditHandler(sourceRoot.getRootType()); if (handler != null) { JavaSourceRootProperties properties = sourceRoot.getJpsElement().getProperties(JavaModuleSourceRootTypes.SOURCES); if (properties != null && properties.isForGeneratedSources()) { result.append("generated "); } result.append(handler.getFullRootTypeName().toLowerCase(Locale.getDefault())); } } } if (includeUrl) { if (result.length() > 0) result.append(",").append(FontUtil.spaceAndThinSpace()); result.append(FileUtil.getLocationRelativeToUserHome(directory.getPresentableUrl())); } return result.length() == 0 ? null : result.toString(); }