Mar 7, 2007

Saving dirty editors

If you want to save all the dirty editors before doing any project level operation (such as build/refactor), you might want to show the user the "Save Resources" dialog with the list of dirty editors. This tip tells you how to do that.

{Update}
The first version of this tip had a roundabout way (read: nasty way) of doing it. Thanks to Boris for pointing the right API which does the trick.

PlatformUI.getWorkbench().saveAllEditors(true)

This returns a boolean value, in case the user presses Cancel button and you want to cancel the operation.