public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
Color color) {
if (length > 0) {
if ((annotation instanceof EclipseAnnotationPeer)) {
AnnotationFS annotationFS = ((EclipseAnnotationPeer) annotation).getAnnotationFS();
if (gc != null) {
Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);
gc.setForeground(color);
boolean isDrawOpenBracket = annotationFS.getBegin() == offset;
// and no space before offset
if (isDrawOpenBracket && offset > 1 && !isWhitespace(textWidget, offset - 1)) {
gc.drawLine(bounds.x, bounds.y + bounds.height - 1, bounds.x + BRACKET_WIDTH, bounds.y
+ bounds.height - 1);
gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);
gc.drawLine(bounds.x, bounds.y, bounds.x + BRACKET_WIDTH, bounds.y);
}
boolean isDrawCloseBracket = annotationFS.getEnd() == offset + length;
// and no space after offset
if (isDrawCloseBracket && offset + length <= textWidget.getText().length()
&& !isWhitespace(textWidget, offset + length)) {
gc.drawLine(bounds.x + bounds.width, bounds.y + bounds.height - 1, bounds.x
+ bounds.width - BRACKET_WIDTH, bounds.y + bounds.height - 1);