use of org.eclipse.swt.custom.Bullet in project eclipse.platform.swt by eclipse.
the class TextEditor method setBullet.
void setBullet(int type) {
Point selection = styledText.getSelection();
int lineStart = styledText.getLineAtOffset(selection.x);
int lineEnd = styledText.getLineAtOffset(selection.y);
StyleRange styleRange = new StyleRange();
styleRange.metrics = new GlyphMetrics(0, 0, BULLET_WIDTH);
Bullet bullet = new Bullet(type, styleRange);
bullet.text = ".";
for (int lineIndex = lineStart; lineIndex <= lineEnd; lineIndex++) {
Bullet oldBullet = styledText.getLineBullet(lineIndex);
styledText.setLineBullet(lineIndex, 1, oldBullet != null ? null : bullet);
}
}
Aggregations