mbien commented on PR #8650:
URL: https://github.com/apache/netbeans/pull/8650#issuecomment-3070831842

   > So you mean just disable the ok butten when the current checked out branch 
is selected?
   
   something like that yeah, although removing the current branch from the list 
might be easier since it wouldn't involve having to update the branch selector 
UI which is probably used in many places.
   
   not tested:
   
   action:
   ```java
           RepositoryInfo info = RepositoryInfo.getInstance(repository);
           HashMap<String, GitBranch> branches = new 
HashMap<>(info.getBranches());
           branches.remove(info.getActiveBranch().getName());
           
           if (branches.isEmpty()) {
               // TODO notify: "can't delete active branch"
               return;
           }
           
           BranchSelector selector = new BranchSelector(repository, branches);
   ```
   
   new BranchSelector constructor:
   ```java
       public BranchSelector(File repository, HashMap<String, GitBranch> 
branches) {
           this.revisionPicker = new RevisionDialogController(repository, new 
File[0], branches, null);
           panel = new SelectBranchPanel(revisionPicker.getPanel());
       }
   ```
   
   would be nice to overwrite the enable() method of the action and turn it off 
if there is just one branch, but I am not 100% if it is a good idea to run the 
branch query on the EDT, I haven't looked into this deeper.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to