private static void drawTextClipped(@NotNull GC gc, @NotNull String text, @NotNull Rectangle bounds) {
        Point extent = gc.textExtent(text);

        if (extent.x > bounds.width) {
            int low = 0;
            int high = text.length();
            String clipped = text;

            while (low <= high) {
                int mid = (low + high) >>> 1;
                clipped = text.substring(0, mid);
                int ext = gc.textExtent(clipped + "...").x;

                if (ext < bounds.width) {
                    low = mid + 1;
                } else if (ext > bounds.width) {
                    high = mid - 1;
                } else {
                    break;
                }
            }

            if (clipped.isEmpty()) {
                return;
            }

            drawTextSegment(gc, clipped, bounds);
            drawTextSegment(gc, "...", bounds);
        } else {
            drawTextSegment(gc, text, bounds);
        }
    }
Statistics node renderer.
Draws connection type marker next to the item name.
Draws item statistics in the right part.
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/StatisticsNavigatorNodeRenderer.java