How to run a huge process without UI freezing?

Hello all,

I tried to run a huge process in a ToolWindow.show method, something like that:

toolWindow.show( new MyRunner(currentProject) ); // Inside MyRunner I calculate some information and it could spend some time


and it causes IDE's UI freezing.

I don't understand why did it happen, because Idea runs my code into another thread, so, UI mustn't be freezed.

Could you please advise anything that could help me?

1 comment
Comment actions Permalink

Actually your Runnable is executed in the event dispatch thread. It's asynchronous only in the sense that it can be executed after the return from the show() call.

To execute actions in a background thread, use APIs like Application.executeOnPooledThread() or Task.Backgroundable.

0

Please sign in to leave a comment.