Skip to content

Commit 68ff70c

Browse files
authored
Use delegated properties with recent connections (coder#337)
From what I understand when you use BaseState you are supposed to use delegation. Something must have changed because this code used to work just as it was, but now it seems without delegation the properties are ignored and we were getting recent entries that were blank (looked like this: `<RecentWorkspaceConnection />`).
1 parent 71086c9 commit 68ff70c

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

src/main/kotlin/com/coder/gateway/models/RecentWorkspaceConnection.kt

+35-11
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,51 @@ import com.intellij.openapi.components.BaseState
44
import com.intellij.util.xmlb.annotations.Attribute
55

66
class RecentWorkspaceConnection(
7+
coderWorkspaceHostname: String? = null,
8+
projectPath: String? = null,
9+
lastOpened: String? = null,
10+
ideProductCode: String? = null,
11+
ideBuildNumber: String? = null,
12+
downloadSource: String? = null,
13+
idePathOnHost: String? = null,
14+
webTerminalLink: String? = null,
15+
configDirectory: String? = null,
16+
name: String? = null,
17+
) : BaseState(), Comparable<RecentWorkspaceConnection> {
718
@get:Attribute
8-
var coderWorkspaceHostname: String? = null,
19+
var coderWorkspaceHostname by string()
920
@get:Attribute
10-
var projectPath: String? = null,
21+
var projectPath by string()
1122
@get:Attribute
12-
var lastOpened: String? = null,
23+
var lastOpened by string()
1324
@get:Attribute
14-
var ideProductCode: String? = null,
25+
var ideProductCode by string()
1526
@get:Attribute
16-
var ideBuildNumber: String? = null,
27+
var ideBuildNumber by string()
1728
@get:Attribute
18-
var downloadSource: String? = null,
29+
var downloadSource by string()
1930
@get:Attribute
20-
var idePathOnHost: String? = null,
31+
var idePathOnHost by string()
2132
@get:Attribute
22-
var webTerminalLink: String? = null,
33+
var webTerminalLink by string()
2334
@get:Attribute
24-
var configDirectory: String? = null,
35+
var configDirectory by string()
2536
@get:Attribute
26-
var name: String? = null,
27-
) : BaseState(), Comparable<RecentWorkspaceConnection> {
37+
var name by string()
38+
39+
init {
40+
this.coderWorkspaceHostname = coderWorkspaceHostname
41+
this.projectPath = projectPath
42+
this.lastOpened = lastOpened
43+
this.ideProductCode = ideProductCode
44+
this.ideBuildNumber = ideBuildNumber
45+
this.downloadSource = downloadSource
46+
this.idePathOnHost = idePathOnHost
47+
this.webTerminalLink = webTerminalLink
48+
this.configDirectory = configDirectory
49+
this.name = name
50+
}
51+
2852
override fun equals(other: Any?): Boolean {
2953
if (this === other) return true
3054
if (javaClass != other?.javaClass) return false

0 commit comments

Comments
 (0)