@@ -28,9 +28,10 @@ import com.intellij.ide.BrowserUtil
2828import com.intellij.ide.IdeBundle
2929import com.intellij.ide.util.PropertiesComponent
3030import com.intellij.openapi.Disposable
31+ import com.intellij.openapi.actionSystem.AnAction
3132import com.intellij.openapi.actionSystem.AnActionEvent
33+ import com.intellij.openapi.application.ApplicationManager
3234import com.intellij.openapi.application.ModalityState
33- import com.intellij.openapi.application.invokeAndWaitIfNeeded
3435import com.intellij.openapi.components.service
3536import com.intellij.openapi.diagnostic.Logger
3637import com.intellij.openapi.progress.ProgressIndicator
@@ -187,11 +188,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
187188 .disableAddAction()
188189 .disableRemoveAction()
189190 .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 )
195192
196193
197194 private var poller: Job ? = null
@@ -237,13 +234,15 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
237234 override val previousActionText = IdeBundle .message(" button.back" )
238235 override val nextActionText = CoderGatewayBundle .message(" gateway.connector.view.coder.workspaces.next.text" )
239236
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 ) {
241239 override fun actionPerformed (p0 : AnActionEvent ) {
242240 BrowserUtil .browse(coderClient.coderURL)
243241 }
244242 }
245243
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 ) {
247246 override fun actionPerformed (p0 : AnActionEvent ) {
248247 if (tableOfWorkspaces.selectedObject != null ) {
249248 val workspace = tableOfWorkspaces.selectedObject as WorkspaceAgentModel
@@ -261,7 +260,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
261260 }
262261 }
263262
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 ) {
265265 override fun actionPerformed (p0 : AnActionEvent ) {
266266 if (tableOfWorkspaces.selectedObject != null ) {
267267 val workspace = tableOfWorkspaces.selectedObject as WorkspaceAgentModel
@@ -281,7 +281,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
281281 }
282282 }
283283
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 ) {
285286 override fun actionPerformed (p0 : AnActionEvent ) {
286287 if (tableOfWorkspaces.selectedObject != null ) {
287288 val workspace = tableOfWorkspaces.selectedObject as WorkspaceAgentModel
@@ -299,7 +300,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
299300 }
300301 }
301302
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 ) {
303305 override fun actionPerformed (p0 : AnActionEvent ) {
304306 BrowserUtil .browse(coderClient.coderURL.toURI().resolve(" /templates" ))
305307 }
@@ -460,7 +462,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
460462
461463 private fun askToken (): String? {
462464 BrowserUtil .browse(localWizardModel.coderURL.toURL().withPath(" /login?redirect=%2Fcli-auth" ))
463- return invokeAndWaitIfNeeded(ModalityState .any()) {
465+ var tokenFromUser: String? = null
466+ ApplicationManager .getApplication().invokeAndWait({
464467 lateinit var sessionTokenTextField: JBTextField
465468
466469 val panel = panel {
@@ -474,10 +477,11 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
474477
475478 AppIcon .getInstance().requestAttention(null , true )
476479 if (! dialog(CoderGatewayBundle .message(" gateway.connector.view.login.token.dialog" ), panel = panel, focusedComponent = sessionTokenTextField).showAndGet()) {
477- return @invokeAndWaitIfNeeded null
480+ return @invokeAndWait
478481 }
479- return @invokeAndWaitIfNeeded sessionTokenTextField.text
480- }
482+ tokenFromUser = sessionTokenTextField.text
483+ }, ModalityState .any())
484+ return tokenFromUser
481485 }
482486
483487 private fun triggerWorkspacePolling () {
0 commit comments