git: show repositories and global actions for multi-repo projects without common branches in branches tree popup

GitOrigin-RevId: 2ce93df6b8090d13d8f7eaa3665427ca8ccf50d6
This commit is contained in:
Dmitry Zhuravlev
2023-01-23 15:33:21 +01:00
committed by intellij-monorepo-bot
parent 29073685cd
commit 0386760e20
2 changed files with 3 additions and 4 deletions

View File

@@ -187,7 +187,8 @@ class GitBranchesTreePopup(project: Project, step: GitBranchesTreePopupStep, par
traverseNodesAndExpand()
expandPreviouslyExpandedBranches()
}
super.updateSpeedSearchColors(!haveBranches)
val model = tree.model
super.updateSpeedSearchColors(model.getChildCount(model.root) == 0)
if (!pattern.isNullOrBlank()) {
tree.emptyText.text = GitBundle.message("git.branches.popup.tree.no.branches", pattern)
}

View File

@@ -61,7 +61,7 @@ class GitBranchesTreeMultiRepoModel(
|| (node === GitBranchType.REMOTE && commonRemoteBranchesTree.isEmpty())
private fun getChildren(parent: Any?): List<Any> {
if (parent == null || !haveFilteredBranches()) return emptyList()
if (parent == null) return emptyList()
return when (parent) {
TreeRoot -> getTopLevelNodes()
is GitBranchType -> branchesTreeCache.getOrPut(parent) { getBranchTreeNodes(parent, emptyList()) }
@@ -91,6 +91,4 @@ class GitBranchesTreeMultiRepoModel(
private fun getPreferredBranch(): GitBranch? =
getPreferredBranch(project, repositories, null, commonLocalBranchesTree, commonRemoteBranchesTree)
private fun haveFilteredBranches(): Boolean = !commonLocalBranchesTree.isEmpty() || !commonRemoteBranchesTree.isEmpty()
}