CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
CreateIssueAction.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.
| 0377886 | 1 | package com.gluecron.actions |
| 2 | ||
| 3 | import com.gluecron.GluecronUtil | |
| 4 | import com.gluecron.settings.GluecronSettingsState | |
| 5 | import com.intellij.notification.NotificationType | |
| 6 | import com.intellij.openapi.actionSystem.AnAction | |
| 7 | import com.intellij.openapi.actionSystem.AnActionEvent | |
| 8 | import com.intellij.openapi.project.DumbAware | |
| 9 | ||
| 10 | /** | |
| 11 | * Opens a browser tab showing the new-issue form for the current repository. | |
| 12 | * | |
| 13 | * URL pattern: {host}/{owner}/{repo}/issues/new | |
| 14 | * | |
| 15 | * This is the JetBrains equivalent of the VS Code "gluecron.createIssue" flow. | |
| 16 | * Rather than embedding a form in the IDE (which would require additional UI | |
| 17 | * scaffolding), we open the Gluecron web UI so users can fill in labels, | |
| 18 | * assignees, and description with full markdown preview. | |
| 19 | */ | |
| 20 | class CreateIssueAction : AnAction(), DumbAware { | |
| 21 | ||
| 22 | override fun actionPerformed(e: AnActionEvent) { | |
| 23 | val project = e.project ?: return | |
| 24 | val settings = GluecronSettingsState.getInstance() | |
| 25 | ||
| 26 | val (owner, repo) = GluecronUtil.detectOwnerRepo(project) | |
| 27 | ?: run { | |
| 28 | GluecronUtil.notify( | |
| 29 | project, | |
| 30 | "No Gluecron remote detected. Ensure the project has a git remote " + | |
| 31 | "pointing to ${settings.host}.", | |
| 32 | NotificationType.WARNING | |
| 33 | ) | |
| 34 | return | |
| 35 | } | |
| 36 | ||
| 37 | val url = "${settings.host}/$owner/$repo/issues/new" | |
| 38 | GluecronUtil.openBrowser(url) | |
| 39 | } | |
| 40 | ||
| 41 | override fun update(e: AnActionEvent) { | |
| 42 | e.presentation.isEnabledAndVisible = e.project != null | |
| 43 | } | |
| 44 | } |