Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

OpenPrAction.kt

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

OpenPrAction.ktBlame44 lines · 1 contributor
0377886Claude1package com.gluecron.actions
2
3import com.gluecron.GluecronUtil
4import com.gluecron.settings.GluecronSettingsState
5import com.intellij.notification.NotificationType
6import com.intellij.openapi.actionSystem.AnAction
7import com.intellij.openapi.actionSystem.AnActionEvent
8import com.intellij.openapi.project.DumbAware
9
10/**
11 * Opens a browser tab showing the pull request list for the current repository.
12 *
13 * URL pattern: {host}/{owner}/{repo}/pulls
14 *
15 * This is the JetBrains equivalent of the VS Code "gluecron.openOnWeb" command
16 * adapted for PR-centric workflow — surfacing the PR list rather than an
17 * individual file, since JetBrains users primarily navigate via the IDE tree.
18 */
19class OpenPrAction : AnAction(), DumbAware {
20
21 override fun actionPerformed(e: AnActionEvent) {
22 val project = e.project ?: return
23 val settings = GluecronSettingsState.getInstance()
24
25 val (owner, repo) = GluecronUtil.detectOwnerRepo(project)
26 ?: run {
27 GluecronUtil.notify(
28 project,
29 "No Gluecron remote detected. Ensure the project has a git remote " +
30 "pointing to ${settings.host}.",
31 NotificationType.WARNING
32 )
33 return
34 }
35
36 val url = "${settings.host}/$owner/$repo/pulls"
37 GluecronUtil.openBrowser(url)
38 }
39
40 override fun update(e: AnActionEvent) {
41 // Only enable when a project is open
42 e.presentation.isEnabledAndVisible = e.project != null
43 }
44}