我正在开发一个 IntelliJ-idea 插件,并希望在后台任务中运行代码(在后台任务对话框和 UI 之外的另一个线程中可见)。
我找到了以下Helper 类,并通过传递一个 Runnable 对象并实现其 run 方法来尝试它,但它仍然阻塞 UI,当我尝试自己执行线程时,出现以下错误
Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
Details: Current thread: Thread[Thread-69 [WriteAccessToken],6,Idea Thread Group] 532224832
Our dispatch thread:Thread[AWT-EventQueue-1 12.1.4#IU-129.713, eap:false,6,Idea Thread Group] 324031064
SystemEventQueueThread: Thread[AWT-EventQueue-1 12.1.4#IU-129.713, eap:false,6,Idea Thread Group] 324031064