The question dialog to ask if dirty editors should be saved

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s