@@ -283,14 +283,15 @@ public void enableDelta() {
283283 String project = node .getText ().toString ();
284284 String projectPath = node .getPath ().toString ();
285285 String baseBranch = getBaseBranch (projectPath .toString ());
286+ String [] localBranches = getLocalBranches (projectPath ).toArray (String []::new );
286287
287288 item .setText (String .format ("Click to choose base branch for: %s [ current: %s ]" , project , baseBranch ));
288289
289290 Listener selectionListener = new Listener () {
290291 @ Override
291292 public void handleEvent (Event event ) {
292293 if (event .item == item ) {
293- showPopup (event .display , item );
294+ baseBranchDialog (event .display , projectPath , localBranches );
294295 }
295296 }
296297 };
@@ -303,25 +304,16 @@ public void handleEvent(Event event) {
303304 }
304305 }
305306
306- private void showPopup (Display display , TreeItem item ) {
307+ private void baseBranchDialog (Display display , String projectPath , String [] localBranches ) {
307308 Shell shell = new Shell (display , SWT .APPLICATION_MODAL | SWT .DIALOG_TRIM );
308309 shell .setText ("Choose base branch for net-new issues scanning" );
309310 shell .setLayout (new GridLayout (1 , false ));
310-
311- if (!(item .getData () instanceof ContentRootNode ))
312- return ;
313-
314- ContentRootNode node = (ContentRootNode ) item .getData ();
315- Path project = node .getPath ();
316-
317311 Label label = new Label (shell , SWT .NONE );
318- label .setText ("Base Branch for: " + project );
312+ label .setText ("Base Branch for: " + projectPath );
319313 label .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
320314
321- List <String > dropdownItems = getLocalBranches (project .toString ());
322-
323315 Combo dropdown = new Combo (shell , SWT .DROP_DOWN );
324- dropdown .setItems (dropdownItems . toArray ( new String [ 0 ]) );
316+ dropdown .setItems (localBranches );
325317 dropdown .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
326318
327319 Button okButton = new Button (shell , SWT .PUSH );
@@ -382,8 +374,11 @@ public void disableDelta() {
382374 TreeItem item = entry .getKey ();
383375 Listener listener = entry .getValue ();
384376
377+ ContentRootNode node = (ContentRootNode ) item .getData ();
378+ String project = node .getText ().toString ();
379+
385380 // Revert text to original
386- item .setText ("Project name" );
381+ item .setText (project );
387382
388383 // Remove listener from the item's parent
389384 item .getParent ().removeListener (SWT .Selection , listener );
0 commit comments