@Override
    public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
        try {
            int linePosition = sourceViewer.getDocument().getLineOffset(lineNumber);
            int lineLength = sourceViewer.getDocument().getLineLength(lineNumber);
            StringBuilder sb = new StringBuilder();
            for (Iterator<Annotation> ai = sourceViewer.getAnnotationModel().getAnnotationIterator(); ai.hasNext(); ) {
                Annotation anno = ai.next();
                if (isSupportedAnnotation(anno)) {
                    Position annoPosition = sourceViewer.getAnnotationModel().getPosition(anno);
                    if (annoPosition != null) {
                        if (annoPosition.overlapsWith(linePosition, lineLength)) {
                            sb.append(anno.getText()).append("; ");
                        }
                    }
                }
            }
            return sb.isEmpty() ? null : sb.toString();
        } catch (BadLocationException e) {
            log.debug(e);
            return null;
        }
    }
Show info from annotations on the specified line
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/util/SQLAnnotationHover.java