You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: centralize all toolbox services in a context
- service dependencies were resolved all over the place making refactoring harder
- it promoted implicit, hidden dependencies
- and also introduced tighter coupling between components.
- in some cases we had to provide some i18n strings from upstream because the localization service
was not available in the constructor.
With this patch we resolve all the needed services during plugin load, wrap them in a context and inject
the context via the constructor. It is now easier to refactor and the number of constructor parameters has
been reduced.
@@ -137,43 +128,42 @@ class CoderRemoteEnvironment(
137
128
// }
138
129
139
130
overridefunonDelete() {
140
-
cs.launch {
131
+
context.cs.launch {
141
132
// TODO info and cancel pop-ups only appear on the main page where all environments are listed.
142
133
// However, #showSnackbar works on other pages. Until JetBrains fixes this issue we are going to use the snackbar
143
134
val shouldDelete =if (wsRawStatus.canStop()) {
144
-
ui.showOkCancelPopup(
145
-
i18n.ptrl("Delete running workspace?"),
146
-
i18n.ptrl("Workspace will be closed and all the information in this workspace will be lost, including all files, unsaved changes and historical."),
147
-
i18n.ptrl("Delete"),
148
-
i18n.ptrl("Cancel")
135
+
context.ui.showOkCancelPopup(
136
+
context.i18n.ptrl("Delete running workspace?"),
137
+
context.i18n.ptrl("Workspace will be closed and all the information in this workspace will be lost, including all files, unsaved changes and historical."),
138
+
context.i18n.ptrl("Delete"),
139
+
context.i18n.ptrl("Cancel")
149
140
)
150
141
} else {
151
-
ui.showOkCancelPopup(
152
-
i18n.ptrl("Delete workspace?"),
153
-
i18n.ptrl("All the information in this workspace will be lost, including all files, unsaved changes and historical."),
154
-
i18n.ptrl("Delete"),
155
-
i18n.ptrl("Cancel")
142
+
context.ui.showOkCancelPopup(
143
+
context.i18n.ptrl("Delete workspace?"),
144
+
context.i18n.ptrl("All the information in this workspace will be lost, including all files, unsaved changes and historical."),
145
+
context.i18n.ptrl("Delete"),
146
+
context.i18n.ptrl("Cancel")
156
147
)
157
148
}
158
149
if (shouldDelete) {
159
150
try {
160
151
client.removeWorkspace(workspace)
161
-
cs.launch {
152
+
context.cs.launch {
162
153
withTimeout(5.minutes) {
163
154
var workspaceStillExists =true
164
-
while (cs.isActive && workspaceStillExists) {
155
+
while (context.cs.isActive && workspaceStillExists) {
165
156
if (wsRawStatus ==WorkspaceAndAgentStatus.DELETING|| wsRawStatus ==WorkspaceAndAgentStatus.DELETED) {
0 commit comments