@@ -3,17 +3,23 @@ package org.tabooproject.development.step
3
3
import ai.grazie.utils.capitalize
4
4
import com.intellij.ide.util.projectWizard.ModuleWizardStep
5
5
import com.intellij.ide.util.projectWizard.WizardContext
6
+ import com.intellij.ide.wizard.AbstractWizard
7
+ import com.intellij.openapi.application.ApplicationManager
6
8
import com.intellij.openapi.progress.ProgressManager
9
+ import com.intellij.openapi.ui.DialogBuilder
10
+ import com.intellij.openapi.ui.ex.MultiLineLabel
7
11
import com.intellij.openapi.util.ThrowableComputable
8
12
import com.intellij.ui.dsl.builder.columns
9
13
import com.intellij.ui.dsl.builder.panel
14
+ import com.intellij.util.xml.ui.MultiLineTextPanel
10
15
import kotlinx.coroutines.DelicateCoroutinesApi
11
16
import kotlinx.coroutines.GlobalScope
12
17
import kotlinx.coroutines.coroutineScope
13
18
import kotlinx.coroutines.launch
14
19
import org.tabooproject.development.component.CheckModulePanel
15
20
import org.tabooproject.development.util.ResourceLoader
16
21
import org.tabooproject.development.util.ResourceLoader.loadModules
22
+ import java.lang.reflect.Method
17
23
import javax.swing.JComponent
18
24
import javax.swing.JTextField
19
25
@@ -132,13 +138,35 @@ class ConfigurationPropertiesStep(val context: WizardContext) : ModuleWizardStep
132
138
}
133
139
}
134
140
141
+ private val doPreviousActionMethod: Method by lazy {
142
+ AbstractWizard ::class .java.getDeclaredMethod(" doPreviousAction" ).apply {
143
+ isAccessible = true
144
+ }
145
+ }
146
+
135
147
@OptIn(DelicateCoroutinesApi ::class )
136
148
override fun _init () {
137
149
if (inited) return
138
150
139
151
ProgressManager .getInstance().runProcessWithProgressSynchronously(
140
152
ThrowableComputable {
141
- loadModules()
153
+ try {
154
+ loadModules()
155
+ } catch (e: Exception ) {
156
+ val wizard = context.getUserData(AbstractWizard .KEY )
157
+ doPreviousActionMethod.invoke(wizard)
158
+
159
+ ApplicationManager .getApplication().invokeLater {
160
+ DialogBuilder ().apply {
161
+ setTitle(" Download module list failed" )
162
+ setCenterPanel(MultiLineLabel (e.message).apply {
163
+
164
+ })
165
+ addCancelAction().setText(" Cancel" )
166
+ }.show()
167
+ }
168
+ throw e
169
+ }
142
170
},
143
171
" Downloading modules list" , false , context.project
144
172
)
0 commit comments