How to add marker without using resources [message #326218] |
Wed, 12 March 2008 05:53 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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.04214 seconds