public static void drawFirstLine(
        String text,
        GC gc,
        StyledText textWidget,
        int widgetOffset
    ) {
        if (gc == null) {
            return;
        }
        widgetOffset = Math.max(0, Math.min(widgetOffset, textWidget.getCharCount()));

        int line;
        try {
            line = textWidget.getLineAtOffset(widgetOffset);
        } catch (IllegalArgumentException e) {
            return;
        }
        int bias = calculateBaselineOffset(gc, textWidget, line);

        Point origin;
        try {
            origin = textWidget.getLocationAtOffset(widgetOffset);
        } catch (IllegalArgumentException e) {
            origin = textWidget.getLocationAtOffset(textWidget.getCharCount() - 1);
            origin.y += textWidget.getLineHeight();
            origin.x = textWidget.getLeftMargin();
        }

        FontMetrics fm = gc.getFontMetrics();
        int fontHeight = fm.getHeight();
        int lineHeight = textWidget.getLineHeight();
        int verticalPosition = origin.y + (lineHeight - fontHeight) + bias;

        if (text != null) {
            text = trimOverlappingText(text, widgetOffset, textWidget);
            gc.drawString(text, origin.x, verticalPosition, true);
        }
    }
Renders first line of hint text
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/suggestion/TextRenderingUtils.java