[vcs]: (IDEA-171643) BranchPopup Widget: remove "current" root marker

* remove unused parameters and method;
This commit is contained in:
Nadya Zabrodina
2017-04-24 18:48:59 +03:00
parent 7718ecd3fb
commit 80f5a08a65
4 changed files with 3 additions and 21 deletions
@@ -152,10 +152,6 @@ public abstract class DvcsBranchPopup<Repo extends Repository> {
@NotNull
protected abstract DefaultActionGroup createRepositoriesActions();
protected boolean highlightCurrentRepo() {
return !userWantsSyncControl() || myMultiRootBranchConfig.diverged();
}
protected abstract void fillPopupWithCurrentRepositoryActions(@NotNull DefaultActionGroup popupGroup,
@Nullable DefaultActionGroup actions);
@@ -20,16 +20,12 @@ import com.intellij.dvcs.repo.Repository;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* The element of the branch popup which allows to show branches of the selected repository.
* It is available only in projects with multiple roots.
*
* @author Kirill Likhodedov
* @author Nadya Zabrodina
*/
public class RootAction<T extends Repository> extends ActionGroup implements PopupElementWithAdditionalInfo {
@@ -37,19 +33,11 @@ public class RootAction<T extends Repository> extends ActionGroup implements Pop
@NotNull private final ActionGroup myGroup;
@NotNull private final String myBranchText;
/**
* @param currentRepository Pass null in the case of common repositories - none repository will be highlighted then.
* @param actionsGroup
* @param branchText
*/
public RootAction(@NotNull T repository, @Nullable T currentRepository, @NotNull ActionGroup actionsGroup, @NotNull String branchText) {
public RootAction(@NotNull T repository, @NotNull ActionGroup actionsGroup, @NotNull String branchText) {
super("", true);
myRepository = repository;
myGroup = actionsGroup;
myBranchText = branchText;
if (repository.equals(currentRepository)) {
getTemplatePresentation().setIcon(PlatformIcons.CHECK_ICON);
}
getTemplatePresentation().setText(DvcsUtil.getShortRepositoryName(repository), false);
}
@@ -153,8 +153,7 @@ class GitBranchPopup extends DvcsBranchPopup<GitRepository> {
DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
popupGroup.addSeparator("Repositories");
List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream()
.map(repo -> new RootAction<>(repo, highlightCurrentRepo() ? myCurrentRepository : null,
new GitBranchPopupActions(repo.getProject(), repo).createActions(),
.map(repo -> new RootAction<>(repo, new GitBranchPopupActions(repo.getProject(), repo).createActions(),
GitBranchUtil.getDisplayableBranchText(repo))).collect(toList());
wrapWithMoreActionIfNeeded(myProject, popupGroup, rootActions, rootActions.size() > MAX_NUM ? DEFAULT_NUM : MAX_NUM,
SHOW_ALL_REPOSITORIES);
@@ -125,8 +125,7 @@ public class HgBranchPopup extends DvcsBranchPopup<HgRepository> {
DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
popupGroup.addSeparator("Repositories");
List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream()
.map(repo -> new RootAction<>(repo, highlightCurrentRepo() ? myCurrentRepository : null,
new HgBranchPopupActions(repo.getProject(), repo).createActions(),
.map(repo -> new RootAction<>(repo, new HgBranchPopupActions(repo.getProject(), repo).createActions(),
HgUtil.getDisplayableBranchOrBookmarkText(repo))).collect(toList());
wrapWithMoreActionIfNeeded(myProject, popupGroup, rootActions, rootActions.size() > MAX_NUM ? DEFAULT_NUM : MAX_NUM,
SHOW_ALL_REPOSITORIES);