Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Eclipse custom texteditor - marker annotation presentation issue
Eclipse custom texteditor - marker annotation presentation issue [message #1041040] Sun, 14 April 2013 14:22
Michael Dietrich is currently offline Michael DietrichFriend
Messages: 2
Registered: July 2012
Junior Member
I want to write an eclipse plugin for my computer science lecturer. It's a custom editor with an xml based file format.
I've implemented syntax highlighting and other stuff. But I stuck when it comes to the usage of annotations/marker to show invalid content.

This is how it looks like, if the content is valid:

This is how it looks like, if the content is invalid:

NOTE: would like to use direct images here, but I'm not allowed to... (thanks to this great restriction)

As you can see, invalid attributes will get marked, but the problem is, the whole formatting seems to be lost between these annotations.

I use
for delayed parsing of the content to create the document model. The model is used to format the text and display annotations. All this happens in the void
void process(DirtyRegion dirtyRegion)
method of the

For text formatting I use
<ITextViewer>.changeTextPresentation(textAttributes, false)
and for annotation handling I use

IAnnotationModel annotationModel = <ISourceViewer>.getAnnotationModel();
IAnnotationModelExtension annotationModelExtension = (IAnnotationModelExtension) annotationModel;
annotationModelExtension.replaceAnnotations(oldAnnotations, newAnnotations);

Since the
does not use the swt thread I have to use this construct to avoid exceptions:

<ITextViewer>.getTextWidget().getDisplay().asyncExec(new Runnable() {
  public void run() {

    <ITextViewer>.changeTextPresentation(textAttributes, false);

By the way
are meant as the same viewer object.

As annotation type I've testet:
and some others, also custom types, but all with the same result.

I'm not quite sure, what I'm doing wrong, could it be because it is all in a single call?

I hope someone can help me with this problem.

Thank you in advance.

[Updated on: Sun, 14 April 2013 14:24]

Report message to a moderator

Previous Topic:Require custom messages while editing a read-only file in the workbench
Next Topic:Missing templates in exported Eclipse
Goto Forum:

Current Time: Thu Jun 21 14:41:52 GMT 2018

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

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

Back to the top