Skip to content

Commit df7550c

Browse files
Merge pull request #364 from Checkmarx/feature/secrets_realtime
- Fixed CxFinding window issue-AST-107870
2 parents 33d0f5f + 109acc6 commit df7550c

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/main/java/com/checkmarx/intellij/devassist/ui/findings/window/CxFindingsWindow.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@
6666
* Uses a timer to periodically update the tab title with the current problem count.
6767
* Refactored to have separate drawAuthPanel() and drawMainPanel() following pattern in CxToolWindowPanel.
6868
*/
69-
public class CxFindingsWindow extends SimpleToolWindowPanel
70-
implements Disposable {
69+
public class CxFindingsWindow extends SimpleToolWindowPanel implements Disposable {
7170

7271
private static final Logger LOGGER = Utils.getLogger(CxFindingsWindow.class);
7372

@@ -151,7 +150,7 @@ public void mouseReleased(MouseEvent e) {
151150
// Trigger initial refresh with existing scan results if any (on EDT)
152151
SwingUtilities.invokeLater(() -> {
153152
Map<String, List<ScanIssue>> existingIssues = ProblemHolderService.getInstance(project).getAllIssues();
154-
if (existingIssues != null && !existingIssues.isEmpty()) {
153+
if (!existingIssues.isEmpty()) {
155154
triggerRefreshTree();
156155
}
157156
});
@@ -219,12 +218,11 @@ private void drawMainPanel() {
219218
*/
220219
private void triggerRefreshTree() {
221220
Map<String, List<ScanIssue>> allIssues = ProblemHolderService.getInstance(project).getAllIssues();
222-
if (allIssues == null) {
221+
if (allIssues.isEmpty()) {
223222
return;
224223
}
225224

226225
Set<Filterable> activeFilters = VulnerabilityFilterState.getInstance().getFilters();
227-
228226
Map<String, List<ScanIssue>> filteredIssues = new HashMap<>();
229227

230228
for (Map.Entry<String, List<ScanIssue>> entry : allIssues.entrySet()) {
@@ -270,6 +268,18 @@ public void refreshTree(Map<String, List<ScanIssue>> issues) {
270268
})
271269
.collect(Collectors.toList());
272270

271+
ApplicationManager.getApplication().runReadAction(() ->
272+
createFileNode(filePath, filteredScanDetails, fileName));
273+
}
274+
((DefaultTreeModel) tree.getModel()).reload();
275+
expandNodesByFilePath();
276+
}
277+
278+
/**
279+
* Creating file node
280+
*/
281+
private void createFileNode(String filePath, List<ScanIssue> filteredScanDetails, String fileName) {
282+
try {
273283
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath);
274284
Icon icon = virtualFile != null ? virtualFile.getFileType().getIcon() : null;
275285
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
@@ -295,12 +305,10 @@ public void refreshTree(Map<String, List<ScanIssue>> issues) {
295305
for (ScanIssue detail : filteredScanDetails) {
296306
fileNode.add(new DefaultMutableTreeNode(new ScanDetailWithPath(detail, filePath)));
297307
}
298-
299308
rootNode.add(fileNode);
309+
} catch (Exception e) {
310+
LOGGER.warn("Failed to create file node for file: " + filePath, e);
300311
}
301-
((DefaultTreeModel) tree.getModel()).reload();
302-
303-
expandNodesByFilePath();
304312
}
305313

306314
/**

0 commit comments

Comments
 (0)