How to perform slow operations in a dialog



My plugin opens up a dialog (using UI DSL 2) where I have two combo boxes.

The first combo box allows the user to select the destination module where a new Groovy class will be generated. Once the combo box changes, a list of abstract inheritors of spock.lang.Specification class is fetched, updating the model of the second combo box.

This inheritor search operation causes an exception saying that Slow operations are prohibited on EDT. I use method with the module.getModuleWithDependenciesAndLibrariesScope() scope.

What is the best way of achieving this?


Hi Pavel,

You can run a non-blocking read action which calculates the result and finishes on EDT/UI thread. Example:

It will execute calculation (using search) on a background thread, and once the result is available, it will execute the code provided to finishOnUiThread in EDT (which should update UI).


I haven't found any nice example like that myself. Thanks, Karol Lewandowski , this helps a lot!!


Please sign in to leave a comment.