generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Artem Zatsarynnyi <[email protected]>
- Loading branch information
1 parent
20a8cea
commit 56ff7d0
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/com/github/devspaces/gateway/DevSpacesConnectionProvider.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,37 @@ | ||
/* | ||
* Copyright (c) 2024 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package com.github.devspaces.gateway | ||
|
||
import com.jetbrains.gateway.api.ConnectionRequestor | ||
import com.jetbrains.gateway.api.GatewayConnectionHandle | ||
import com.jetbrains.gateway.api.GatewayConnectionProvider | ||
import com.jetbrains.gateway.thinClientLink.LinkedClientManager | ||
import com.jetbrains.rd.util.lifetime.Lifetime | ||
import java.net.URI | ||
|
||
/** | ||
* Handles links as: | ||
* jetbrains-gateway://connect#type=devspaces | ||
* https://code-with-me.jetbrains.com/remoteDev#type=devspaces | ||
*/ | ||
class DevSpacesConnectionProvider : GatewayConnectionProvider { | ||
|
||
override suspend fun connect(parameters: Map<String, String>, requestor: ConnectionRequestor): GatewayConnectionHandle? { | ||
val joinLink = parameters["link"]?.replace("_", "&") | ||
LinkedClientManager.getInstance().startNewClient(Lifetime.Eternal, URI(joinLink)) | ||
Check warning on line 30 in src/main/kotlin/com/github/devspaces/gateway/DevSpacesConnectionProvider.kt GitHub Actions / Qodana Community for JVMUnstable API Usage
Check warning on line 30 in src/main/kotlin/com/github/devspaces/gateway/DevSpacesConnectionProvider.kt GitHub Actions / Qodana Community for JVMUnstable API Usage
Check warning on line 30 in src/main/kotlin/com/github/devspaces/gateway/DevSpacesConnectionProvider.kt GitHub Actions / Qodana Community for JVMUnstable API Usage
|
||
return null | ||
} | ||
|
||
override fun isApplicable(parameters: Map<String, String>): Boolean { | ||
return parameters["type"] == "devspaces" | ||
} | ||
} |
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