public static Optional<IRegion> findCellRegion(final IDocument document,final boolean isTsv,final int offset) throws BadLocationException {
  final String prev=offset > 0 ? document.get(offset - 1,1) : "";
  final String next=offset < document.getLength() ? document.get(offset,1) : "";
  if (isInsideSeparator(prev,next,isTsv)) {
    return Optional.absent();
  }
  final int beginOffset=offset - calculateCellRegionBegin(document,isTsv,offset);
  final int endOffset=offset + calculateCellRegionEnd(document,isTsv,offset);
  return Optional.<IRegion>of(new Region(beginOffset,endOffset - beginOffset));
}

public static Optional < IRegion > findCellRegion ( final IDocument document , final boolean isTsv , final int offset ) throws BadLocationException { final String prev = offset > 0 ? document . get ( offset - 1 , 1 ) : "" ; final String next = offset < document . getLength ( ) ? document . get ( offset , 1 ) : "" ; if ( isInsideSeparator ( prev , next , isTsv ) ) { return Optional . absent ( ) ; } final int beginOffset = offset - calculateCellRegionBegin ( document , isTsv , offset ) ; final int endOffset = offset + calculateCellRegionEnd ( document , isTsv , offset ) ; return Optional . < IRegion > of ( new Region ( beginOffset , endOffset - beginOffset ) ) ; }
returns region around offset which constitutes a cell in robot file table . the region is surrounded with file begin or cells separator on the left and by the file end or another cells separator on right . cell separator is at least 2 spaces , tabulator or newline character
