Is saveAll async now?

We have a plugin that opens a browser. The user might be making some changes to some file and then launching a special html file via a keyboard shortcut.
Sometimes the changes made by the user doesn't show up in the browser. We do a saveAll like this:
ApplicationManager.getApplication().saveAll();
but that only helps partially. Reloading the browser helps and walking around in the document a bit before invoking the keyboard shortcut also seem to help.
I'm guessing that the browser is launched so quickly that IDEA doesn't have time to save the document that the web page relies on and that the saveAll is made async.
It makes sense with all the background processing implemented in v9 and this was never a problem for us in IDEA 7.

Is there a way to force the save synchronically?

Is there some event I can listen to so I know that the saveAll has indeed been completed?

1 comment
Comment actions Permalink

Hello Johan,

No, there haven't been any changes to saveAll() - it's still synchronous.

Note that the API you most likely want to use is not saveAll() but rather
FileDocumentManager.saveAllDocuments(). It's faster because it doesn't force
saving the settings, and you probably don't need to save them in order to
show something in the browser.

We have a plugin that opens a browser. The user might be making some
changes to some file and then launching a special html file via a
keyboard shortcut.

Sometimes the changes made by the user doesn't show up in the browser.
We do a saveAll like this:

ApplicationManager.getApplication().saveAll();

but that only helps partially. Reloading the browser helps and walking
around in the document a bit before invoking the keyboard shortcut
also seem to help.

I'm guessing that the browser is launched so quickly that IDEA doesn't
have time to save the document that the web page relies on and that
the saveAll is made async.

It makes sense with all the background processing implemented in v9
and this was never a problem for us in IDEA 7.

Is there a way to force the save synchronically?

Is there some event I can listen to so I know that the saveAll has
indeed been completed?

---
Original message URL:
http://www.jetbrains.net/devnet/message/5248136#5248136

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.