Skip to content

Commit 7100eca

Browse files
author
elchananarb
committed
update also in project 2
1 parent 47bdb52 commit 7100eca

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

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

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,11 @@ public void selectionChanged(SelectionChangedEvent event) {
762762
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
763763

764764
if (selection.size() > 0) {
765-
766765
Project selectedProject = ((Project) selection.getFirstElement());
767766

768-
769-
// Check if selected branch exists in currentBranches
767+
// Check if selected project exists in currentProjects
770768
if (!currentProjects.contains(selectedProject)) {
771-
// Invalid branch - reset to default text and disable scan button
769+
// Invalid project - reset to default text and disable scan button
772770
PluginUtils.setTextForComboViewer(projectComboViewer, PROJECT_COMBO_VIEWER_TEXT);
773771
updateStartScanButton(false);
774772
return;
@@ -777,14 +775,12 @@ public void selectionChanged(SelectionChangedEvent event) {
777775
// Avoid non-sense trigger changed when opening the combo
778776
if (selectedProject.getId().equals(currentProjectId)) {
779777
CxLogger.info(PluginConstants.INFO_CHANGE_PROJECT_EVENT_NOT_TRIGGERED);
780-
781778
return;
782779
}
783780

784781
onProjectChangePluginLoading(selectedProject.getId());
785782

786783
Job job = new Job("Checkmarx: Loading branches...") {
787-
788784
@Override
789785
protected IStatus run(IProgressMonitor arg0) {
790786
currentBranches = DataProvider.getInstance().getBranchesForProject(selectedProject.getId());
@@ -801,15 +797,29 @@ protected IStatus run(IProgressMonitor arg0) {
801797
});
802798
return Status.OK_STATUS;
803799
}
804-
805800
};
806801
job.schedule();
807-
808802
}
809803
}
810804
});
811-
}
812805

806+
// Add ModifyListener to handle manual text input for projects
807+
projectComboViewer.getCombo().addModifyListener(e -> {
808+
String enteredProject = projectComboViewer.getCombo().getText();
809+
810+
// Check if text was modified and project doesn't exist
811+
boolean projectExists = currentProjects.stream()
812+
.anyMatch(p -> p.getName().equals(enteredProject));
813+
814+
if (!projectExists) {
815+
updateStartScanButton(false); // Disable scan button
816+
} else {
817+
// Only enable if we also have a valid branch
818+
boolean validBranch = !currentBranch.isEmpty() && currentBranches.contains(currentBranch);
819+
updateStartScanButton(validBranch);
820+
}
821+
});
822+
}
813823
/**
814824
* Update state variables and make plugin fields loading when project changes
815825
*

0 commit comments

Comments
 (0)