mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
[branchPopup]: IDEA-174227 show current branch names for don't sync mode
* if user don't want to track repositories synchronously we have to show current branch name as an additional info near each Repo node; * the same for sync but diverged branch case;
This commit is contained in:
@@ -123,7 +123,7 @@ public abstract class DvcsBranchPopup<Repo extends Repository> {
|
||||
return popupGroup;
|
||||
}
|
||||
|
||||
private boolean userWantsSyncControl() {
|
||||
protected boolean userWantsSyncControl() {
|
||||
return (myVcsSettings.getSyncSetting() != DvcsSyncSettings.Value.DONT_SYNC);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public abstract class DvcsBranchPopup<Repo extends Repository> {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isBranchesDiverged() {
|
||||
private boolean isBranchesDiverged() {
|
||||
return myRepositoryManager.moreThanOneRoot() && myMultiRootBranchConfig.diverged() && userWantsSyncControl();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import git4idea.GitUtil;
|
||||
import git4idea.branch.GitBranchUtil;
|
||||
import git4idea.config.GitVcsSettings;
|
||||
import git4idea.repo.GitRepository;
|
||||
import git4idea.repo.GitRepositoryManager;
|
||||
@@ -45,6 +44,7 @@ import static com.intellij.dvcs.ui.BranchActionUtil.FAVORITE_BRANCH_COMPARATOR;
|
||||
import static com.intellij.dvcs.ui.BranchActionUtil.getNumOfTopShownBranches;
|
||||
import static com.intellij.util.ObjectUtils.tryCast;
|
||||
import static com.intellij.util.containers.ContainerUtil.map;
|
||||
import static git4idea.branch.GitBranchUtil.getDisplayableBranchText;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
@@ -152,7 +152,8 @@ class GitBranchPopup extends DvcsBranchPopup<GitRepository> {
|
||||
popupGroup.addSeparator("Repositories");
|
||||
List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream()
|
||||
.map(repo -> new RootAction<>(repo, new GitBranchPopupActions(repo.getProject(), repo).createActions(),
|
||||
isBranchesDiverged() ? GitBranchUtil.getDisplayableBranchText(repo) : null)).collect(toList());
|
||||
!userWantsSyncControl() || myMultiRootBranchConfig.diverged() ? getDisplayableBranchText(repo) : null))
|
||||
.collect(toList());
|
||||
wrapWithMoreActionIfNeeded(myProject, popupGroup, rootActions, rootActions.size() > MAX_NUM ? DEFAULT_NUM : MAX_NUM,
|
||||
SHOW_ALL_REPOSITORIES);
|
||||
return popupGroup;
|
||||
|
||||
@@ -42,6 +42,7 @@ import static com.intellij.dvcs.ui.BranchActionGroupPopup.wrapWithMoreActionIfNe
|
||||
import static com.intellij.dvcs.ui.BranchActionUtil.FAVORITE_BRANCH_COMPARATOR;
|
||||
import static com.intellij.dvcs.ui.BranchActionUtil.getNumOfTopShownBranches;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.zmlx.hg4idea.util.HgUtil.getDisplayableBranchOrBookmarkText;
|
||||
|
||||
|
||||
/**
|
||||
@@ -126,9 +127,11 @@ public class HgBranchPopup extends DvcsBranchPopup<HgRepository> {
|
||||
protected DefaultActionGroup createRepositoriesActions() {
|
||||
DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
|
||||
popupGroup.addSeparator("Repositories");
|
||||
List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream().map(
|
||||
repo -> new RootAction<>(repo, new HgBranchPopupActions(repo.getProject(), repo).createActions(),
|
||||
isBranchesDiverged() ? HgUtil.getDisplayableBranchOrBookmarkText(repo) : null)).collect(toList());
|
||||
List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream()
|
||||
.map(repo -> new RootAction<>(repo, new HgBranchPopupActions(repo.getProject(), repo).createActions(),
|
||||
!userWantsSyncControl() || myMultiRootBranchConfig.diverged()
|
||||
? getDisplayableBranchOrBookmarkText(repo) : null))
|
||||
.collect(toList());
|
||||
wrapWithMoreActionIfNeeded(myProject, popupGroup, rootActions, rootActions.size() > MAX_NUM ? DEFAULT_NUM : MAX_NUM,
|
||||
SHOW_ALL_REPOSITORIES);
|
||||
return popupGroup;
|
||||
|
||||
Reference in New Issue
Block a user