override fun actionPerformed()

in idea-plugin/src/main/java/org/jetbrains/bunches/idea/actions/ReduceAction.kt [13:28]


    override fun actionPerformed(e: AnActionEvent) {
        val project = e.project ?: return
        val window = ToolWindowManager.getInstance(project).getToolWindow("Bunch Tool") ?: return
        val repoPath = BunchFileUtils.vcsRootPath(project)
        if (repoPath == null) {
            Messages.showMessageDialog("No git root found", "Reduce error", Messages.getErrorIcon())
            return
        }
        val bunchPath = File(BunchFileUtils.bunchPath(project), ".bunch")
        if (!bunchPath.exists()) {
            Messages.showMessageDialog("No .bunch file found", "Reduce error", Messages.getErrorIcon())
            return
        }
        ServiceManager.getService(project, BunchToolWindowFactory::class.java)
            .createReduceActionWindow(window, project, repoPath, bunchPath.parentFile.absolutePath)
    }