Asking to save the active editors in Eclipse

Hi,

After some very busy months, I am going to try to resume on my blogging activity. Here is a very small tip. It is not very difficult by itself, but it took me a little time to find it.

While starting a new wizard, I wanted to be sure that the open editors were saved. I supposed there was a common way to do this in Eclipse, rather than implementing it from zero. I eventually found it, but that was not so easy to find.

In fact, just use:

PlatformUI.getWorkbench().saveAllEditors( true );

It results in this usual question dialog in Eclipse:

The question dialog to ask if dirty editors should be saved


About this entry