Background events

Can anyone give me any tips for handling background jobs that need to
update a tool window? Is there any built in support in idea for
handling this?

3 comments

Glen Stampoultzis wrote:

Can anyone give me any tips for handling background jobs that need to
update a tool window? Is there any built in support in idea for
handling this?

Doing activity in other thread and using
ApplicationManager.getApplication().invokeLater() to update view would
be fine. Do you need something advanced to control backround jobs?
Priorities maybe?

--
Maxim Shafirov
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0

Maxim Shafirov (JetBrains) wrote:

Glen Stampoultzis wrote:

>> Can anyone give me any tips for handling background jobs that need to
>> update a tool window? Is there any built in support in idea for
>> handling this?


Doing activity in other thread and using
ApplicationManager.getApplication().invokeLater() to update view would
be fine. Do you need something advanced to control backround jobs?
Priorities maybe?


That is the sort of information I was after. How is this invoke later
different to the one in SwingUtils? Is there anything else in the API
that might be useful to know?

0

Application.invokeLater() is able to suspend invocation request until
requested modality state is reached in IDEA UI.
ModalityState encapsulates the configuration of modal dialogs (including
progress indicator) being shown if any.

InvokeLater() being called without ModaliltyState parameter will pass
default modality state wich would be as follows:
1. When invoked from swing dispatch thread: current configuration of the
dialogs
2. When invoked from other thread: NON_MODAL (no dialogs opened).

In your case calling to Application.invokeLater() with default modality
state would result in toolwindow updates only when there's no any
activity in the foreground.

--
Maxim Shafirov
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.