@@ -14,14 +14,14 @@ import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
14
14
import com.intellij.remote.AuthType
15
15
import com.intellij.remote.RemoteCredentialsHolder
16
16
import com.intellij.ui.AnimatedIcon
17
+ import com.intellij.ui.ColoredListCellRenderer
17
18
import com.intellij.ui.components.JBTextField
18
19
import com.intellij.ui.dsl.builder.BottomGap
19
20
import com.intellij.ui.dsl.builder.RowLayout
20
21
import com.intellij.ui.dsl.builder.TopGap
21
22
import com.intellij.ui.dsl.builder.panel
22
23
import com.intellij.ui.dsl.gridLayout.HorizontalAlign
23
24
import com.intellij.util.ui.JBFont
24
- import com.intellij.util.ui.JBUI
25
25
import com.intellij.util.ui.UIUtil
26
26
import com.jetbrains.gateway.api.GatewayUI
27
27
import com.jetbrains.gateway.ssh.CachingProductsJsonWrapper
@@ -47,7 +47,6 @@ class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
47
47
private val cs = CoroutineScope (Dispatchers .Main )
48
48
private val coderClient: CoderRestClientService = ApplicationManager .getApplication().getService(CoderRestClientService ::class .java)
49
49
50
- private val spinner = JLabel (" " , AnimatedIcon .Default (), SwingConstants .LEFT )
51
50
private var ideComboBoxModel = DefaultComboBoxModel <IdeWithStatus >()
52
51
53
52
private lateinit var titleLabel: JLabel
@@ -127,7 +126,6 @@ class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
127
126
if (idesWithStatus.isEmpty()) {
128
127
logger.warn(" Could not resolve any IDE for workspace ${selectedWorkspace.name} , probably $workspaceOS is not supported by Gateway" )
129
128
} else {
130
- cbIDE.remove(spinner)
131
129
ideComboBoxModel.addAll(idesWithStatus)
132
130
cbIDE.selectedIndex = 0
133
131
}
@@ -162,29 +160,39 @@ class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
162
160
}
163
161
164
162
private class IDEComboBox (model : ComboBoxModel <IdeWithStatus >) : ComboBox<IdeWithStatus>(model) {
163
+
164
+ init {
165
+ putClientProperty(AnimatedIcon .ANIMATION_IN_RENDERER_ALLOWED , true )
166
+ }
167
+
165
168
override fun getSelectedItem (): IdeWithStatus ? {
166
169
return super .getSelectedItem() as IdeWithStatus ?
167
170
}
168
171
}
169
172
170
173
private class IDECellRenderer : ListCellRenderer <IdeWithStatus > {
174
+ private val loadingComponentRenderer: ListCellRenderer <IdeWithStatus > = object : ColoredListCellRenderer <IdeWithStatus >() {
175
+ override fun customizeCellRenderer (list : JList <out IdeWithStatus >, value : IdeWithStatus ? , index : Int , isSelected : Boolean , cellHasFocus : Boolean ) {
176
+ background = UIUtil .getListBackground(isSelected, cellHasFocus)
177
+ icon = AnimatedIcon .Default .INSTANCE
178
+ append(CoderGatewayBundle .message(" gateway.connector.view.coder.remoteproject.loading.text" ))
179
+ }
180
+ }
181
+
171
182
override fun getListCellRendererComponent (list : JList <out IdeWithStatus >? , ideWithStatus : IdeWithStatus ? , index : Int , isSelected : Boolean , cellHasFocus : Boolean ): Component {
172
183
return if (ideWithStatus == null && index == - 1 ) {
173
- JPanel ().apply {
174
- layout = FlowLayout (FlowLayout .LEFT )
175
- add(JLabel (" Retrieving products..." , AnimatedIcon .Default (), SwingConstants .LEFT ))
176
- }
184
+ loadingComponentRenderer.getListCellRendererComponent(list, null , - 1 , isSelected, cellHasFocus)
177
185
} else if (ideWithStatus != null ) {
178
186
JPanel ().apply {
179
187
layout = FlowLayout (FlowLayout .LEFT )
180
188
add(JLabel (ideWithStatus.product.ideName, ideWithStatus.product.icon, SwingConstants .LEFT ))
181
189
add(JLabel (" ${ideWithStatus.product.productCode} ${ideWithStatus.presentableVersion} ${ideWithStatus.buildNumber} | ${ideWithStatus.status.name.toLowerCase()} " ).apply {
182
190
foreground = UIUtil .getLabelDisabledForeground()
183
191
})
184
- background = JBUI . CurrentTheme . List .background (isSelected, cellHasFocus)
192
+ background = UIUtil .getListBackground (isSelected, cellHasFocus)
185
193
}
186
194
} else {
187
- JPanel ()
195
+ panel { }
188
196
}
189
197
}
190
198
}
0 commit comments