TreeModel (final Set<? extends PsiFile> files, boolean showProgress) { if (files.size() == 1) { myShowFiles = true; } Runnable buildingRunnable = () -> { for (final PsiFile file : files) { if (file != null) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile != null) { buildFileNode(virtualFile, null); } } } }; if (showProgress) { final String title = CodeInsightBundle.message("package.dependencies.build.process.title"); ProgressManager.getInstance().runProcessWithProgressSynchronously(buildingRunnable, title, false, myProject); } else { buildingRunnable.run(); } TreeUtil.sortRecursively(myRoot, new DependencyNodeComparator()); return new TreeModel(myRoot, myTotalFileCount, myMarkedFileCount); }