private void calculateRoots() { final ModuleManager moduleManager = ModuleManager.getInstance(myProject); // assertion for read access inside final Module[] modules = ApplicationManager.getApplication() .runReadAction( new Computable<Module[]>() { public Module[] compute() { return moduleManager.getModules(); } }); final TreeSet<VirtualFile> checkSet = new TreeSet<VirtualFile>(FilePathComparator.getInstance()); myRoots = new HashSet<VirtualFile>(); myRoots.addAll(myInitialRoots); checkSet.addAll(myInitialRoots); for (Module module : modules) { final VirtualFile[] files = ModuleRootManager.getInstance(module).getContentRoots(); for (VirtualFile file : files) { final VirtualFile floor = checkSet.floor(file); if (floor != null) { myModulesSet.put(file, module.getName()); myRoots.add(file); } } } }
/** * Update the UI components to reflect the current per-file status. * * @param status The current node status. * @param novelty The per-file novelty flags. * @param offline The revision numbers of the offline checked-in versions. */ protected synchronized void updateNodeStatus( NodeStatus status, TreeMap<VersionID, TreeMap<FileSeq, boolean[]>> novelty, TreeSet<VersionID> offline) { super.updateNodeStatus(status, false); pNovelty = novelty; pOffline = offline; NodeDetailsLight details = null; if (pStatus != null) details = pStatus.getLightDetails(); /* files */ { pFileSeqsTab.removeAll(); pFileSeqsBox.removeAll(); pFileSeqPanels.clear(); if ((pNovelty != null) && (details != null)) { NodeMod mod = details.getWorkingVersion(); NodeVersion vsn = details.getLatestVersion(); NodeCommon com = null; if (mod != null) com = mod; else if (vsn != null) com = vsn; else assert (false); /* get the primary and unique secondary file sequences */ FileSeq primary = com.getPrimarySequence(); TreeSet<FileSeq> secondary = new TreeSet<FileSeq>(); { secondary.addAll(com.getSecondarySequences()); TreeSet<FileSeq> unique = new TreeSet<FileSeq>(); for (TreeMap<FileSeq, boolean[]> table : pNovelty.values()) unique.addAll(table.keySet()); for (FileSeq ufseq : unique) { boolean found = false; if (ufseq.similarTo(primary)) found = true; else { for (FileSeq fseq : secondary) { if (ufseq.similarTo(fseq)) { found = true; break; } } } if (!found) secondary.add(ufseq); } } /* add the file sequence UI components */ addFileSeqPanel(primary); for (FileSeq fseq : secondary) addFileSeqPanel(fseq); if (pIsListLayout) pFileSeqsBox.add(UIFactory.createFiller(sSize)); } } pFileSeqsTab.setVisible(!pIsListLayout); pFileSeqsScroll.setVisible(pIsListLayout); if (pIsListLayout) pFileSeqsScroll.revalidate(); else pFileSeqsTab.revalidate(); }