19
19
import com .intellij .openapi .progress .ProgressIndicator ;
20
20
import com .intellij .openapi .progress .ProgressManager ;
21
21
import com .intellij .openapi .progress .Task ;
22
+ import com .intellij .openapi .project .DumbService ;
22
23
import com .intellij .openapi .project .Project ;
23
24
import com .intellij .openapi .roots .*;
24
25
import com .intellij .openapi .roots .impl .OrderEntryUtil ;
37
38
import com .redhat .devtools .intellij .quarkus .telemetry .TelemetryManager ;
38
39
import org .jetbrains .annotations .NotNull ;
39
40
import org .jetbrains .annotations .Nullable ;
40
- import org .jetbrains .idea .maven .utils .MavenUtil ;
41
41
import org .slf4j .Logger ;
42
42
import org .slf4j .LoggerFactory ;
43
43
@@ -148,12 +148,14 @@ private synchronized static CompletableFuture<Void> internalUpdateClasspathWithQ
148
148
}
149
149
var project = module .getProject ();
150
150
final CompletableFuture <Void > future = new CompletableFuture <>();
151
- MavenUtil .invokeAndWait (project , () -> ProgressManager .getInstance ().run (new Task .Backgroundable (project , "Adding Quarkus deployment dependencies to classpath..." ) {
151
+ CompletableFuture .runAsync (() -> {
152
+ Runnable task = () -> ProgressManager .getInstance ().run (new Task .Backgroundable (project , "Adding Quarkus deployment dependencies to classpath..." ) {
152
153
@ Override
153
154
public void run (@ NotNull ProgressIndicator indicator ) {
154
155
try {
155
156
long start = System .currentTimeMillis ();
156
157
ProgressIndicator wrappedIndicator = new ProgressIndicatorWrapper (indicator ) {
158
+
157
159
@ Override
158
160
public boolean isCanceled () {
159
161
return super .isCanceled () || future .isCancelled ();
@@ -174,7 +176,13 @@ public boolean isCanceled() {
174
176
future .completeExceptionally (e );
175
177
}
176
178
}
177
- }));
179
+ });
180
+ if (DumbService .getInstance (project ).isDumb ()) {
181
+ DumbService .getInstance (project ).runWhenSmart (task );
182
+ } else {
183
+ task .run ();
184
+ }
185
+ });
178
186
module .putUserData (QUARKUS_DEPLOYMENT_SUPPORT_KEY , future );
179
187
return future ;
180
188
}
0 commit comments