protected void _format(XtextResource resource, IFormattableDocument document) {
		List<EObject> contents = resource.getContents();
		if (!contents.isEmpty()) {
			EObject model = contents.get(0);
			document.format(model);
		}
	}
protected void _format ( XtextResource resource , IFormattableDocument document ) { List < EObject > contents = resource . getContents ( ) ; if ( ! contents . isEmpty ( ) ) { EObject model = contents . get ( 0 ) ; document . format ( model ) ; } }
For {@link XtextResource resources}, assume we want to format the first EObject from the contents list only.
Because that's where the parser puts the semantic model.