我正在开发IntelliJ-idea插件,并希望在后台任务中运行代码(在后台任务对话框和UI之外的其他线程中可见)。>>
我发现以下Helper class,并通过传递一个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
我正在开发IntelliJ-idea插件,并希望在后台任务中运行代码(在后台任务对话框和UI之外的其他线程中可见)。我找到了以下Helper类,并尝试了...
这是一般解决方案
我发现了一种更好的方式将流程作为后台任务运行,您可以在其中更新进度条的百分比和文本