-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Gitpod-related actions to JetBrains IDEs
- Loading branch information
Showing
21 changed files
with
516 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...nents/gitpod-protocol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/Error.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public enum Error { | ||
SNAPSHOT_ERROR(630); | ||
|
||
private int errCode; | ||
|
||
Error(int errCode) { | ||
this.errCode = errCode; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...l/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/SetWorkspaceTimeoutResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public class SetWorkspaceTimeoutResult { | ||
private String[] resetTimeoutOnWorkspaces; | ||
|
||
public SetWorkspaceTimeoutResult(String[] resetTimeoutOnWorkspaces) { | ||
this.resetTimeoutOnWorkspaces = resetTimeoutOnWorkspaces; | ||
} | ||
|
||
public String[] getResetTimeoutOnWorkspaces() { | ||
return resetTimeoutOnWorkspaces; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...rotocol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/TakeSnapshotOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public class TakeSnapshotOptions { | ||
private String workspaceId; | ||
private String layoutData; | ||
private boolean dontWait; | ||
|
||
public TakeSnapshotOptions(final String workspaceId, final String layoutData, final Boolean dontWait) { | ||
this.workspaceId = workspaceId; | ||
this.layoutData = layoutData; | ||
this.dontWait = dontWait; | ||
} | ||
|
||
public TakeSnapshotOptions(final String workspaceId, final Boolean dontWait) { | ||
this.workspaceId = workspaceId; | ||
this.dontWait = dontWait; | ||
} | ||
|
||
public String getLayoutData() { | ||
return layoutData; | ||
} | ||
|
||
public void setLayoutData(String layoutData) { | ||
this.layoutData = layoutData; | ||
} | ||
|
||
public String getWorkspaceId() { | ||
return workspaceId; | ||
} | ||
|
||
public void setWorkspaceId(String workspaceId) { | ||
this.workspaceId = workspaceId; | ||
} | ||
|
||
public boolean isDontWait() { | ||
return dontWait; | ||
} | ||
|
||
public void setDontWait(boolean dontWait) { | ||
this.dontWait = dontWait; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/WorkspaceTimeoutDuration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public enum WorkspaceTimeoutDuration { | ||
DURATION_SHORT("short"), | ||
DURATION_LONG("long"), | ||
DURATION_EXTENDED("extended"), | ||
DURATION_180M("180m"); // for backwards compatibility since the IDE uses this | ||
|
||
private String value; | ||
|
||
WorkspaceTimeoutDuration(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String toString() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/AccessControlAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
import org.apache.http.client.utils.URIBuilder | ||
|
||
class AccessControlAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
URIBuilder(workspaceInfo.gitpodHost).setPath("integrations").build().toString().let { url -> | ||
manager.openUrlFromAction(url) | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/CommunityChatAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class CommunityChatAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://www.gitpod.io/chat") | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...brains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/ContextAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class ContextAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
manager.openUrlFromAction(workspaceInfo.workspaceContextUrl) | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/DashboardAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class DashboardAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
manager.openUrlFromAction(workspaceInfo.gitpodHost) | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/DocumentationAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class DocumentationAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://www.gitpod.io/docs") | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/ExtendWorkspaceTimeoutAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.diagnostic.thisLogger | ||
import io.gitpod.gitpodprotocol.api.entities.WorkspaceTimeoutDuration | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
import com.intellij.notification.NotificationType | ||
|
||
class ExtendWorkspaceTimeoutAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
manager.trackEvent("jb_execute_command_gitpod_workspace", mapOf( | ||
"action" to "extend-timeout" | ||
)) | ||
|
||
manager.client.server.setWorkspaceTimeout(workspaceInfo.workspaceId, WorkspaceTimeoutDuration.DURATION_180M.toString()).whenComplete { result, e -> | ||
var message: String | ||
var notificationType: NotificationType | ||
|
||
if (e != null) { | ||
message = "Cannot extend workspace timeout: ${e.message}" | ||
notificationType = NotificationType.ERROR | ||
thisLogger().error("gitpod: failed to extend workspace timeout", e) | ||
} else { | ||
if (result.resetTimeoutOnWorkspaces.isNotEmpty()) { | ||
message = "Workspace timeout has been extended to three hours. This reset the workspace timeout for other workspaces." | ||
notificationType = NotificationType.WARNING | ||
} else { | ||
message = "Workspace timeout has been extended to three hours." | ||
notificationType = NotificationType.INFORMATION | ||
} | ||
} | ||
|
||
val notification = manager.notificationGroup.createNotification(message, notificationType) | ||
notification.notify(null) | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...kend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/FollowUsOnTwitterAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class FollowUsOnTwitterAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://twitter.com/gitpod") | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ns/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/ReportIssueAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class ReportIssueAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://github.com/gitpod-io/gitpod/issues/new/choose") | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...rains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/SettingsAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
import org.apache.http.client.utils.URIBuilder | ||
|
||
class SettingsAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
URIBuilder(workspaceInfo.gitpodHost).setPath("settings").build().toString().let { url -> | ||
manager.openUrlFromAction(url) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.