Skip to content

Commit

Permalink
Fix list pr actions name
Browse files Browse the repository at this point in the history
  • Loading branch information
shiraji committed Mar 20, 2024
1 parent 104d0eb commit 66f8712
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ import git4idea.repo.GitRepository

class ListPullRequestToggleAction : ToggleAction() {

private fun isEnabled(e: AnActionEvent): Boolean {
val project = e.getData(CommonDataKeys.PROJECT)
if (project == null || project.isDisposed) return false

private fun isEnabled(e: AnActionEvent, project: Project): Boolean {
val selectedFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)
if (selectedFiles == null || selectedFiles.size != 1) return false

Expand All @@ -46,7 +43,11 @@ class ListPullRequestToggleAction : ToggleAction() {

override fun update(e: AnActionEvent) {
super.update(e)
e.presentation.isEnabled = isEnabled(e)
val project = e.project ?: return
if (project.isDisposed) return
val config = PropertiesComponent.getInstance(project) ?: return
e.presentation.isEnabled = isEnabled(e, project)
e.presentation.text = "List ${FindPullRequestHostingServices.findBy(config.getHosting()).pullRequestName}"
}

override fun isSelected(e: AnActionEvent): Boolean {
Expand Down

0 comments on commit 66f8712

Please sign in to comment.