use of org.eclipse.mylyn.internal.wikitext.ui.viewer.ImageManager in project mylyn.docs by eclipse.
the class HtmlViewer method initPainter.
@SuppressWarnings("deprecation")
private void initPainter() {
if (haveInit) {
return;
}
haveInit = true;
// bug# 245759: must work outside of an Eclipse runtime
ColorRegistry colorRegistry = WikiTextUiResources.getColors();
IAnnotationAccess annotationAccess = new IAnnotationAccess() {
public Object getType(Annotation annotation) {
return annotation.getType();
}
public boolean isMultiLine(Annotation annotation) {
return true;
}
public boolean isTemporary(Annotation annotation) {
return true;
}
};
AnnotationPainter painter = new AnnotationPainter(this, annotationAccess);
// paint bullets
painter.addDrawingStrategy(BulletAnnotation.TYPE, new BulletDrawingStrategy());
painter.addAnnotationType(BulletAnnotation.TYPE, BulletAnnotation.TYPE);
painter.setAnnotationTypeColor(BulletAnnotation.TYPE, getTextWidget().getForeground());
// paint HR
painter.addDrawingStrategy(HorizontalRuleAnnotation.TYPE, new HorizontalRuleDrawingStrategy());
painter.addAnnotationType(HorizontalRuleAnnotation.TYPE, HorizontalRuleAnnotation.TYPE);
painter.setAnnotationTypeColor(HorizontalRuleAnnotation.TYPE, colorRegistry.get(WikiTextUiResources.COLOR_HR));
if (displayImages) {
// paint images
painter.addDrawingStrategy(ImageAnnotation.TYPE, new ImageDrawingStrategy(this));
painter.addAnnotationType(ImageAnnotation.TYPE, ImageAnnotation.TYPE);
painter.setAnnotationTypeColor(ImageAnnotation.TYPE, getTextWidget().getForeground());
}
addTextPresentationListener(painter);
addPainter(painter);
getTextWidget().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
imageCache.dispose();
}
});
if (displayImages) {
new ImageManager(this, imageCache, painter);
}
}
Aggregations