@@ -13,7 +13,6 @@ import com.intellij.openapi.Disposable
1313import com.intellij.openapi.actionSystem.AnActionEvent
1414import com.intellij.openapi.components.service
1515import com.intellij.openapi.project.DumbAwareAction
16- import com.intellij.openapi.ui.DialogPanel
1716import com.intellij.openapi.ui.panel.ComponentPanelBuilder
1817import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
1918import com.intellij.ui.DocumentAdapter
@@ -28,7 +27,6 @@ import com.intellij.ui.dsl.gridLayout.HorizontalAlign
2827import com.intellij.ui.dsl.gridLayout.VerticalAlign
2928import com.intellij.util.ui.JBFont
3029import com.intellij.util.ui.JBUI
31- import com.intellij.util.ui.components.BorderLayoutPanel
3230import com.jetbrains.gateway.api.GatewayRecentConnections
3331import com.jetbrains.gateway.api.GatewayUI
3432import com.jetbrains.gateway.ssh.IntelliJPlatformProduct
@@ -37,17 +35,16 @@ import kotlinx.coroutines.CoroutineScope
3735import kotlinx.coroutines.Dispatchers
3836import kotlinx.coroutines.cancel
3937import kotlinx.coroutines.launch
38+ import java.awt.Component
4039import java.awt.Dimension
4140import javax.swing.JComponent
4241import javax.swing.JLabel
4342import javax.swing.event.DocumentEvent
4443
45- class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections , Disposable {
44+ class CoderGatewayRecentWorkspaceConnectionsView ( private val setContentCallback : ( Component ) -> Unit ) : GatewayRecentConnections, Disposable {
4645 private val recentConnectionsService = service<CoderRecentWorkspaceConnectionsService >()
4746 private val cs = CoroutineScope (Dispatchers .Main )
4847
49- private val rootPanel = BorderLayoutPanel ()
50- private lateinit var contentPanel: DialogPanel
5148 private val recentWorkspacesContentPanel = JBScrollPane ()
5249
5350 private lateinit var searchBar: SearchTextField
@@ -57,7 +54,7 @@ class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections, Dis
5754 override val recentsIcon = CoderIcons .LOGO_16
5855
5956 override fun createRecentsView (lifetime : Lifetime ): JComponent {
60- contentPanel = panel {
57+ return panel {
6158 indent {
6259 row {
6360 label(CoderGatewayBundle .message(" gateway.connector.recentconnections.title" )).applyToComponent {
@@ -82,17 +79,7 @@ class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections, Dis
8279 actionButton(
8380 object : DumbAwareAction (CoderGatewayBundle .message(" gateway.connector.recentconnections.new.wizard.button.tooltip" ), null , AllIcons .General .Add ) {
8481 override fun actionPerformed (e : AnActionEvent ) {
85- rootPanel.apply {
86- removeAll()
87- addToCenter(CoderGatewayConnectorWizardWrapperView {
88- rootPanel.apply {
89- removeAll()
90- addToCenter(contentPanel)
91- updateUI()
92- }
93- }.component)
94- updateUI()
95- }
82+ setContentCallback(CoderGatewayConnectorWizardWrapperView ().component)
9683 }
9784 },
9885 ).gap(RightGap .SMALL )
@@ -110,8 +97,6 @@ class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections, Dis
11097 background = WelcomeScreenUIManager .getMainAssociatedComponentBackground()
11198 border = JBUI .Borders .empty(12 , 0 , 0 , 12 )
11299 }
113-
114- return rootPanel.addToCenter(contentPanel)
115100 }
116101
117102 override fun getRecentsTitle () = CoderGatewayBundle .message(" gateway.connector.title" )
0 commit comments