SourceViewer + Annotations with IDrawingStrategy [message #483301] |
Mon, 31 August 2009 21:34 |
kent gibson Messages: 114 Registered: July 2009 |
Senior Member |
|
|
I am trying to simulate a page break in a SourceViewer.
I am trying to start slow (without partitioning) and just see the
annotation but it never shows. What could I be doing wrong?
This is my View:
MyViewer viewer = new SourceViewer(parent, null, SWT.MULTI | SWT.H_SCROLL|
SWT.V_SCROLL);
Document document = new Document("blah");
AnnotationModel model = new AnnotationModel();
model.addAnnotation(new HorizontalRuleAnnotation(), new Position(0));
viewer.setDocument(document, model);
This is my Viewer:
public class MyViewer extends SourceViewer {
public static final String ID = "sourceviewer.MyViewer";
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);
public MyViewer(Composite parent, IVerticalRuler ruler, int styles) {
super(parent, ruler, styles);
painter.addDrawingStrategy(HorizontalRuleAnnotation.TYPE,
new HorizontalRuleDrawingStrategy());
painter.addAnnotationType(HorizontalRuleAnnotation.TYPE,
HorizontalRuleAnnotation.TYPE);
painter.setAnnotationTypeColor(HorizontalRuleAnnotation.TYPE ,
getTextWidget().getForeground());
}
}
thanks
|
|
|
Powered by
FUDForum. Page generated in 0.02702 seconds