Skip to main content


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 gibsonFriend
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:Reset row height on table resize
Goto Forum:
  


Current Time: Thu Apr 25 23:05:08 GMT 2024

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

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

Back to the top