in src/main/java/org/jetbrains/plugins/spotbugs/gui/toolwindow/view/BugTreePanel.java [315:349]
private void regroupTree() {
EventDispatchThreadHelper.checkEDT();
if (result != null) {
boolean cleared = false;
for (final Map.Entry<edu.umd.cs.findbugs.Project, SortedBugCollection> entry : result.getResults().entrySet()) {
Module module = null;
if (entry.getKey() instanceof FindBugsProject) {
module = ((FindBugsProject) entry.getKey()).getModule();
}
final Collection<BugInstance> instanceCollection = entry.getValue().getCollection();
if (instanceCollection != null && !instanceCollection.isEmpty()) {
if (!cleared) {
cleared = true;
_treeModel.clear();
}
for (final BugInstance bugInstance : instanceCollection) {
if (bugInstance != null) {
addNode(new Bug(
module,
entry.getValue(),
bugInstance
));
}
}
}
}
} else {
// may be a analysis is running, we need to regroup existing nodes
final Collection<Bug> existing = _treeModel.getBugs();
_treeModel.clear();
for (final Bug bug : existing) {
addNode(bug);
}
}
}