diff --git a/plugins/git4idea/resources/META-INF/plugin.xml b/plugins/git4idea/resources/META-INF/plugin.xml
index f458a48eecbd..3479a2fd8bc3 100644
--- a/plugins/git4idea/resources/META-INF/plugin.xml
+++ b/plugins/git4idea/resources/META-INF/plugin.xml
@@ -45,6 +45,9 @@
+
+
+
diff --git a/plugins/git4idea/resources/messages/GitBundle.properties b/plugins/git4idea/resources/messages/GitBundle.properties
index 2491d3bb565a..12d5e8675d2e 100644
--- a/plugins/git4idea/resources/messages/GitBundle.properties
+++ b/plugins/git4idea/resources/messages/GitBundle.properties
@@ -278,6 +278,8 @@ action.Git.Fixup.To.Commit.text=Fixup...
action.Git.Fixup.To.Commit.description=Create a fixup commit
action.Git.Rename.Local.Branch.text=Rename...
action.Git.Rename.Local.Branch.description=Rename a local branch
+action.Git.Checkout.Branch.text=Checkout Selected...
+action.Git.Checkout.Branch.description=Checkout selected branch
action.Git.Reword.Commit.text=Edit Commit Message...
action.Git.Reword.Commit.description=Change commit message via reword option of git rebase or amend
action.Git.Uncommit.text=Undo Commit...
diff --git a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardActions.kt b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardActions.kt
index 583954cf9e89..b131c8018178 100644
--- a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardActions.kt
+++ b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardActions.kt
@@ -316,20 +316,25 @@ internal object BranchesDashboardActions {
}
}
- object CheckoutLocalBranchOnDoubleClickHandler {
- fun install(project: Project, treeComponent: BranchesTreeComponent) {
- treeComponent.doubleClickHandler = { clickedNode -> doCheckout(clickedNode, project) }
+ class CheckoutSelectedBranchAction : BranchesActionBase() {
+
+ override fun update(e: AnActionEvent, project: Project, branches: Collection) {
+ if (branches.size > 1) {
+ e.presentation.isEnabled = false
+ return
+ }
}
- private fun doCheckout(clickedNode: BranchTreeNode, project: Project) {
- val branchInfo = clickedNode.getNodeDescriptor().branchInfo ?: return
- if (branchInfo.isLocal) {
+ override fun actionPerformed(e: AnActionEvent) {
+ val project = e.project!!
+ val branch = e.getData(GIT_BRANCHES)!!.firstOrNull() ?: return
+ if (branch.isLocal) {
GitBranchPopupActions.LocalBranchActions.CheckoutAction
- .checkoutBranch(project, branchInfo.repositories, branchInfo.branchName)
+ .checkoutBranch(project, branch.repositories, branch.branchName)
}
else {
GitBranchPopupActions.RemoteBranchActions.CheckoutRemoteBranchAction
- .checkoutRemoteBranch(project, branchInfo.repositories, branchInfo.branchName)
+ .checkoutRemoteBranch(project, branch.repositories, branch.branchName)
}
}
}
diff --git a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardUi.kt b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardUi.kt
index cefb5a763ec3..67f56fbbb0de 100644
--- a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardUi.kt
+++ b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesDashboardUi.kt
@@ -38,7 +38,6 @@ import com.intellij.vcs.log.ui.frame.VcsLogChangeProcessor
import com.intellij.vcs.log.visible.VisiblePackRefresher
import com.intellij.vcs.log.visible.VisiblePackRefresherImpl
import com.intellij.vcs.log.visible.filters.VcsLogFilterObject
-import git4idea.ui.branch.dashboard.BranchesDashboardActions.CheckoutLocalBranchOnDoubleClickHandler
import git4idea.ui.branch.dashboard.BranchesDashboardActions.DeleteBranchAction
import git4idea.ui.branch.dashboard.BranchesDashboardActions.FetchAction
import git4idea.ui.branch.dashboard.BranchesDashboardActions.GroupByDirectoryAction
@@ -121,7 +120,6 @@ internal class BranchesDashboardUi(val project: Project) : Disposable {
}
private fun initMainUi() {
- CheckoutLocalBranchOnDoubleClickHandler.install(project, tree.component)
val diffAction = ShowBranchDiffAction()
diffAction.registerCustomShortcutSet(KeymapUtil.getActiveKeymapShortcuts("Diff.ShowDiff"), branchesTreeWithLogPanel)