[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[Wtp-wst-dev] StructuredTextEditor does not draw annotation background
|
Hi all!
I am not sure I should write to this mailing list, so if I am wrong
please correct me.
I have some problems with using StructuredTextEditor.
Text editor contains XML-file.
When I add custom annotation to that text editor, annotation icon is
displayed properly, but annotation background is still white.
Has anybody seen the same problem ?
Any help appreciated !
Sample Groovy code that adds annotation:
//------------ start ----------
getAnnotationModel = {ITextEditor editor ->
editor.documentProvider.getAnnotationModel(editor.editorInput)
}
removeAllAnnotations = {ITextEditor editor ->
def annotationModel = getAnnotationModel(editor)
annotationModel.annotationIterator.each {
annotationModel.removeAnnotation it
}
}
addAnnotation = {ITextEditor editor, Annotation annotation, int line,
int length ->
def lineOffset =
editor.documentProvider.getDocument(editor.editorInput).getLineOffset(line-1)
getAnnotationModel(editor).addAnnotation(annotation, new
Position(lineOffset, length))
}
annotation = new InstructionPointerAnnotation(
[:] as IStackFrame,
IDebugUIConstants.ANNOTATION_TYPE_INSTRUCTION_POINTER_CURRENT,
"someText",
image)
//removeAllAnnotations javaEditor
//addAnnotation javaEditor, annotation, 9, 10
removeAllAnnotations xmlTextEditor
addAnnotation xmlTextEditor, annotation, 2, 3
//------------ end ----------
xmlTextEditor is an instance of StructuredTextEditor here.
This code works properly for javaTextEditor (instance of
CompilationUnitTextEditor).
Thanks for your response !
Best regards,
Sergey Bondarenko.