code: public int getSpaceSize(IXtextDocument document, int offset) throws BadLocationException {
  		int size = 0;
  		char c = document.getChar(offset + size);
  		while (Character.isWhitespace(c)) {
  			size++;
  			c = document.getChar(offset + size);
  		}
  		return size;
  	}
docs: Replies the size of a sequence of whitespaces.
  
  @param document the document.
  @param offset the offset of the first character of the sequence.
  @return the number of whitespaces at the given offset.
  @throws BadLocationException if there is a problem with the location of the element.