diff --git a/plugins/git4idea/src/git4idea/log/command/ShowGitLogCommandAction.kt b/plugins/git4idea/src/git4idea/log/command/ShowGitLogCommandAction.kt index 4c0cd86d68a1..8b3177990304 100644 --- a/plugins/git4idea/src/git4idea/log/command/ShowGitLogCommandAction.kt +++ b/plugins/git4idea/src/git4idea/log/command/ShowGitLogCommandAction.kt @@ -1,19 +1,33 @@ // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package git4idea.log.command +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.components.service import com.intellij.openapi.project.DumbAwareAction +import com.intellij.openapi.vcs.ProjectLevelVcsManager import com.intellij.openapi.wm.IdeFocusManager import com.intellij.vcs.log.impl.VcsLogContentUtil import com.intellij.vcs.log.impl.VcsLogProjectTabsProperties import com.intellij.vcs.log.impl.VcsLogTabsManager import com.intellij.vcs.log.impl.VcsProjectLog import com.intellij.vcs.log.visible.filters.VcsLogFilterObject +import git4idea.GitVcs import java.util.* @Suppress("HardCodedStringLiteral") // internal action class ShowGitLogCommandAction : DumbAwareAction("Show Git Log for Command") { + + override fun update(e: AnActionEvent) { + val project = e.project + if (project == null) { + e.presentation.isEnabledAndVisible = false + return + } + + e.presentation.isEnabledAndVisible = ProjectLevelVcsManager.getInstance(project).singleVCS?.keyInstanceMethod == GitVcs.getKey() + } + override fun actionPerformed(e: AnActionEvent) { val project = e.project!! VcsProjectLog.runWhenLogIsReady(project) { vcsLogManager -> @@ -26,4 +40,6 @@ class ShowGitLogCommandAction : DumbAwareAction("Show Git Log for Command") { IdeFocusManager.getInstance(project).requestFocus(ui.filterUi.textFilterComponent.focusedComponent, true) } } + + override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT } \ No newline at end of file