Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions plugin/src/main/java/git4idea/ui/branch/GitBranchPopup.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ class GitBranchPopup extends DvcsBranchPopup<GitRepository> {
static GitBranchPopup getInstance(@Nonnull Project project, @Nonnull GitRepository currentRepository) {
GitVcsSettings vcsSettings = GitVcsSettings.getInstance(project);
Predicate<AnAction> preselectActionCondition = action -> {
if (action instanceof GitBranchPopupActions.LocalBranchActions) {
GitBranchPopupActions.LocalBranchActions branchAction = (GitBranchPopupActions.LocalBranchActions)action;
if (action instanceof GitBranchPopupActions.LocalBranchActions branchAction) {
String branchName = branchAction.getBranchName();

String recentBranch;
Expand Down Expand Up @@ -124,7 +123,7 @@ protected void fillWithCommonRepositoryActions(
);
popupGroup.addSeparator(GitBranchesLocalize.actionCommonRemoteBranchesText());
List<BranchActionGroup> remoteBranchActions = map(
((GitMultiRootBranchConfig)myMultiRootBranchConfig).getRemoteBranches(),
((GitMultiRootBranchConfig) myMultiRootBranchConfig).getRemoteBranches(),
remoteBranch -> new GitBranchPopupActions.RemoteBranchActions(myProject, allRepositories, remoteBranch, myCurrentRepository)
);
BranchActionUtil.wrapWithMoreActionIfNeeded(
Expand Down Expand Up @@ -174,6 +173,6 @@ protected ActionGroup createRepositoriesActions() {
@Override
protected void fillPopupWithCurrentRepositoryActions(@Nonnull ActionGroup.Builder popupGroup, @Nullable ActionGroup actions) {
popupGroup.addAll(new GitBranchPopupActions(myCurrentRepository.getProject(), myCurrentRepository)
.createActions(actions, myRepoTitleInfo, true));
.createActions(actions, myIsInSpecificRepository ? myCurrentRepository : null, true));
}
}
22 changes: 16 additions & 6 deletions plugin/src/main/java/git4idea/ui/branch/GitBranchPopupActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import consulo.ui.ex.action.DumbAwareAction;
import consulo.ui.ex.awt.Messages;
import consulo.util.collection.ContainerUtil;
import consulo.versionControlSystem.distributed.DvcsUtil;
import consulo.versionControlSystem.distributed.branch.BranchActionGroup;
import consulo.versionControlSystem.distributed.branch.BranchActionUtil;
import consulo.versionControlSystem.distributed.branch.NewBranchAction;
Expand Down Expand Up @@ -54,10 +55,10 @@ class GitBranchPopupActions {
}

ActionGroup createActions() {
return createActions(null, "", false);
return createActions(null, null, false);
}

ActionGroup createActions(@Nullable ActionGroup toInsert, @Nonnull String repoInfo, boolean firstLevelGroup) {
ActionGroup createActions(@Nullable ActionGroup toInsert, @Nullable GitRepository specificRepository, boolean firstLevelGroup) {
ActionGroup.Builder popupGroup = ActionGroup.newImmutableBuilder();
List<GitRepository> repositoryList = List.of(myRepository);

Expand All @@ -68,7 +69,11 @@ ActionGroup createActions(@Nullable ActionGroup toInsert, @Nonnull String repoIn
popupGroup.addAll(toInsert);
}

popupGroup.addSeparator(GitBranchesLocalize.actionLocalBranches0Text(repoInfo));
popupGroup.addSeparator(
specificRepository == null
? GitBranchesLocalize.actionLocalBranchesText()
: GitBranchesLocalize.actionLocalBranchesInRepoText(DvcsUtil.getShortRepositoryName(specificRepository))
);
List<BranchActionGroup> localBranchActions = myRepository.getBranches()
.getLocalBranches()
.stream()
Expand All @@ -86,7 +91,11 @@ ActionGroup createActions(@Nullable ActionGroup toInsert, @Nonnull String repoIn
firstLevelGroup
);

popupGroup.addSeparator(GitBranchesLocalize.actionRemoteBranches0Text(repoInfo));
popupGroup.addSeparator(
specificRepository == null
? GitBranchesLocalize.actionRemoteBranchesText()
: GitBranchesLocalize.actionRemoteBranchesInRepoText(DvcsUtil.getShortRepositoryName(specificRepository))
);
List<BranchActionGroup> remoteBranchActions =
myRepository.getBranches()
.getRemoteBranches()
Expand Down Expand Up @@ -117,7 +126,8 @@ public GitNewBranchAction(@Nonnull Project project, @Nonnull List<GitRepository>
@Override
@RequiredUIAccess
public void actionPerformed(@Nonnull AnActionEvent e) {
String name = GitBranchUtil.getNewBranchNameFromUser(myProject, myRepositories, GitBranchesLocalize.dialogTitleCreateNewBranch());
String name =
GitBranchUtil.getNewBranchNameFromUser(myProject, myRepositories, GitBranchesLocalize.dialogTitleCreateNewBranch());
if (name != null) {
GitBrancher brancher = myProject.getInstance(GitBrancher.class);
brancher.checkoutNewBranch(name, myRepositories);
Expand Down Expand Up @@ -355,7 +365,7 @@ public void actionPerformed(@Nonnull AnActionEvent e) {

private class RenameBranchAction extends DumbAwareAction {
public RenameBranchAction() {
super("Rename");
super(GitBranchesLocalize.actionRenameText());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@ action.compare.text:
text: Compare
action.delete.text:
text: Delete
action.local.branches.0.text:
text: Local Branches{0}
action.local.branches.in.repo.text:
text: Local Branches in {0}
action.local.branches.text:
text: Local Branches
action.merge.text:
text: Merge
action.rebase.onto.text:
text: Rebase onto
action.remote.branches.0.text:
text: Remote Branches{0}
action.remote.branches.in.repo.text:
text: Remote Branches in {0}
action.remote.branches.text:
text: Remote Branches
action.rename.text:
text: Rename
action.repositories.text:
text: Repositories
action.tags.in.repo.text:
text: Tags in {0}
dialog.message.enter.reference.branch.tag.name.or.commit.hash:
text: 'Enter reference (branch, tag) name or commit hash:'
dialog.message.new.branch.name:
Expand Down
Loading