[git]: (IDEA-168490) Branches popup: Do not hide less than 8 remotes

* use the same strategy as for the local branches;
This commit is contained in:
Nadya Zabrodina
2017-03-07 19:04:02 +03:00
parent 226205d89f
commit 5fef98d1dc
2 changed files with 6 additions and 4 deletions
@@ -41,7 +41,8 @@ import java.util.Objects;
import static com.intellij.dvcs.branch.DvcsBranchPopup.MyMoreIndex.DEFAULT_NUM;
import static com.intellij.dvcs.branch.DvcsBranchPopup.MyMoreIndex.MAX_NUM;
import static com.intellij.dvcs.ui.BranchActionGroupPopup.wrapWithMoreActionIfNeeded;
import static com.intellij.dvcs.ui.BranchActionUtil.*;
import static com.intellij.dvcs.ui.BranchActionUtil.FAVORITE_BRANCH_COMPARATOR;
import static com.intellij.dvcs.ui.BranchActionUtil.getNumOfTopShownBranches;
import static com.intellij.util.containers.ContainerUtil.map;
import static java.util.stream.Collectors.toList;
@@ -134,7 +135,7 @@ class GitBranchPopup extends DvcsBranchPopup<GitRepository> {
remoteBranch,
myCurrentRepository));
wrapWithMoreActionIfNeeded(myProject, popupGroup, ContainerUtil.sorted(remoteBranchActions, FAVORITE_BRANCH_COMPARATOR),
getNumOfFavorites(remoteBranchActions), SHOW_ALL_REMOTES_KEY);
getNumOfTopShownBranches(remoteBranchActions), SHOW_ALL_REMOTES_KEY);
}
@Nullable
@@ -40,7 +40,8 @@ import java.util.Collections;
import java.util.List;
import static com.intellij.dvcs.ui.BranchActionGroupPopup.wrapWithMoreActionIfNeeded;
import static com.intellij.dvcs.ui.BranchActionUtil.*;
import static com.intellij.dvcs.ui.BranchActionUtil.FAVORITE_BRANCH_COMPARATOR;
import static com.intellij.dvcs.ui.BranchActionUtil.getNumOfTopShownBranches;
import static git4idea.GitStatisticsCollectorKt.reportUsage;
import static git4idea.GitUtil.HEAD;
import static git4idea.branch.GitBranchType.LOCAL;
@@ -91,7 +92,7 @@ class GitBranchPopupActions {
.map(remoteBranch -> new RemoteBranchActions(myProject, repositoryList, remoteBranch.getName(), myRepository))
.collect(toList());
wrapWithMoreActionIfNeeded(myProject, popupGroup, ContainerUtil.sorted(remoteBranchActions, FAVORITE_BRANCH_COMPARATOR),
getNumOfFavorites(remoteBranchActions), firstLevelGroup ? GitBranchPopup.SHOW_ALL_REMOTES_KEY : null);
getNumOfTopShownBranches(remoteBranchActions), firstLevelGroup ? GitBranchPopup.SHOW_ALL_REMOTES_KEY : null);
return popupGroup;
}