top = Math.max(0, Math.min(lines - 1, top));
bottom = Math.max(0, Math.min(lines - 1, bottom));
int start = document.getLineOffset(top);
if (start == -1)
throw new BadLocationException("Start line -1");
int end = document.getLineOffset(bottom);
if (end == -1 || end < start)
throw new BadLocationException("End line -1 or less than start");
SarosAnnotation annotation = new ViewportAnnotation(source);
Position position = new Position(start, end - start);
model.addAnnotation(annotation, position);
} catch (BadLocationException e) {
log.warn("Internal Error:", e);