2222import org .netbeans .modules .git .client .GitClientExceptionHandler ;
2323import java .io .File ;
2424import java .util .HashMap ;
25- import java .util .Map ;
2625import java .util .logging .Level ;
2726import java .util .logging .Logger ;
2827import org .netbeans .libs .git .GitBranch ;
3837import org .openide .NotifyDescriptor ;
3938import org .openide .awt .ActionID ;
4039import org .openide .awt .ActionRegistration ;
41- import org .openide .nodes .Node ;
4240import org .openide .util .NbBundle ;
4341
4442/**
@@ -58,6 +56,9 @@ protected void performAction(File repository, File[] roots, VCSContext context)
5856 branches .remove (info .getActiveBranch ().getName ());
5957
6058 if (branches .isEmpty ()) {
59+ DialogDisplayer .getDefault ().notify (new NotifyDescriptor .Message (
60+ NbBundle .getMessage (DeleteBranchAction .class , "MSG_DeleteBranchAction.noOtherBranches" )
61+ ));
6162 return ;
6263 }
6364
@@ -67,23 +68,6 @@ protected void performAction(File repository, File[] roots, VCSContext context)
6768 }
6869 }
6970
70- @ Override
71- protected boolean enable (Node [] activatedNodes ) {
72- if (!super .enable (activatedNodes )) {
73- return false ;
74- }
75-
76- // require 2+ branches
77- Map .Entry <File , File []> actionRoots = getActionRoots (getCurrentContext (activatedNodes ));
78- if (actionRoots != null ) {
79- RepositoryInfo info = RepositoryInfo .getInstance (actionRoots .getKey ());
80-
81- return info != null && info .getBranches ().size () > 1 ;
82- }
83-
84- return false ;
85- }
86-
8771 public void deleteBranch (final File repository , final String branchName ) {
8872 NotifyDescriptor nd = new NotifyDescriptor .Confirmation (NbBundle .getMessage (DeleteBranchAction .class , "MSG_DeleteBranchAction.confirmation" , branchName ), //NOI18N
8973 NbBundle .getMessage (DeleteBranchAction .class , "LBL_DeleteBranchAction.confirmation" ), //NOI18N
0 commit comments