/** * Convenience method * * @param inWidget * {@link StyledText} * @return {@link PaintObjectListener} */ public static PaintObjectListener getPaintObjectListener( final StyledText inWidget) { return new PaintObjectListener() { @Override public void paintObject(final PaintObjectEvent inEvent) { final Display lDisplay = inEvent.display; final StyleRange lStyle = inEvent.style; final int lPosition = inEvent.x + lStyle.metrics.width - BULLET_WIDTH + 2; Font lFont = lStyle.font; if (lFont == null) lFont = inWidget.getFont(); final TextLayout lLayout = new TextLayout(lDisplay); lLayout.setAscent(inEvent.ascent); lLayout.setDescent(inEvent.descent); lLayout.setFont(lFont); lLayout.setText(String.format("%s.", inEvent.bulletIndex + 1)); //$NON-NLS-1$ lLayout.draw(inEvent.gc, lPosition, inEvent.y); lLayout.dispose(); } }; }