File tree Expand file tree Collapse file tree 5 files changed +34
-11
lines changed
kotlin/com/redhat/devtools/gateway Expand file tree Collapse file tree 5 files changed +34
-11
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2024 Red Hat, Inc.
2
+ * Copyright (c) 2025 Red Hat, Inc.
3
3
* This program and the accompanying materials are made
4
4
* available under the terms of the Eclipse Public License 2.0
5
5
* which is available at https://www.eclipse.org/legal/epl-2.0/
12
12
package com.redhat.devtools.gateway
13
13
14
14
import com.intellij.openapi.util.IconLoader
15
+ import javax.swing.Icon
15
16
16
17
object DevSpacesIcons {
17
- val LOGO = IconLoader .getIcon(" dev-spaces-logo.svg" , javaClass)
18
+ val LOGO = IconLoader .getIcon(" /icons/dev-spaces-logo.svg" , javaClass)
19
+ val STARTED = IconLoader .getIcon(" /icons/started.svg" , javaClass)
20
+ val STOPPED = IconLoader .getIcon(" /icons/stopped.svg" , javaClass)
21
+
22
+ fun getWorkspacePhaseIcon (phase : String ): Icon ? {
23
+ return when (phase) {
24
+ " Running" -> DevSpacesIcons .STARTED
25
+ " Stopped" -> DevSpacesIcons .STOPPED
26
+ else -> null
27
+ }
28
+ }
29
+
18
30
}
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import com.intellij.util.ui.JBUI
25
25
import com.redhat.devtools.gateway.DevSpacesBundle
26
26
import com.redhat.devtools.gateway.DevSpacesConnection
27
27
import com.redhat.devtools.gateway.DevSpacesContext
28
+ import com.redhat.devtools.gateway.DevSpacesIcons
28
29
import com.redhat.devtools.gateway.openshift.DevWorkspace
29
30
import com.redhat.devtools.gateway.openshift.DevWorkspaces
30
31
import com.redhat.devtools.gateway.openshift.Projects
@@ -250,15 +251,15 @@ class DevSpacesWorkspacesStepView(private var devSpacesContext: DevSpacesContext
250
251
isSelected : Boolean ,
251
252
cellHasFocus : Boolean
252
253
): Component {
253
- return JBLabel (
254
- String .format(
255
- " [%s] %s %s " ,
256
- devWorkspace.phase,
257
- if ( ! multipleNamespaces) " " else (devWorkspace.namespace + " / " ),
258
- devWorkspace.name
259
- )
260
- ). also {
261
- it.font = JBFont .h4().asPlain()
254
+ val icon = DevSpacesIcons .getWorkspacePhaseIcon(devWorkspace.phase)
255
+ return JBLabel (). apply {
256
+ font = JBFont .h4().asPlain()
257
+ border = JBUI . Borders .emptyLeft( 6 )
258
+ icon?. let {
259
+ setIcon(it)
260
+ horizontalTextPosition = JBLabel . TRAILING
261
+ }
262
+ text = " ${ if ( ! multipleNamespaces) " " else (devWorkspace.namespace + " / " )} ${devWorkspace.name} "
262
263
}
263
264
}
264
265
}
File renamed without changes.
You can’t perform that action at this time.
0 commit comments