private void updateRightTreeModel() { Set<PsiFile> deps = new HashSet<PsiFile>(); Set<PsiFile> scope = getSelectedScope(myLeftTree); myIllegalsInRightTree = new HashSet<PsiFile>(); for (PsiFile psiFile : scope) { Map<DependencyRule, Set<PsiFile>> illegalDeps = myIllegalDependencies.get(psiFile); if (illegalDeps != null) { for (final DependencyRule rule : illegalDeps.keySet()) { myIllegalsInRightTree.addAll(illegalDeps.get(rule)); } } final Set<PsiFile> psiFiles = myDependencies.get(psiFile); if (psiFiles != null) { for (PsiFile file : psiFiles) { if (file != null && file.isValid()) { deps.add(file); } } } } deps.removeAll(scope); myRightTreeExpansionMonitor.freeze(); myRightTree.setModel(buildTreeModel(deps, myRightTreeMarker)); myRightTreeExpansionMonitor.restore(); expandFirstLevel(myRightTree); }
@Nullable private AnalysisScope getScope() { final Set<PsiFile> selectedScope = getSelectedScope(myRightTree); Set<PsiFile> result = new HashSet<PsiFile>(); ((PackageDependenciesNode) myLeftTree.getModel().getRoot()) .fillFiles(result, !mySettings.UI_FLATTEN_PACKAGES); selectedScope.removeAll(result); if (selectedScope.isEmpty()) return null; List<VirtualFile> files = new ArrayList<VirtualFile>(); final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex(); for (PsiFile psiFile : selectedScope) { final VirtualFile file = psiFile.getVirtualFile(); LOG.assertTrue(file != null); if (fileIndex.isInContent(file)) { files.add(file); } } if (!files.isEmpty()) { return new AnalysisScope(myProject, files); } return null; }