Skip to content

Commit fdae431

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

16 files changed

+371
-8
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,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 DashboardAction : AnAction() {
14+
private val manager = service<GitpodManager>()
15+
16+
override fun actionPerformed(event: AnActionEvent) {
17+
manager.pendingInfo.thenAccept { workspaceInfo ->
18+
URIBuilder(workspaceInfo.gitpodHost).setPath("workspaces").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 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+
}

0 commit comments

Comments
 (0)