mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs]: update branch popup separator text for multiRepo DONTSYNC case
* make first level separator text more user friendly, especially during search;
This commit is contained in:
@@ -48,6 +48,7 @@ public abstract class DvcsBranchPopup<Repo extends Repository> {
|
||||
|
||||
@NotNull protected final Repo myCurrentRepository;
|
||||
@NotNull protected final ListPopupImpl myPopup;
|
||||
@NotNull protected final String myRepoTitleInfo;
|
||||
|
||||
protected DvcsBranchPopup(@NotNull Repo currentRepository,
|
||||
@NotNull AbstractRepositoryManager<Repo> repositoryManager,
|
||||
@@ -60,8 +61,10 @@ public abstract class DvcsBranchPopup<Repo extends Repository> {
|
||||
myVcs = currentRepository.getVcs();
|
||||
myVcsSettings = vcsSettings;
|
||||
myMultiRootBranchConfig = multiRootBranchConfig;
|
||||
String title = createPopupTitle(currentRepository);
|
||||
myPopup = new BranchActionGroupPopup(title, myProject, preselectActionCondition, createActions());
|
||||
String title = myVcs.getDisplayName() + " Branches";
|
||||
myRepoTitleInfo = (myRepositoryManager.moreThanOneRoot() && myVcsSettings.getSyncSetting() == DvcsSyncSettings.Value.DONT_SYNC)
|
||||
? " in " + DvcsUtil.getShortRepositoryName(currentRepository) : "";
|
||||
myPopup = new BranchActionGroupPopup(title + myRepoTitleInfo, myProject, preselectActionCondition, createActions());
|
||||
|
||||
initBranchSyncPolicyIfNotInitialized();
|
||||
setCurrentBranchInfo();
|
||||
@@ -85,15 +88,6 @@ public abstract class DvcsBranchPopup<Repo extends Repository> {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String createPopupTitle(@NotNull Repo currentRepository) {
|
||||
String title = myVcs.getDisplayName() + " Branches";
|
||||
if (myRepositoryManager.moreThanOneRoot() && myVcsSettings.getSyncSetting() == DvcsSyncSettings.Value.DONT_SYNC) {
|
||||
title += " in " + DvcsUtil.getShortRepositoryName(currentRepository);
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
protected void setCurrentBranchInfo() {
|
||||
String branchText = "Current branch : ";
|
||||
myPopup.setAdText(branchText + myCurrentRepository.getCurrentBranchName(), SwingConstants.CENTER);
|
||||
|
||||
@@ -126,7 +126,7 @@ class GitBranchPopup extends DvcsBranchPopup<GitRepository> {
|
||||
popupGroup.addSeparator("Repositories");
|
||||
for (GitRepository repository : DvcsUtil.sortRepositories(myRepositoryManager.getRepositories())) {
|
||||
popupGroup.add(new RootAction<>(repository, highlightCurrentRepo() ? myCurrentRepository : null,
|
||||
new GitBranchPopupActions(repository.getProject(), repository).createActions(null),
|
||||
new GitBranchPopupActions(repository.getProject(), repository).createActions(),
|
||||
GitBranchUtil.getDisplayableBranchText(repository)));
|
||||
}
|
||||
return popupGroup;
|
||||
@@ -134,6 +134,7 @@ class GitBranchPopup extends DvcsBranchPopup<GitRepository> {
|
||||
|
||||
@Override
|
||||
protected void fillPopupWithCurrentRepositoryActions(@NotNull DefaultActionGroup popupGroup, @Nullable DefaultActionGroup actions) {
|
||||
popupGroup.addAll(new GitBranchPopupActions(myCurrentRepository.getProject(), myCurrentRepository).createActions(actions));
|
||||
popupGroup
|
||||
.addAll(new GitBranchPopupActions(myCurrentRepository.getProject(), myCurrentRepository).createActions(actions, myRepoTitleInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,11 @@ class GitBranchPopupActions {
|
||||
myRepository = repository;
|
||||
}
|
||||
|
||||
ActionGroup createActions(@Nullable DefaultActionGroup toInsert) {
|
||||
ActionGroup createActions() {
|
||||
return createActions(null, "");
|
||||
}
|
||||
|
||||
ActionGroup createActions(@Nullable DefaultActionGroup toInsert, @NotNull String repoInfo) {
|
||||
DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
|
||||
List<GitRepository> repositoryList = Collections.singletonList(myRepository);
|
||||
|
||||
@@ -61,8 +65,7 @@ class GitBranchPopupActions {
|
||||
if (toInsert != null) {
|
||||
popupGroup.addAll(toInsert);
|
||||
}
|
||||
|
||||
popupGroup.addSeparator("Local Branches");
|
||||
popupGroup.addSeparator("Local Branches" + repoInfo);
|
||||
List<GitBranch> localBranches = new ArrayList<>(myRepository.getBranches().getLocalBranches());
|
||||
Collections.sort(localBranches);
|
||||
for (GitBranch localBranch : localBranches) {
|
||||
@@ -71,7 +74,7 @@ class GitBranchPopupActions {
|
||||
}
|
||||
}
|
||||
|
||||
popupGroup.addSeparator("Remote Branches");
|
||||
popupGroup.addSeparator("Remote Branches" + repoInfo);
|
||||
List<GitBranch> remoteBranches = new ArrayList<>(myRepository.getBranches().getRemoteBranches());
|
||||
Collections.sort(remoteBranches);
|
||||
for (GitBranch remoteBranch : remoteBranches) {
|
||||
|
||||
@@ -108,14 +108,14 @@ public class HgBranchPopup extends DvcsBranchPopup<HgRepository> {
|
||||
popupGroup.addSeparator("Repositories");
|
||||
for (HgRepository repository : DvcsUtil.sortRepositories(myRepositoryManager.getRepositories())) {
|
||||
popupGroup.add(new RootAction<>(repository, highlightCurrentRepo() ? myCurrentRepository : null,
|
||||
new HgBranchPopupActions(repository.getProject(), repository).createActions(null),
|
||||
new HgBranchPopupActions(repository.getProject(), repository).createActions(),
|
||||
HgUtil.getDisplayableBranchOrBookmarkText(repository)));
|
||||
}
|
||||
return popupGroup;
|
||||
}
|
||||
|
||||
protected void fillPopupWithCurrentRepositoryActions(@NotNull DefaultActionGroup popupGroup, @Nullable DefaultActionGroup actions) {
|
||||
popupGroup.addAll(new HgBranchPopupActions(myProject, myCurrentRepository).createActions(actions));
|
||||
popupGroup.addAll(new HgBranchPopupActions(myProject, myCurrentRepository).createActions(actions, myRepoTitleInfo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,11 @@ public class HgBranchPopupActions {
|
||||
myRepository = repository;
|
||||
}
|
||||
|
||||
ActionGroup createActions(@Nullable DefaultActionGroup toInsert) {
|
||||
ActionGroup createActions() {
|
||||
return createActions(null, "");
|
||||
}
|
||||
|
||||
ActionGroup createActions(@Nullable DefaultActionGroup toInsert, @NotNull String repoInfo) {
|
||||
DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
|
||||
popupGroup.addAction(new HgNewBranchAction(myProject, Collections.singletonList(myRepository), myRepository));
|
||||
popupGroup.addAction(new HgNewBookmarkAction(Collections.singletonList(myRepository), myRepository));
|
||||
@@ -78,7 +82,7 @@ public class HgBranchPopupActions {
|
||||
popupGroup.addAll(toInsert);
|
||||
}
|
||||
|
||||
popupGroup.addSeparator("Bookmarks");
|
||||
popupGroup.addSeparator("Bookmarks" + repoInfo);
|
||||
List<String> bookmarkNames = getSortedNamesWithoutHashes(myRepository.getBookmarks());
|
||||
String currentBookmark = myRepository.getCurrentBookmark();
|
||||
for (String bookmark : bookmarkNames) {
|
||||
@@ -89,7 +93,7 @@ public class HgBranchPopupActions {
|
||||
popupGroup.add(bookmarkAction);
|
||||
}
|
||||
|
||||
popupGroup.addSeparator("Branches");
|
||||
popupGroup.addSeparator("Branches" + repoInfo);
|
||||
List<String> branchNamesList = new ArrayList<>(myRepository.getOpenedBranches());//only opened branches have to be shown
|
||||
Collections.sort(branchNamesList);
|
||||
for (String branch : branchNamesList) {
|
||||
|
||||
Reference in New Issue
Block a user