在 IntelliJ 插件中创建后台任务
2022-09-03 13:04:51
我正在开发一个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