How to add marker without using resources [message #326218] |
Wed, 12 March 2008 05:53 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: avikram.novell.com
Hi,
I have to add Problem Markers on my XML Source Viewer which is not anyway
attached to a resource. How can I have achieve this?
I have seen the Spell check markers in my source viewer, so I understand
that there should be a way to add other markers as well!
Thanks,
Aditya
|
|
|
Re: How to add marker without using resources [message #326226 is a reply to message #326218] |
Wed, 12 March 2008 12:29 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: merks.ca.ibm.com
Aditya,
I don't think you can. IMarker is a resource thing. I suppose of
course you can have decorators like the ones IMarkers produce. I'm not
sure how to do those, but there ought to be code in Eclipse itself you
could track down for examples. Maybe someone will give a pointer to
some source code that decorates the left margin of an editor...
aditya vikram wrote:
> Hi,
>
> I have to add Problem Markers on my XML Source Viewer which is not anyway
> attached to a resource. How can I have achieve this?
>
> I have seen the Spell check markers in my source viewer, so I understand
> that there should be a way to add other markers as well!
>
> Thanks,
> Aditya
>
|
|
|
Re: How to add marker without using resources [message #326233 is a reply to message #326218] |
Wed, 12 March 2008 14:22 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: valere.fedronic.ext.streamezzo.com
Hi,
What you see in the source viewer is not a marker, it's an annotation.
The object responsible of the creation and update of annotations is the
IAnnotationModel. In the TextEditor the annotation model watch for
markers in the edited file and then create an annotation for each marker
(ResourceMarkerAnnotationModel).
You just need to create your custom annotation (like SpellingAnnotation).
When you detect a problem on the edited file, add a new annotation :
ISourceViewer#getAnnotationModel()#addAnnotation(new
CustomAnnotation(),new PositionOffsett());
Your annotation can be painted by the AnnotationPainter, you just need
to define the presentation specification of your annotation using the
'org.eclipse.ui.editors.markerAnnotationSpecification' extension point.
Valère.
aditya vikram a écrit :
> Hi,
>
> I have to add Problem Markers on my XML Source Viewer which is not anyway
> attached to a resource. How can I have achieve this?
>
> I have seen the Spell check markers in my source viewer, so I understand
> that there should be a way to add other markers as well!
>
> Thanks,
> Aditya
|
|
|
Re: How to add marker without using resources [message #326268 is a reply to message #326233] |
Thu, 13 March 2008 13:00 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: avikram.novell.com
valere fedronic wrote:
> Hi,
>
> What you see in the source viewer is not a marker, it's an annotation.
>
> The object responsible of the creation and update of annotations is the
> IAnnotationModel. In the TextEditor the annotation model watch for
> markers in the edited file and then create an annotation for each marker
> (ResourceMarkerAnnotationModel).
>
> You just need to create your custom annotation (like SpellingAnnotation).
>
> When you detect a problem on the edited file, add a new annotation :
> ISourceViewer#getAnnotationModel()#addAnnotation(new
> CustomAnnotation(),new PositionOffsett());
>
>
> Your annotation can be painted by the AnnotationPainter, you just need
> to define the presentation specification of your annotation using the
> 'org.eclipse.ui.editors.markerAnnotationSpecification' extension point.
>
Thanks Valere, Ed, I'll try working on the annoatations & decorators as you
suggested.
--aditya
|
|
|
Powered by
FUDForum. Page generated in 0.08614 seconds