Skip to content

Commit 1563a25

Browse files
felladrinAndrea Falzetti
authored and
Andrea Falzetti
committed
Add Gitpod-related actions to JetBrains IDEs
1 parent dc9fbe4 commit 1563a25

16 files changed

+355
-0
lines changed

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

Lines changed: 8 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

@@ -393,4 +395,10 @@ class GitpodManager : Disposable {
393395
metricsJob.cancel()
394396
}
395397
}
398+
399+
/** Opens the give URL in the Browser and records an event indicating it was open from a custom IntelliJ Action. */
400+
fun openUrlFromAction(url: String) {
401+
trackEvent("jb_perform_action_open_url", mapOf("url" to url))
402+
BrowserUtil.browse(url)
403+
}
396404
}
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
@@ -44,4 +44,94 @@
4444
restartRequired="true"/>
4545
</extensions>
4646

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

0 commit comments

Comments
 (0)