1919import com .intellij .openapi .progress .ProgressIndicator ;
2020import com .intellij .openapi .progress .ProgressManager ;
2121import com .intellij .openapi .progress .Task ;
22+ import com .intellij .openapi .project .DumbService ;
2223import com .intellij .openapi .project .Project ;
2324import com .intellij .openapi .roots .*;
2425import com .intellij .openapi .roots .impl .OrderEntryUtil ;
3738import com .redhat .devtools .intellij .quarkus .telemetry .TelemetryManager ;
3839import org .jetbrains .annotations .NotNull ;
3940import org .jetbrains .annotations .Nullable ;
40- import org .jetbrains .idea .maven .utils .MavenUtil ;
4141import org .slf4j .Logger ;
4242import org .slf4j .LoggerFactory ;
4343
@@ -148,12 +148,14 @@ private synchronized static CompletableFuture<Void> internalUpdateClasspathWithQ
148148 }
149149 var project = module .getProject ();
150150 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..." ) {
152153 @ Override
153154 public void run (@ NotNull ProgressIndicator indicator ) {
154155 try {
155156 long start = System .currentTimeMillis ();
156157 ProgressIndicator wrappedIndicator = new ProgressIndicatorWrapper (indicator ) {
158+
157159 @ Override
158160 public boolean isCanceled () {
159161 return super .isCanceled () || future .isCancelled ();
@@ -174,7 +176,13 @@ public boolean isCanceled() {
174176 future .completeExceptionally (e );
175177 }
176178 }
177- }));
179+ });
180+ if (DumbService .getInstance (project ).isDumb ()) {
181+ DumbService .getInstance (project ).runWhenSmart (task );
182+ } else {
183+ task .run ();
184+ }
185+ });
178186 module .putUserData (QUARKUS_DEPLOYMENT_SUPPORT_KEY , future );
179187 return future ;
180188 }
0 commit comments