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