diff --git a/src/main/java/org/sonarlint/intellij/analysis/OnTheFlyFindingsHolder.kt b/src/main/java/org/sonarlint/intellij/analysis/OnTheFlyFindingsHolder.kt index e8486d8ca..08a0642d1 100644 --- a/src/main/java/org/sonarlint/intellij/analysis/OnTheFlyFindingsHolder.kt +++ b/src/main/java/org/sonarlint/intellij/analysis/OnTheFlyFindingsHolder.kt @@ -120,6 +120,9 @@ class OnTheFlyFindingsHolder(private val project: Project) : FileEditorManagerLi currentSecurityHotspotsPerOpenFile.remove(file) // update only Security Hotspots, issues will be updated in reaction to selectionChanged updateSecurityHotspots() + if (currentIssuesPerOpenFile.isEmpty()) { + updateCurrentFileTab() + } } private fun updateSecurityHotspots() { diff --git a/src/main/java/org/sonarlint/intellij/ui/CurrentFilePanel.java b/src/main/java/org/sonarlint/intellij/ui/CurrentFilePanel.java index 113471f38..8c61af82c 100644 --- a/src/main/java/org/sonarlint/intellij/ui/CurrentFilePanel.java +++ b/src/main/java/org/sonarlint/intellij/ui/CurrentFilePanel.java @@ -41,6 +41,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import javax.swing.JScrollPane; @@ -209,13 +210,14 @@ public void trySelectFilteredIssue(@Nullable LiveIssue issue private void updateIcon(@Nullable VirtualFile file, Collection issues) { var toolWindow = ToolWindowManager.getInstance(project).getToolWindow(SONARLINT_TOOLWINDOW_ID); if (toolWindow != null) { - doUpdateIcon(file, issues, toolWindow); + var isEmpty = issues.stream().filter(i -> !i.isResolved()).collect(Collectors.toSet()).isEmpty(); + doUpdateIcon(file, isEmpty, toolWindow); } } - private static void doUpdateIcon(@Nullable VirtualFile file, Collection issues, ToolWindow toolWindow) { + private static void doUpdateIcon(@Nullable VirtualFile file, boolean isEmpty, ToolWindow toolWindow) { ApplicationManager.getApplication().assertIsDispatchThread(); - boolean empty = file == null || issues.isEmpty(); + boolean empty = file == null || isEmpty; toolWindow.setIcon(empty ? SonarLintIcons.SONARQUBE_FOR_INTELLIJ_EMPTY_TOOLWINDOW : SonarLintIcons.SONARQUBE_FOR_INTELLIJ_TOOLWINDOW); }