From 64aedc5fc0ce702d22fe7825e10b1fc22a31cff1 Mon Sep 17 00:00:00 2001 From: Victor Nogueira Date: Tue, 18 Oct 2022 16:46:16 +0000 Subject: [PATCH] Update Gitpod Gateway Connector to match the latest API This fixes the "more" button behavior, on the home screen of JetBrains Gateway. --- .../gateway/latest/GitpodConnector.kt | 61 ++++++------------ .../gateway/stable/GitpodConnector.kt | 63 ++++++------------- 2 files changed, 39 insertions(+), 85 deletions(-) diff --git a/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/latest/GitpodConnector.kt b/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/latest/GitpodConnector.kt index 10b610e4159c99..ef15fedfc807df 100644 --- a/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/latest/GitpodConnector.kt +++ b/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/latest/GitpodConnector.kt @@ -4,55 +4,32 @@ package io.gitpod.jetbrains.gateway.latest -import com.intellij.ide.BrowserUtil -import com.intellij.ui.components.ActionLink import com.jetbrains.gateway.api.GatewayConnector -import com.jetbrains.gateway.api.GatewayConnectorView -import com.jetbrains.gateway.api.GatewayRecentConnections +import com.jetbrains.gateway.api.GatewayConnectorDocumentationPage import com.jetbrains.rd.util.lifetime.Lifetime import io.gitpod.jetbrains.gateway.GitpodRecentConnections import io.gitpod.jetbrains.icons.GitpodIcons import java.awt.Component -import javax.swing.Icon -import javax.swing.JComponent class GitpodConnector : GatewayConnector { - override val icon: Icon - get() = GitpodIcons.Logo - - override fun createView(lifetime: Lifetime): GatewayConnectorView { - return GitpodConnectorView(lifetime) - } - - override fun getActionText(): String { - return "Connect to Gitpod" - } - - override fun getDescription(): String? { - return "Connect to Gitpod workspaces" - } - - override fun getDocumentationLink(): ActionLink { - val documentationLink = ActionLink("Documentation") { - BrowserUtil.browse("https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway") - } - documentationLink.setExternalLinkIcon() - return documentationLink - } - - override fun getConnectorId(): String = "gitpod.connector" - - override fun getRecentConnections(setContentCallback: (Component) -> Unit): GatewayRecentConnections? { - return GitpodRecentConnections() - } - - override fun getTitle(): String { - return "Gitpod" - } - - override fun getTitleAdornment(): JComponent? { - return null - } + override val icon = GitpodIcons.Logo + + override fun createView(lifetime: Lifetime) = GitpodConnectorView(lifetime) + + override fun getActionText() = "Connect to Gitpod" + + override fun getDescription() = "Connect to Gitpod workspaces" + + override fun getDocumentationAction() = GatewayConnectorDocumentationPage("https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway") + + override fun getConnectorId() = "gitpod.connector" + + override fun getRecentConnections(setContentCallback: (Component) -> Unit) = GitpodRecentConnections() + + override fun getTitle() = "Gitpod" + + @Deprecated("Not used", ReplaceWith("null")) + override fun getTitleAdornment() = null override fun initProcedure() {} } diff --git a/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/stable/GitpodConnector.kt b/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/stable/GitpodConnector.kt index 1efc4f2d96aec3..3320d9fc132553 100644 --- a/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/stable/GitpodConnector.kt +++ b/components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/stable/GitpodConnector.kt @@ -5,54 +5,31 @@ package io.gitpod.jetbrains.gateway.stable import com.jetbrains.gateway.api.GatewayConnector -import com.jetbrains.gateway.api.GatewayConnectorView -import com.jetbrains.gateway.api.GatewayRecentConnections +import com.jetbrains.gateway.api.GatewayConnectorDocumentationPage import com.jetbrains.rd.util.lifetime.Lifetime +import io.gitpod.jetbrains.gateway.GitpodRecentConnections import io.gitpod.jetbrains.icons.GitpodIcons import java.awt.Component -import javax.swing.Icon -import javax.swing.JComponent -import com.intellij.ui.components.ActionLink -import com.intellij.ide.BrowserUtil -import io.gitpod.jetbrains.gateway.GitpodRecentConnections class GitpodConnector : GatewayConnector { - override val icon: Icon - get() = GitpodIcons.Logo - - override fun createView(lifetime: Lifetime): GatewayConnectorView { - return GitpodConnectorView(lifetime) - } - - override fun getActionText(): String { - return "Connect to Gitpod" - } - - override fun getDescription(): String? { - return "Connect to Gitpod workspaces" - } - - override fun getDocumentationLink(): ActionLink { - val documentationLink = ActionLink("Documentation") { - BrowserUtil.browse("https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway") - } - documentationLink.setExternalLinkIcon() - return documentationLink - } - - override fun getConnectorId(): String = "gitpod.connector" - - override fun getRecentConnections(setContentCallback: (Component) -> Unit): GatewayRecentConnections? { - return GitpodRecentConnections() - } - - override fun getTitle(): String { - return "Gitpod" - } - - override fun getTitleAdornment(): JComponent? { - return null - } + override val icon = GitpodIcons.Logo + + override fun createView(lifetime: Lifetime) = GitpodConnectorView(lifetime) + + override fun getActionText() = "Connect to Gitpod" + + override fun getDescription() = "Connect to Gitpod workspaces" + + override fun getDocumentationAction() = GatewayConnectorDocumentationPage("https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway") + + override fun getConnectorId() = "gitpod.connector" + + override fun getRecentConnections(setContentCallback: (Component) -> Unit) = GitpodRecentConnections() + + override fun getTitle() = "Gitpod" + + @Deprecated("Not used", ReplaceWith("null")) + override fun getTitleAdornment() = null override fun initProcedure() {} }