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 .