Skip to content

Commit 2929b0e

Browse files
committed
refactor: reuse block of code
- to pop-up Toolbox window when it's not showing.
1 parent 0bdd3ff commit 2929b0e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt

+3-6
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ open class CoderProtocolHandler(
157157
reInitialize(restClient, cli)
158158

159159
val environmentId = "${workspace.name}.${agent.name}"
160-
context.ui.showWindow()
161-
context.envPageManager.showPluginEnvironmentsPage(true)
160+
context.popupPluginMainPage()
162161
context.envPageManager.showEnvironmentPage(environmentId, false)
163162
val productCode = params.ideProductCode()
164163
val buildNumber = params.ideBuildNumber()
@@ -193,8 +192,7 @@ open class CoderProtocolHandler(
193192
}
194193

195194
private suspend fun askUrl(): String? {
196-
context.ui.showWindow()
197-
context.envPageManager.showPluginEnvironmentsPage(false)
195+
context.popupPluginMainPage()
198196
return dialogUi.ask(
199197
context.i18n.ptrl("Deployment URL"),
200198
context.i18n.ptrl("Enter the full URL of your Coder deployment")
@@ -216,8 +214,7 @@ open class CoderProtocolHandler(
216214
if (!tryToken.isNullOrBlank()) {
217215
tryToken
218216
} else {
219-
context.ui.showWindow()
220-
context.envPageManager.showPluginEnvironmentsPage(false)
217+
context.popupPluginMainPage()
221218
// Otherwise ask for a new token, showing the previous token.
222219
dialogUi.askToken(deploymentURL.toURL())
223220
}

0 commit comments

Comments
 (0)