Skip to content

Commit 96c8dc4

Browse files
Resolved latest scan id not appeard
1 parent 0452dea commit 96c8dc4

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/CheckmarxView.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,10 @@ public void handleEvent(Event event) {
10961096
@Override
10971097
public String getText(Object element) {
10981098
if (element instanceof Scan) {
1099+
// Always fetch the latest scan id from preferences before rendering
1100+
if(!GlobalSettings.getFromPreferences("LATEST_SCAN_ID", "").isEmpty()) {
1101+
latestScanId = GlobalSettings.getFromPreferences("LATEST_SCAN_ID", "");
1102+
}
10991103
Scan scan = (Scan) element;
11001104
return formatScanLabel(scan);
11011105
}
@@ -2819,4 +2823,4 @@ private void preservCaretposition( List<Project> projectList, String searchText)
28192823
PluginUtils.setTextForComboViewer(projectComboViewer, searchText);
28202824
projectComboViewer.getCombo().setSelection(new Point(caretPos, caretPos));
28212825
}
2822-
}
2826+
}

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,25 @@ 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
338+
Display.getDefault().syncExec(new Runnable() {
339+
@Override
340+
public void run() {
341+
// Fetch the latest scan list for the branch
342+
List<Scan> scanList = DataProvider.getInstance().getScansForProject(branchesCombo.getCombo().getText());
343+
// Set the new scan as latest by updating preferences
344+
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
337356
Display.getDefault().syncExec(new Runnable() {
338357
AbstractNotificationPopup notification;
339358

@@ -347,8 +366,8 @@ PluginConstants.CX_LOAD_SCAN_RESULTS, new SelectionAdapter() {
347366
public void widgetSelected(SelectionEvent e) {
348367
scansCombo.getCombo().setText(scanId);
349368
pluginEventBus.post(new PluginListenerDefinition(
350-
PluginListenerType.LOAD_RESULTS_FOR_SCAN,
351-
Collections.emptyList()));
369+
PluginListenerType.LOAD_RESULTS_FOR_SCAN,
370+
Collections.emptyList()));
352371
notification.close();
353372
}
354373
});

0 commit comments

Comments
 (0)