<commit_before>// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github

import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.service
import com.intellij.openapi.project.DumbAwareAction
import org.jetbrains.plugins.github.i18n.GithubBundle
import org.jetbrains.plugins.github.pullrequest.GHPRToolWindowController
import java.util.function.Supplier

class GithubViewPullRequestsAction :
  DumbAwareAction(GithubBundle.messagePointer("pull.request.view.list"),
                  Supplier { null },
                  AllIcons.Vcs.Vendors.Github) {

  override fun update(e: AnActionEvent) {
    e.presentation.isEnabledAndVisible = isEnabledAndVisible(e)
  }

  private fun isEnabledAndVisible(e: AnActionEvent): Boolean {
    val project = e.project ?: return false
    return project.service<GHPRToolWindowController>().isAvailable()
  }

  override fun actionPerformed(e: AnActionEvent) = e.project!!.service<GHPRToolWindowController>().show()
}<commit_msg>[github] show PR list on "Open PR action" instead of just opening the TW<commit_after>// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github

import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.service
import com.intellij.openapi.project.DumbAwareAction
import org.jetbrains.plugins.github.i18n.GithubBundle
import org.jetbrains.plugins.github.pullrequest.GHPRToolWindowController
import org.jetbrains.plugins.github.pullrequest.ui.toolwindow.GHPRToolWindowInitialView
import java.util.function.Supplier

class GithubViewPullRequestsAction :
  DumbAwareAction(GithubBundle.messagePointer("pull.request.view.list"),
                  Supplier { null },
                  AllIcons.Vcs.Vendors.Github) {

  override fun update(e: AnActionEvent) {
    e.presentation.isEnabledAndVisible = isEnabledAndVisible(e)
  }

  private fun isEnabledAndVisible(e: AnActionEvent): Boolean {
    val project = e.project ?: return false
    return project.service<GHPRToolWindowController>().isAvailable()
  }

  override fun actionPerformed(e: AnActionEvent) {
    e.project!!.service<GHPRToolWindowController>().show {
      it.initialView = GHPRToolWindowInitialView.LIST
      it.componentController?.viewList()
    }
  }
}
{'fraction_non_alphanumeric': 0.08970358814352575, 'fraction_numerical': 0.0093603744149766, 'mean_word_length': 4.600436681222708, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2407952', 'n_tokens_mistral': 800, 'n_tokens_neox': 753, 'n_words': 158}