mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git-branches-dashboard: branch actions invoked via shortcuts should work even if the filtering field explicitly focused
GitOrigin-RevId: 8e027404ac7fdc1376af680eaf2cd3827001ad78
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ca1ed314c6
commit
bd7a6b4a5b
@@ -21,6 +21,7 @@ import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.JBUI.Panels.simplePanel
|
||||
import com.intellij.util.ui.StatusText.DEFAULT_EMPTY_TEXT
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import com.intellij.util.ui.components.BorderLayoutPanel
|
||||
import com.intellij.vcs.log.VcsLogFilterCollection
|
||||
import com.intellij.vcs.log.data.VcsLogData
|
||||
import com.intellij.vcs.log.impl.MainVcsLogUiProperties
|
||||
@@ -55,7 +56,7 @@ internal class BranchesDashboardUi(val project: Project) : Disposable {
|
||||
|
||||
private val tree = FilteringBranchesTree(project, BranchesTreeComponent(project), uiController)
|
||||
private val branchViewSplitter = BranchViewSplitter()
|
||||
private val branchesTreePanel = simplePanel().withBorder(createBorder(JBColor.border(), SideBorder.LEFT))
|
||||
private val branchesTreePanel = BranchesTreePanel().withBorder(createBorder(JBColor.border(), SideBorder.LEFT))
|
||||
private val branchesScrollPane = ScrollPaneFactory.createScrollPane(tree.component, true)
|
||||
private val branchesProgressStripe = ProgressStripe(branchesScrollPane, this, ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS)
|
||||
private val branchesTreeWithLogPanel = simplePanel(branchesTreePanel)
|
||||
@@ -148,7 +149,7 @@ internal class BranchesDashboardUi(val project: Project) : Disposable {
|
||||
group.add(collapseAllAction)
|
||||
|
||||
val toolbar = ActionManager.getInstance().createActionToolbar("Git.Cleanup.Branches", group, false)
|
||||
toolbar.setTargetComponent(tree.component)
|
||||
toolbar.setTargetComponent(branchesTreePanel)
|
||||
|
||||
branchesTreeWithLogPanel.addToLeft(toolbar.component)
|
||||
branchesSearchFieldPanel.withBackground(UIUtil.getListBackground()).withBorder(createBorder(JBColor.border(), SideBorder.BOTTOM))
|
||||
@@ -180,6 +181,15 @@ internal class BranchesDashboardUi(val project: Project) : Disposable {
|
||||
}.registerCustomShortcutSet(KeymapUtil.getActiveKeymapShortcuts("Find"), branchesTreePanel)
|
||||
}
|
||||
|
||||
inner class BranchesTreePanel : BorderLayoutPanel(), DataProvider {
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (GIT_BRANCHES.`is`(dataId)) {
|
||||
return tree.getSelectedBranches()
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun getMainComponent(): JComponent {
|
||||
return mainPanel
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.dnd.TransferableList
|
||||
import com.intellij.ide.dnd.aware.DnDAwareTree
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.application.runInEdt
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.*
|
||||
@@ -29,7 +28,7 @@ import javax.swing.event.TreeExpansionEvent
|
||||
import javax.swing.event.TreeExpansionListener
|
||||
import javax.swing.tree.TreePath
|
||||
|
||||
internal class BranchesTreeComponent(project: Project) : DnDAwareTree(), DataProvider {
|
||||
internal class BranchesTreeComponent(project: Project) : DnDAwareTree() {
|
||||
|
||||
var doubleClickHandler: (BranchTreeNode) -> Unit = {}
|
||||
var searchField: SearchTextField? = null
|
||||
@@ -109,13 +108,6 @@ internal class BranchesTreeComponent(project: Project) : DnDAwareTree(), DataPro
|
||||
}
|
||||
}
|
||||
|
||||
override fun getData(dataId: String): Any? {
|
||||
if (GIT_BRANCHES.`is`(dataId)) {
|
||||
return getSelectedBranches()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun getSelectedBranches(): Set<BranchInfo> {
|
||||
val paths = selectionPaths ?: return emptySet()
|
||||
return paths.asSequence()
|
||||
|
||||
Reference in New Issue
Block a user