code: 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;
  	}
docs: Returns the index of the first line whose start offset is in the given text range.
  
  @param region the text range in characters where to find the line
  @param document The document
  @return the first line whose start index is in the given range, -1 if there is no such line