Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit14507c7

Browse files
committed
Break out IDEWithStatus conversions
The available IDE conversion will be used when checking for an update,and installed conversion might eventually be used as well (in case thereis a more recent version already installed in the workspace).
1 parent0d954e7 commit14507c7

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

‎src/main/kotlin/com/coder/gateway/models/WorkspaceProjectIDE.kt‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
packagecom.coder.gateway.models
22

33
importcom.intellij.openapi.diagnostic.Logger
4+
importcom.jetbrains.gateway.ssh.AvailableIde
5+
importcom.jetbrains.gateway.ssh.IdeStatus
46
importcom.jetbrains.gateway.ssh.IdeWithStatus
7+
importcom.jetbrains.gateway.ssh.InstalledIdeUIEx
58
importcom.jetbrains.gateway.ssh.IntelliJPlatformProduct
69
importcom.jetbrains.gateway.ssh.deploy.ShellArgument
710
importjava.net.URL
@@ -177,6 +180,32 @@ fun IdeWithStatus.withWorkspaceProject(
177180
lastOpened=null,
178181
)
179182

183+
/**
184+
* Convert an available IDE to an IDE with status.
185+
*/
186+
fun AvailableIde.toIdeWithStatus():IdeWithStatus=IdeWithStatus(
187+
product= product,
188+
buildNumber= buildNumber,
189+
status=IdeStatus.DOWNLOAD,
190+
download= download,
191+
pathOnHost=null,
192+
presentableVersion= presentableVersion,
193+
remoteDevType= remoteDevType,
194+
)
195+
196+
/**
197+
* Convert an installed IDE to an IDE with status.
198+
*/
199+
fun InstalledIdeUIEx.toIdeWithStatus():IdeWithStatus=IdeWithStatus(
200+
product= product,
201+
buildNumber= buildNumber,
202+
status=IdeStatus.ALREADY_INSTALLED,
203+
download=null,
204+
pathOnHost= pathToIde,
205+
presentableVersion= presentableVersion,
206+
remoteDevType= remoteDevType,
207+
)
208+
180209
val remotePathRe=Regex("^[^(]+\\((.+)\\)$")
181210

182211
fun ShellArgument.RemotePath.toRawString():String {

‎src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspaceProjectIDEStepView.kt‎

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.coder.gateway.CoderGatewayBundle
44
importcom.coder.gateway.cli.CoderCLIManager
55
importcom.coder.gateway.icons.CoderIcons
66
importcom.coder.gateway.models.WorkspaceProjectIDE
7+
importcom.coder.gateway.models.toIdeWithStatus
78
importcom.coder.gateway.models.withWorkspaceProject
89
importcom.coder.gateway.sdk.v2.models.Workspace
910
importcom.coder.gateway.sdk.v2.models.WorkspaceAgent
@@ -351,35 +352,14 @@ class CoderWorkspaceProjectIDEStepView(
351352
logger.info("Resolved OS and Arch for$name is:$workspaceOS")
352353
val installedIdesJob=
353354
cs.async(Dispatchers.IO) {
354-
executor.getInstalledIDEs().map { ide->
355-
IdeWithStatus(
356-
ide.product,
357-
ide.buildNumber,
358-
IdeStatus.ALREADY_INSTALLED,
359-
null,
360-
ide.pathToIde,
361-
ide.presentableVersion,
362-
ide.remoteDevType,
363-
)
364-
}
355+
executor.getInstalledIDEs().map { it.toIdeWithStatus() }
365356
}
366357
val idesWithStatusJob=
367358
cs.async(Dispatchers.IO) {
368359
IntelliJPlatformProduct.entries
369360
.filter { it.showInGateway }
370361
.flatMap {CachingProductsJsonWrapper.getInstance().getAvailableIdes(it, workspaceOS) }
371-
.map {
372-
ide->
373-
IdeWithStatus(
374-
ide.product,
375-
ide.buildNumber,
376-
IdeStatus.DOWNLOAD,
377-
ide.download,
378-
null,
379-
ide.presentableVersion,
380-
ide.remoteDevType,
381-
)
382-
}
362+
.map { it.toIdeWithStatus() }
383363
}
384364

385365
val installedIdes= installedIdesJob.await().sorted()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp