void ( PsiDirectory @NotNull [] directories, @Nullable PsiDirectory defaultSelection, @NotNull Project project, @Nullable String postfixToShow, @Nullable Map<PsiDirectory,String> postfixes ) { ProgressManager.getInstance().runProcessWithProgressSynchronously( () -> ReadAction.run(() -> fillItems(directories, postfixToShow, postfixes)), LangBundle.message("progress.title.validating"), true, project ); if (defaultSelection == null) { defaultSelection = getDefaultSelection(directories, project); if (defaultSelection == null && directories.length > 0) { defaultSelection = directories[0]; } } int selectionIndex = ArrayUtil.indexOf(directories, defaultSelection); if (selectionIndex < 0 && directories.length == 1) { selectionIndex = 0; } if (selectionIndex < 0) { // find source root corresponding to defaultSelection final PsiManager manager = PsiManager.getInstance(project); VirtualFile[] sourceRoots = ProjectRootManager.getInstance(project).getContentSourceRoots(); for (VirtualFile sourceRoot : sourceRoots) { if (sourceRoot.isDirectory()) { PsiDirectory directory = manager.findDirectory(sourceRoot); if (directory != null && isParent(defaultSelection, directory)) { defaultSelection = directory; break; } } } } updateView(defaultSelection, selectionIndex); }