From cb1d126c07bc4288565e485bbf7b3b4eb48802a6 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Fri, 6 Dec 2019 18:14:21 +0300 Subject: [PATCH] git: reorder branch actions in Branch Popup, show incoming indicator instead of icon GitOrigin-RevId: fd69453d9de442166c17be8897c4a435fa851c33 --- .../ui/branch/GitBranchPopupActions.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java index 640daf228d93..75cd93b967bc 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java +++ b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java @@ -277,7 +277,6 @@ public class GitBranchPopupActions { new CheckoutAction(myProject, myRepositories, myBranchName), new CheckoutAsNewBranch(myProject, myRepositories, myBranchName), new CheckoutWithRebaseAction(myProject, myRepositories, myBranchName), - new UpdateSelectedBranchAction(myProject, myRepositories, myBranchName), new Separator(), new CompareAction(myProject, myRepositories, myBranchName), new ShowDiffWithBranchAction(myProject, myRepositories, myBranchName), @@ -285,6 +284,7 @@ public class GitBranchPopupActions { new RebaseAction(myProject, myRepositories, myBranchName), new MergeAction(myProject, myRepositories, myBranchName, true), new Separator(), + new UpdateSelectedBranchAction(myProject, myRepositories, myBranchName, hasIncomingCommits()), new PushBranchAction(myProject, myRepositories, myBranchName, hasOutgoingCommits()), new Separator(), new RenameBranchAction(myProject, myRepositories, myBranchName), @@ -771,18 +771,23 @@ public class GitBranchPopupActions { } } - private static class UpdateSelectedBranchAction extends DumbAwareAction { + private static class UpdateSelectedBranchAction extends DumbAwareAction implements CustomIconProvider { private final Project myProject; private final List myRepositories; private final String myBranchName; private final List myBranchNameList; + private final boolean myHasIncoming; - UpdateSelectedBranchAction(@NotNull Project project, @NotNull List repositories, @NotNull String branchName) { - super("Update", null, AllIcons.Actions.CheckOut); + UpdateSelectedBranchAction(@NotNull Project project, + @NotNull List repositories, + @NotNull String branchName, + boolean hasIncoming) { + super("Update"); myProject = project; myRepositories = repositories; myBranchName = branchName; myBranchNameList = Collections.singletonList(branchName); + myHasIncoming = hasIncoming; } @Override @@ -804,6 +809,12 @@ public class GitBranchPopupActions { public void actionPerformed(@NotNull AnActionEvent e) { updateBranches(myProject, myRepositories, myBranchNameList); } + + @Nullable + @Override + public Icon getRightIcon() { + return myHasIncoming ? DvcsImplIcons.Incoming : null; + } } static class TagActions extends BranchActionGroup {