@@ -28,9 +28,10 @@ import com.intellij.ide.BrowserUtil
28
28
import com.intellij.ide.IdeBundle
29
29
import com.intellij.ide.util.PropertiesComponent
30
30
import com.intellij.openapi.Disposable
31
+ import com.intellij.openapi.actionSystem.AnAction
31
32
import com.intellij.openapi.actionSystem.AnActionEvent
33
+ import com.intellij.openapi.application.ApplicationManager
32
34
import com.intellij.openapi.application.ModalityState
33
- import com.intellij.openapi.application.invokeAndWaitIfNeeded
34
35
import com.intellij.openapi.components.service
35
36
import com.intellij.openapi.diagnostic.Logger
36
37
import com.intellij.openapi.progress.ProgressIndicator
@@ -187,11 +188,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
187
188
.disableAddAction()
188
189
.disableRemoveAction()
189
190
.disableUpDownActions()
190
- .addExtraAction(goToDashboardAction)
191
- .addExtraAction(startWorkspaceAction)
192
- .addExtraAction(stopWorkspaceAction)
193
- .addExtraAction(updateWorkspaceTemplateAction)
194
- .addExtraAction(createWorkspaceAction)
191
+ .addExtraActions(goToDashboardAction, startWorkspaceAction, stopWorkspaceAction, updateWorkspaceTemplateAction, createWorkspaceAction as AnAction )
195
192
196
193
197
194
private var poller: Job ? = null
@@ -237,13 +234,15 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
237
234
override val previousActionText = IdeBundle .message(" button.back" )
238
235
override val nextActionText = CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.next.text" )
239
236
240
- private inner class GoToDashboardAction : AnActionButton (CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.dashboard.text"), CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.dashboard.text"), CoderIcons .HOME ) {
237
+ private inner class GoToDashboardAction :
238
+ AnActionButton (CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.dashboard.text" ), CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.dashboard.text" ), CoderIcons .HOME ) {
241
239
override fun actionPerformed (p0 : AnActionEvent ) {
242
240
BrowserUtil .browse(coderClient.coderURL)
243
241
}
244
242
}
245
243
246
- private inner class StartWorkspaceAction : AnActionButton (CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.start.text"), CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.start.text"), CoderIcons .RUN ) {
244
+ private inner class StartWorkspaceAction :
245
+ AnActionButton (CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.start.text" ), CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.start.text" ), CoderIcons .RUN ) {
247
246
override fun actionPerformed (p0 : AnActionEvent ) {
248
247
if (tableOfWorkspaces.selectedObject != null ) {
249
248
val workspace = tableOfWorkspaces.selectedObject as WorkspaceAgentModel
@@ -261,7 +260,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
261
260
}
262
261
}
263
262
264
- private inner class UpdateWorkspaceTemplateAction : AnActionButton (CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.update.text"), CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.update.text"), CoderIcons .UPDATE ) {
263
+ private inner class UpdateWorkspaceTemplateAction :
264
+ AnActionButton (CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.update.text" ), CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.update.text" ), CoderIcons .UPDATE ) {
265
265
override fun actionPerformed (p0 : AnActionEvent ) {
266
266
if (tableOfWorkspaces.selectedObject != null ) {
267
267
val workspace = tableOfWorkspaces.selectedObject as WorkspaceAgentModel
@@ -281,7 +281,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
281
281
}
282
282
}
283
283
284
- private inner class StopWorkspaceAction : AnActionButton (CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.stop.text"), CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.stop.text"), CoderIcons .STOP ) {
284
+ private inner class StopWorkspaceAction :
285
+ AnActionButton (CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.stop.text" ), CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.stop.text" ), CoderIcons .STOP ) {
285
286
override fun actionPerformed (p0 : AnActionEvent ) {
286
287
if (tableOfWorkspaces.selectedObject != null ) {
287
288
val workspace = tableOfWorkspaces.selectedObject as WorkspaceAgentModel
@@ -299,7 +300,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
299
300
}
300
301
}
301
302
302
- private inner class CreateWorkspaceAction : AnActionButton (CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.create.text"), CoderGatewayBundle .message("gateway.connector.view.coder.workspaces.create.text"), CoderIcons .CREATE ) {
303
+ private inner class CreateWorkspaceAction :
304
+ AnActionButton (CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.create.text" ), CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.create.text" ), CoderIcons .CREATE ) {
303
305
override fun actionPerformed (p0 : AnActionEvent ) {
304
306
BrowserUtil .browse(coderClient.coderURL.toURI().resolve(" /templates" ))
305
307
}
@@ -460,7 +462,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
460
462
461
463
private fun askToken (): String? {
462
464
BrowserUtil .browse(localWizardModel.coderURL.toURL().withPath(" /login?redirect=%2Fcli-auth" ))
463
- return invokeAndWaitIfNeeded(ModalityState .any()) {
465
+ var tokenFromUser: String? = null
466
+ ApplicationManager .getApplication().invokeAndWait({
464
467
lateinit var sessionTokenTextField: JBTextField
465
468
466
469
val panel = panel {
@@ -474,10 +477,11 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
474
477
475
478
AppIcon .getInstance().requestAttention(null , true )
476
479
if (! dialog(CoderGatewayBundle .message(" gateway.connector.view.login.token.dialog" ), panel = panel, focusedComponent = sessionTokenTextField).showAndGet()) {
477
- return @invokeAndWaitIfNeeded null
480
+ return @invokeAndWait
478
481
}
479
- return @invokeAndWaitIfNeeded sessionTokenTextField.text
480
- }
482
+ tokenFromUser = sessionTokenTextField.text
483
+ }, ModalityState .any())
484
+ return tokenFromUser
481
485
}
482
486
483
487
private fun triggerWorkspacePolling () {
0 commit comments