code: private IRegion getTextBlockFromSelection(ITextSelection selection, IDocument document) {
  
  		try {
  			IRegion line= document.getLineInformationOfOffset(selection.getOffset());
  			int length= selection.getLength() == 0 ? line.getLength() : selection.getLength() + (selection.getOffset() - line.getOffset());
  			return new Region(line.getOffset(), length);
  
  		} catch (BadLocationException x) {
  			// should not happen
  			VdmUIPlugin.log(x);
  		}
  
  		return null;
  	}
docs: Creates a region describing the text block (something that starts at
  the beginning of a line) completely containing the current selection.
  
  @param selection The selection to use
  @param document The document
  @return the region describing the text block comprising the given selection