Skip to content

Commit 4195eb0

Browse files
committed
Add Gitpod-related actions to JetBrains IDEs
1 parent 07c3434 commit 4195eb0

16 files changed

+354
-0
lines changed

components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package io.gitpod.jetbrains.remote
66

7+
import com.intellij.ide.BrowserUtil
78
import com.intellij.ide.plugins.PluginManagerCore
89
import com.intellij.notification.NotificationAction
910
import com.intellij.notification.NotificationGroupManager
@@ -53,6 +54,7 @@ import java.util.concurrent.CancellationException
5354
import java.util.concurrent.CompletableFuture
5455
import javax.websocket.DeploymentException
5556

57+
@Suppress("UnstableApiUsage", "OPT_IN_USAGE")
5658
@Service
5759
class GitpodManager : Disposable {
5860

@@ -392,4 +394,9 @@ class GitpodManager : Disposable {
392394
}
393395
}
394396

397+
/** Opens the give URL in the Browser and records an event indicating it was open from a custom IntelliJ Action. */
398+
fun openUrlFromAction(url: String) {
399+
trackEvent("jb_perform_action_open_url", mapOf("url" to url))
400+
BrowserUtil.browse(url)
401+
}
395402
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
import org.apache.http.client.utils.URIBuilder
12+
13+
class AccessControlAction : AnAction() {
14+
private val manager = service<GitpodManager>()
15+
16+
override fun actionPerformed(event: AnActionEvent) {
17+
manager.pendingInfo.thenAccept { workspaceInfo ->
18+
URIBuilder(workspaceInfo.gitpodHost).setPath("integrations").build().toString().let { url ->
19+
manager.openUrlFromAction(url)
20+
}
21+
}
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
12+
class CommunityChatAction : AnAction() {
13+
private val manager = service<GitpodManager>()
14+
15+
override fun actionPerformed(event: AnActionEvent) {
16+
manager.openUrlFromAction("https://www.gitpod.io/chat")
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
12+
class ContextAction : AnAction() {
13+
private val manager = service<GitpodManager>()
14+
15+
override fun actionPerformed(event: AnActionEvent) {
16+
manager.pendingInfo.thenAccept { workspaceInfo ->
17+
manager.openUrlFromAction(workspaceInfo.workspaceContextUrl)
18+
}
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
12+
class DashboardAction : AnAction() {
13+
private val manager = service<GitpodManager>()
14+
15+
override fun actionPerformed(event: AnActionEvent) {
16+
manager.pendingInfo.thenAccept { workspaceInfo ->
17+
manager.openUrlFromAction(workspaceInfo.gitpodHost)
18+
}
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
12+
class DocumentationAction : AnAction() {
13+
private val manager = service<GitpodManager>()
14+
15+
override fun actionPerformed(event: AnActionEvent) {
16+
manager.openUrlFromAction("https://www.gitpod.io/docs")
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
10+
class ExtendWorkspaceTimeoutAction : AnAction() {
11+
override fun actionPerformed(event: AnActionEvent) {
12+
TODO("Not yet implemented")
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
12+
class FollowUsOnTwitterAction : AnAction() {
13+
private val manager = service<GitpodManager>()
14+
15+
override fun actionPerformed(event: AnActionEvent) {
16+
manager.openUrlFromAction("https://twitter.com/gitpod")
17+
}
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
12+
class InBrowser : AnAction() {
13+
private val manager = service<GitpodManager>()
14+
15+
override fun actionPerformed(event: AnActionEvent) {
16+
manager.pendingInfo.thenAccept { workspaceInfo ->
17+
manager.openUrlFromAction(workspaceInfo.workspaceUrl)
18+
}
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
12+
class ReportIssueAction : AnAction() {
13+
private val manager = service<GitpodManager>()
14+
15+
override fun actionPerformed(event: AnActionEvent) {
16+
manager.openUrlFromAction("https://github.com/gitpod-io/gitpod/issues/new/choose")
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
import org.apache.http.client.utils.URIBuilder
12+
13+
class SettingsAction : AnAction() {
14+
private val manager = service<GitpodManager>()
15+
16+
override fun actionPerformed(event: AnActionEvent) {
17+
manager.pendingInfo.thenAccept { workspaceInfo ->
18+
URIBuilder(workspaceInfo.gitpodHost).setPath("settings").build().toString().let { url ->
19+
manager.openUrlFromAction(url)
20+
}
21+
}
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
10+
class ShareRunningWorkspaceAction : AnAction() {
11+
override fun actionPerformed(event: AnActionEvent) {
12+
TODO("Not yet implemented")
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
10+
class ShareWorkspaceSnapshotAction : AnAction() {
11+
override fun actionPerformed(event: AnActionEvent) {
12+
TODO("Not yet implemented")
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
10+
class StopWorkspaceAction : AnAction() {
11+
override fun actionPerformed(event: AnActionEvent) {
12+
TODO("Not yet implemented")
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.actions
6+
7+
import com.intellij.openapi.actionSystem.AnAction
8+
import com.intellij.openapi.actionSystem.AnActionEvent
9+
import com.intellij.openapi.components.service
10+
import io.gitpod.jetbrains.remote.GitpodManager
11+
import org.apache.http.client.utils.URIBuilder
12+
13+
class UpgradeSubscriptionAction : AnAction() {
14+
private val manager = service<GitpodManager>()
15+
16+
override fun actionPerformed(event: AnActionEvent) {
17+
manager.pendingInfo.thenAccept { workspaceInfo ->
18+
URIBuilder(workspaceInfo.gitpodHost).setPath("plans").build().toString().let { url ->
19+
manager.openUrlFromAction(url)
20+
}
21+
}
22+
}
23+
}

components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/plugin.xml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,94 @@
3636
<registryKey key="gitpod.autoJdk.disabled" defaultValue="false" description="Disable auto-detection of JDK for the project and its modules" restartRequired="true"/>
3737
</extensions>
3838

39+
<actions>
40+
<action id="io.gitpod.jetbrains.remote.actions.DashboardAction"
41+
class="io.gitpod.jetbrains.remote.actions.DashboardAction"
42+
text="Gitpod: Open Dashboard"
43+
icon="AllIcons.General.ProjectTab">
44+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
45+
</action>
46+
<action id="io.gitpod.jetbrains.remote.actions.ContextAction"
47+
class="io.gitpod.jetbrains.remote.actions.ContextAction"
48+
text="Gitpod: Open Context"
49+
icon="AllIcons.General.FitContent">
50+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
51+
</action>
52+
<action id="io.gitpod.jetbrains.remote.actions.SettingsAction"
53+
class="io.gitpod.jetbrains.remote.actions.SettingsAction"
54+
text="Gitpod: Open Settings"
55+
icon="AllIcons.General.Settings">
56+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
57+
</action>
58+
<action id="io.gitpod.jetbrains.remote.actions.AccessControlAction"
59+
class="io.gitpod.jetbrains.remote.actions.AccessControlAction"
60+
text="Gitpod: Open Access Control"
61+
icon="AllIcons.Actions.Properties">
62+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
63+
</action>
64+
<action id="io.gitpod.jetbrains.remote.actions.DocumentationAction"
65+
class="io.gitpod.jetbrains.remote.actions.DocumentationAction"
66+
text="Gitpod: Documentation"
67+
icon="AllIcons.General.ReaderMode">
68+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
69+
</action>
70+
<action id="io.gitpod.jetbrains.remote.actions.ReportIssueAction"
71+
class="io.gitpod.jetbrains.remote.actions.ReportIssueAction"
72+
text="Gitpod: Report Issue"
73+
icon="AllIcons.General.ShowWarning">
74+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
75+
</action>
76+
<action id="io.gitpod.jetbrains.remote.actions.FollowUsOnTwitterAction"
77+
class="io.gitpod.jetbrains.remote.actions.FollowUsOnTwitterAction"
78+
text="Gitpod: Follow Us On Twitter"
79+
icon="AllIcons.Gutter.ExtAnnotation">
80+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
81+
</action>
82+
<action id="io.gitpod.jetbrains.remote.actions.CommunityChatAction"
83+
class="io.gitpod.jetbrains.remote.actions.CommunityChatAction"
84+
text="Gitpod: Open Community Chat"
85+
icon="AllIcons.General.Balloon">
86+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
87+
</action>
88+
<action id="io.gitpod.jetbrains.remote.actions.UpgradeSubscriptionAction"
89+
class="io.gitpod.jetbrains.remote.actions.UpgradeSubscriptionAction"
90+
text="Gitpod: Upgrade Subscription"
91+
icon="AllIcons.Actions.PreviousOccurence">
92+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
93+
</action>
94+
<!-- The following actions have their class and icons defined, but still need to be implemented.
95+
<action id="io.gitpod.jetbrains.remote.actions.StopWorkspaceAction"
96+
class="io.gitpod.jetbrains.remote.actions.StopWorkspaceAction"
97+
text="Gitpod: Stop Workspace"
98+
icon="AllIcons.Actions.Pause">
99+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
100+
</action>
101+
<action id="io.gitpod.jetbrains.remote.actions.ExtendWorkspaceTimeoutAction"
102+
class="io.gitpod.jetbrains.remote.actions.ExtendWorkspaceTimeoutAction"
103+
text="Gitpod: Extend Workspace Timeout"
104+
icon="AllIcons.Vcs.History">
105+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
106+
</action>
107+
<action id="io.gitpod.jetbrains.remote.actions.ShareWorkspaceSnapshotAction"
108+
class="io.gitpod.jetbrains.remote.actions.ShareWorkspaceSnapshotAction"
109+
text="Gitpod: Share Workspace Snapshot"
110+
icon="AllIcons.Nodes.UpFolder">
111+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
112+
</action>
113+
<action id="io.gitpod.jetbrains.remote.actions.ShareRunningWorkspaceAction"
114+
class="io.gitpod.jetbrains.remote.actions.ShareRunningWorkspaceAction"
115+
text="Gitpod: Share Running Workspace"
116+
icon="AllIcons.CodeWithMe.CwmShared">
117+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
118+
</action>
119+
-->
120+
<!-- The following action was left out after we noticed it was not fitting in JetBrains IDEs.
121+
<action id="io.gitpod.jetbrains.remote.actions.InBrowser"
122+
class="io.gitpod.jetbrains.remote.actions.InBrowser"
123+
text="Gitpod: Open in Browser"
124+
icon="AllIcons.General.OpenInToolWindow">
125+
<add-to-group group-id="UnattendedHostDropdownGroup" anchor="last"/>
126+
</action>
127+
-->
128+
</actions>
39129
</idea-plugin>

0 commit comments

Comments
 (0)