mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
[git] IJPL-160069 Reuse "Show tags" action in git log
GitOrigin-RevId: 453b21a663f6354949d37a38aeb0b8cd1d6ba667
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c48e5cef29
commit
e3064e3924
@@ -120,6 +120,7 @@ a:com.intellij.dvcs.branch.DvcsBranchManager
|
||||
com.intellij.dvcs.branch.DvcsBranchManager$DvcsBranchManagerListener
|
||||
- branchFavoriteSettingsChanged():V
|
||||
- branchGroupingSettingsChanged(com.intellij.dvcs.branch.GroupingKey,Z):V
|
||||
- showTagsSettingsChanged():V
|
||||
a:com.intellij.dvcs.branch.DvcsBranchPopup
|
||||
- pf:myCurrentRepository:com.intellij.dvcs.repo.Repository
|
||||
- pf:myInSpecificRepository:Z
|
||||
|
||||
@@ -168,5 +168,7 @@ public abstract class DvcsBranchManager<T extends Repository> {
|
||||
default void branchFavoriteSettingsChanged() { }
|
||||
|
||||
default void branchGroupingSettingsChanged(@NotNull GroupingKey key, boolean state) { }
|
||||
|
||||
default void showTagsSettingsChanged() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
class="git4idea.ui.branch.dashboard.BranchesDashboardActions$ChangeBranchFilterAction"/>
|
||||
<action id="Git.Log.Branches.Navigate.Log.To.Branch.On.Selection"
|
||||
class="git4idea.ui.branch.dashboard.BranchesDashboardActions$NavigateLogToBranchAction"/>
|
||||
<separator/>
|
||||
<action id="git.branches.show.tags" class="git4idea.ui.branch.tree.GitBranchesTreeShowTagsAction"/>
|
||||
</group>
|
||||
<group id="Git.Log.Branches.Grouping.Settings" icon="AllIcons.Actions.GroupBy"
|
||||
class="git4idea.ui.branch.dashboard.BranchesDashboardActions$GroupingSettingsGroup">
|
||||
@@ -189,7 +191,7 @@
|
||||
<action id="git.branches.group.by.prefix" class="git4idea.ui.branch.popup.GitBranchesTreePopupGroupByPrefixAction"/>
|
||||
<action class="git4idea.ui.branch.popup.GitBranchesTreePopupTrackReposSynchronouslyAction"/>
|
||||
<action id="git.branches.show.recent" class="git4idea.ui.branch.popup.GitBranchesTreePopupShowRecentBranchesAction"/>
|
||||
<action id="git.branches.show.tags" class="git4idea.ui.branch.popup.GitBranchesTreePopupShowTagsAction"/>
|
||||
<reference ref="git.branches.show.tags"/>
|
||||
<action id="git.branches.popup.resize" class="git4idea.ui.branch.popup.GitBranchesTreePopupResizeAction"/>
|
||||
</group>
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ import git4idea.i18n.GitBundle
|
||||
import git4idea.repo.GitRepository
|
||||
import git4idea.ui.branch.popup.GitBranchesTreePopupBase
|
||||
import git4idea.ui.branch.popup.GitBranchesTreePopupMinimalRenderer
|
||||
import git4idea.ui.branch.popup.GitBranchesTreePopupShowTagsAction
|
||||
import git4idea.ui.branch.popup.GitBranchesTreePopupStepBase
|
||||
import git4idea.ui.branch.tree.GitBranchesTreeModel
|
||||
import git4idea.ui.branch.tree.GitBranchesTreeRenderer
|
||||
import git4idea.ui.branch.tree.GitBranchesTreeShowTagsAction
|
||||
import git4idea.ui.branch.tree.GitBranchesTreeSingleRepoModel
|
||||
import git4idea.ui.branch.tree.createTreePathFor
|
||||
import java.util.function.Consumer
|
||||
@@ -85,7 +85,7 @@ class GitCompareWithBranchPopup(
|
||||
|
||||
override fun getSearchFiledEmptyText(): String = GitBundle.message(
|
||||
"git.compare.with.branch.search.field.empty.text",
|
||||
if (GitBranchesTreePopupShowTagsAction.isSelected(project)) 1 else 0
|
||||
if (GitBranchesTreeShowTagsAction.isSelected(project)) 1 else 0
|
||||
)
|
||||
|
||||
override fun getTreeEmptyText(searchPattern: String?): String = GitBundle.message("git.compare.with.branch.search.not.found", searchPattern)
|
||||
|
||||
@@ -66,6 +66,10 @@ internal class BranchesDashboardController(
|
||||
override fun branchGroupingSettingsChanged(key: GroupingKey, state: Boolean) {
|
||||
toggleGrouping(key, state)
|
||||
}
|
||||
|
||||
override fun showTagsSettingsChanged() {
|
||||
ui.updateBranchesTree(false)
|
||||
}
|
||||
})
|
||||
project.messageBus.connect(this)
|
||||
.subscribe(GitBranchIncomingOutgoingManager.GIT_INCOMING_OUTGOING_CHANGED, GitIncomingOutgoingListener {
|
||||
|
||||
@@ -309,6 +309,10 @@ abstract class GitBranchesTreePopupBase<T : GitBranchesTreePopupStepBase>(
|
||||
tree.repaint()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showTagsSettingsChanged() {
|
||||
refresh()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -106,35 +106,6 @@ internal class GitBranchesTreePopupShowRecentBranchesAction :
|
||||
}
|
||||
}
|
||||
|
||||
internal class GitBranchesTreePopupShowTagsAction :
|
||||
ToggleAction(GitBundle.messagePointer("git.branches.popup.show.tags.name")), DumbAware {
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
super.update(e)
|
||||
e.presentation.isEnabledAndVisible = e.project != null
|
||||
&& e.getData(GitBranchesTreePopupBase.POPUP_KEY) != null
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.EDT
|
||||
|
||||
override fun isSelected(e: AnActionEvent): Boolean =
|
||||
e.project?.let(GitVcsSettings::getInstance)?.showTags() ?: true
|
||||
|
||||
override fun setSelected(e: AnActionEvent, state: Boolean) {
|
||||
val project = e.project ?: return
|
||||
GitVcsSettings.getInstance(project).setShowTags(state)
|
||||
|
||||
for (repository in GitRepositoryManager.getInstance(project).repositories) {
|
||||
repository.tagHolder.updateEnabled()
|
||||
}
|
||||
e.getRequiredData(GitBranchesTreePopupBase.POPUP_KEY).refresh()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun isSelected(project: Project?): Boolean =
|
||||
project != null && project.let(GitVcsSettings::getInstance).showTags()
|
||||
}
|
||||
}
|
||||
|
||||
internal class GitBranchesTreePopupFilterSeparatorWithText : DefaultActionGroup(), DumbAware {
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package git4idea.ui.branch.tree
|
||||
|
||||
import com.intellij.dvcs.branch.DvcsBranchManager
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.ToggleAction
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.openapi.project.Project
|
||||
import git4idea.config.GitVcsSettings
|
||||
import git4idea.i18n.GitBundle
|
||||
import git4idea.repo.GitRepositoryManager
|
||||
|
||||
internal class GitBranchesTreeShowTagsAction :
|
||||
ToggleAction(GitBundle.messagePointer("git.branches.popup.show.tags.name")), DumbAware {
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
super.update(e)
|
||||
e.presentation.isEnabledAndVisible = e.project != null
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.EDT
|
||||
|
||||
override fun isSelected(e: AnActionEvent): Boolean =
|
||||
e.project?.let(GitVcsSettings::getInstance)?.showTags() ?: true
|
||||
|
||||
override fun setSelected(e: AnActionEvent, state: Boolean) {
|
||||
val project = e.project ?: return
|
||||
GitVcsSettings.getInstance(project).setShowTags(state)
|
||||
|
||||
for (repository in GitRepositoryManager.getInstance(project).repositories) {
|
||||
repository.tagHolder.updateEnabled()
|
||||
}
|
||||
|
||||
project.getMessageBus().syncPublisher(DvcsBranchManager.DVCS_BRANCH_SETTINGS_CHANGED).showTagsSettingsChanged()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun isSelected(project: Project?): Boolean =
|
||||
project != null && project.let(GitVcsSettings::getInstance).showTags()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user