(GEP-24) Save action with format corrupts file

The save action may be configured to both modify the document
by removing trailing spaces and then do a full format.

The save actions were correctly applied to the document inside
a document modify operation but bad things happened when the
format operation was called inside that same operation. The
formatter then attemtped to format the original XtextResource (which
hadn't been altered) yet using the lenght of the modified document
with loss of characters at the end as the result.

This commit ensures that the save actions are committed to the
resource before the formatter kicks in. It also optimizes (per
suggestion in a TODO comment) so that the formatting is performed
using the configured IContentFormatterFactory.
Merge pull request #25 from puppetlabs/issue-24

(GEP-24) Save action with format corrupts file