private int getFirstCompleteLineOfRegion ( IRegion region , IDocument document ) { try { int startLine = document . getLineOfOffset ( region . getOffset ( ) ) ; int offset = document . getLineOffset ( startLine ) ; if ( offset >= region . getOffset ( ) ) return startLine ; offset = document . getLineOffset ( startLine + 1 ) ; return ( offset > region . getOffset ( ) + region . getLength ( ) ? - 1 : startLine + 1 ) ; } catch ( BadLocationException x ) { // should not happen VdmUIPlugin . log ( x ) ; } return - 1 ; }
Returns the index of the first line whose start offset is in the given text range .