Skip to content

Commit 6330783

Browse files
Fix AST-137779: Do not auto-load results on scan completion
Previously, two syncExec blocks fired when a scan completed: the first auto-loaded results immediately (causing a 'no results' flash and bypassing the notification), and the second showed the notification popup whose 'Load Results' button would load a second time. Merged into a single syncExec that: refreshes the scan list, marks the new scan ID as latest in preferences, and shows the notification. Results are now only loaded when the user explicitly clicks 'Load Results'. If the notification is closed or ignored the current results remain visible and the new scan ID is still available in the scan list as latest. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 58aa636 commit 6330783

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/actions/ActionStartScan.java

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -334,30 +334,19 @@ private Runnable pollingScan(String scanId) {
334334
startScanAction.setEnabled(true);
335335

336336
if (scan.getStatus().toLowerCase(Locale.ROOT).equals(PluginConstants.CX_SCAN_COMPLETED_STATUS)) {
337-
// Automatically update UI with new scan result
338337
Display.getDefault().syncExec(new Runnable() {
338+
AbstractNotificationPopup notification;
339+
339340
@Override
340341
public void run() {
341-
// Fetch the latest scan list for the branch
342+
// Refresh the scan list and mark the new scan as latest —
343+
// but do NOT auto-load results or change the current view.
342344
List<Scan> scanList = DataProvider.getInstance().getScansForProject(branchesCombo.getCombo().getText());
343-
// Set the new scan as latest by updating preferences
344345
GlobalSettings.storeInPreferences("LATEST_SCAN_ID", scanId);
345-
// Set the scan list in the combo viewer
346-
scansCombo.setInput(scanList);
347-
// Set the new scan as selected
348-
scansCombo.getCombo().setText(scanId);
349-
// Post event to load results for the new scan
350-
pluginEventBus.post(new PluginListenerDefinition(
351-
PluginListenerType.LOAD_RESULTS_FOR_SCAN,
352-
Collections.emptyList()));
353-
}
354-
});
355-
// Show notification as before
356-
Display.getDefault().syncExec(new Runnable() {
357-
AbstractNotificationPopup notification;
346+
scansCombo.setInput(scanList);
358347

359-
@Override
360-
public void run() {
348+
// Show notification. Results only load when the user explicitly
349+
// clicks "Load Results"; closing/ignoring leaves the current view intact.
361350
notification = new NotificationPopUpUI(Display.getCurrent(),
362351
PluginConstants.CX_SCAN_FINISHED_TITLE,
363352
PluginConstants.CX_SCAN_FINISHED_DESCRIPTION, null,
@@ -366,12 +355,11 @@ PluginConstants.CX_LOAD_SCAN_RESULTS, new SelectionAdapter() {
366355
public void widgetSelected(SelectionEvent e) {
367356
scansCombo.getCombo().setText(scanId);
368357
pluginEventBus.post(new PluginListenerDefinition(
369-
PluginListenerType.LOAD_RESULTS_FOR_SCAN,
370-
Collections.emptyList()));
358+
PluginListenerType.LOAD_RESULTS_FOR_SCAN,
359+
Collections.emptyList()));
371360
notification.close();
372361
}
373362
});
374-
375363
notification.setDelayClose(100000000);
376364
notification.open();
377365
}

0 commit comments

Comments
 (0)