protected void formatRegion(IXtextDocument document, int offset, int length) {
		try {
			final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset));
			final int endLineIndex = document.getLineOfOffset(offset + length);
			int regionLength = 0;
			for (int i = startLineIndex; i <= endLineIndex; ++i) {
				regionLength += document.getLineLength(i);
			}
			if (regionLength > 0) {
				final int startOffset = document.getLineOffset(startLineIndex);
				for (final IRegion region : document.computePartitioning(startOffset, regionLength)) {
					this.contentFormatter.format(document, region);
				}
			}
		} catch (BadLocationException exception) {
			Exceptions.sneakyThrow(exception);
		}
	}
protected void formatRegion ( IXtextDocument document , int offset , int length ) { try { final int startLineIndex = document . getLineOfOffset ( previousSiblingChar ( document , offset ) ) ; final int endLineIndex = document . getLineOfOffset ( offset + length ) ; int regionLength = 0 ; for ( int i = startLineIndex ; i <= endLineIndex ; ++ i ) { regionLength += document . getLineLength ( i ) ; } if ( regionLength > 0 ) { final int startOffset = document . getLineOffset ( startLineIndex ) ; for ( final IRegion region : document . computePartitioning ( startOffset , regionLength ) ) { this . contentFormatter . format ( document , region ) ; } } } catch ( BadLocationException exception ) { Exceptions . sneakyThrow ( exception ) ; } }
Called for formatting a region.

@param document the document to format.
@param offset the offset of the text to format.
@param length the length of the text.