Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » SourceViewer + Annotations with IDrawingStrategy
SourceViewer + Annotations with IDrawingStrategy [message #483301] Mon, 31 August 2009 21:34
kent gibson is currently offline 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
Previous Topic:CheckboxTreeViewer disable some elements
Next Topic:fieldassist
Goto Forum:
  


Current Time: Sat Sep 20 00:01:05 GMT 2014

Powered by FUDForum. Page generated in 0.10380 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software