Skip to content

Commit bd838ae

Browse files
committed
fix "Service Generator" thread issue
1 parent f9a9dcb commit bd838ae

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/ui/SymfonyCreateService.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,11 @@ private static SymfonyCreateService prepare(@Nullable Component component, @NotN
582582
service.setLocationRelativeTo(component);
583583
}
584584

585-
// https://plugins.jetbrains.com/docs/intellij/general-threading-rules.html#read-access
586-
// fix: "Thread context was already set: com.intellij.openapi.actionSystem.ex.ActionContextElement"
587-
// https://intellij-support.jetbrains.com/hc/en-us/community/posts/14397678486418--Thread-context-was-already-set-CoroutineName-commit-workflow-when-showing-window-during-commit-check?page=1#community_comment_15082225353874
588-
try (var ignored = ThreadContext.resetThreadContext()) {
585+
// The invokeLater() method schedules the setVisible(true) call to run on the EDT asynchronously, which prevents the thread context conflict.
586+
// This is the standard approach for showing dialogs in IntelliJ plugins.
587+
ApplicationManager.getApplication().invokeLater(() -> {
589588
service.setVisible(true);
590-
}
589+
});
591590

592591
return service;
593592
}

0 commit comments

Comments
 (0)