in src/main/java/org/jetbrains/plugins/spotbugs/gui/toolwindow/view/ToolWindowPanel.java [228:290]
public void analysisFinished(@NotNull final FindBugsResult result, @Nullable final Throwable error) {
_bugTreePanel.setResult(result);
final Integer analyzedClassCount = result.getAnalyzedClassCount();
_bugTreePanel.updateRootNode(analyzedClassCount);
_bugTreePanel.getBugTree().validate();
final int numAnalysedClasses = analyzedClassCount != null ? analyzedClassCount : 0;
final StringBuilder message = new StringBuilder()
.append("Found ")
.append(_bugTreePanel.getGroupModel().getBugCount())
.append(" bugs in ")
.append(numAnalysedClasses)
.append(numAnalysedClasses > 1 ? " classes" : " class");
this.result = result;
final NotificationType notificationType;
if (numAnalysedClasses == 0) {
notificationType = NotificationType.WARNING;
message.append(" (no class files found <a href='").append(A_HREF_MORE_ANCHOR).append("'>more...</a>)<br/>");
} else {
notificationType = NotificationType.INFORMATION;
message.append(" <a href='").append(A_HREF_MORE_ANCHOR).append("'>more...</a><br/>");
}
message.append("<font size='10px'>using ").append(VersionManager.getFullVersion()).append(" with SpotBugs version ").append(FindBugsUtil.getFindBugsFullVersion()).append("</font><br/>");
if (error != null) {
final boolean findBugsError = FindBugsUtil.isFindBugsError(error);
final String impl;
if (findBugsError) {
impl = "SpotBugs";
} else {
impl = FindBugsPluginConstants.PLUGIN_NAME;
}
String errorText = "An " + impl + " error occurred.";
IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(_project);
final StatusBar statusBar = ideFrame == null ? null : ideFrame.getStatusBar();
final StatusBarWidget widget = statusBar == null ? null : statusBar.getWidget(IdeMessagePanel.FATAL_ERROR);
IdeMessagePanel ideMessagePanel = null; // openFatals like ErrorNotifier
if (widget instanceof IdeMessagePanel) {
ideMessagePanel = (IdeMessagePanel) widget;
errorText = "<a href='" + A_HREF_ERROR_ANCHOR + "'>" + errorText + "</a>";
}
message.append(String.format("%s The results of the analysis might be incomplete.", errorText));
LOGGER.error(error);
// use balloon because error should never disabled
BalloonTipFactory.showToolWindowErrorNotifier(_project, message.toString(), new BalloonErrorListenerImpl(ToolWindowPanel.this, result, ideMessagePanel));
} else {
NotificationGroupManager.getInstance()
.getNotificationGroup(NOTIFICATION_GROUP_ID_ANALYSIS_FINISHED)
.createNotification(
VersionManager.getName() + ": Analysis Finished", message.toString(), notificationType)
.setImportant(false)
.setListener(new NotificationListenerImpl(ToolWindowPanel.this, result))
.addAction(ActionManager.getInstance().getAction("SpotBugs.DisableNotificationAction"))
.notify(_project);
}
EditorFactory.getInstance().refreshAllEditors();
DaemonCodeAnalyzer.getInstance(_project).restart();
}