Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Squiggly marks in my text editor
Squiggly marks in my text editor [message #260526] Mon, 12 July 2004 05:22 Go to next message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

Greetings,

I am writing an Eclipse plugin, namely a text editor for a certain
document type we have developed. I am trying to add the familiar red
squiggly marks in the text, but I do not know how. I have read
http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/editors_annotations.htm,
but it does not help much. I suppose I will need to add a
DocumentListener to listen for changes in the document, then parse the
text and add/remove/update the squiggly marks if needed.

How do I add/remove/update the squiggly marks, if I know already where I
want them?

Thank you in advance,

Martijn van Steenbergen.
Re: Squiggly marks in my text editor [message #260534 is a reply to message #260526] Mon, 12 July 2004 05:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

P.S. I already have a working plugin that parses the text and shows an
appropriate outline view.

Martijn van Steenbergen wrote:

> Greetings,
>
> I am writing an Eclipse plugin, namely a text editor for a certain
> document type we have developed. I am trying to add the familiar red
> squiggly marks in the text, but I do not know how. I have read
> http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/editors_annotations.htm,
> but it does not help much. I suppose I will need to add a
> DocumentListener to listen for changes in the document, then parse the
> text and add/remove/update the squiggly marks if needed.
>
> How do I add/remove/update the squiggly marks, if I know already where I
> want them?
>
> Thank you in advance,
>
> Martijn van Steenbergen.
Re: Squiggly marks in my text editor [message #260644 is a reply to message #260526] Mon, 12 July 2004 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Martijn van Steenbergen wrote:

> Greetings,
>
> I am writing an Eclipse plugin, namely a text editor for a certain
> document type we have developed. I am trying to add the familiar red
> squiggly marks in the text, but I do not know how. I have read
> http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/editors_annotations.htm,
> but it does not help much. I suppose I will need to add a
> DocumentListener to listen for changes in the document, then parse the
> text and add/remove/update the squiggly marks if needed.

In the JDT world a reconciler (see IReconciler and its implementations)
updates the Java model (CU) and as a result the model reports the
temporary problems which we use to display the annotations.

Dani

>
> How do I add/remove/update the squiggly marks, if I know already where
> I want them?
>
> Thank you in advance,
>
> Martijn van Steenbergen.
Re: Squiggly marks in my text editor [message #260727 is a reply to message #260644] Mon, 12 July 2004 11:16 Go to previous messageGo to next message
Eclipse UserFriend
If you want the error to also show up in the Problems view, you can simply
create a marker on that resource of type IMarker.PROBLEM (see
IResource.createMarker()). If you do not want it to show up in the
Problems view, you can define your own marker type (or use IMarker.TEXT)
and then specify how it should be annotated by adding markup in your
plugin.xml. Search the help contents for markerAnnotationSpecification
for more on that.

Hope this helps,
Ryan

Daniel Megert wrote:

> Martijn van Steenbergen wrote:

> > Greetings,
> >
> > I am writing an Eclipse plugin, namely a text editor for a certain
> > document type we have developed. I am trying to add the familiar red
> > squiggly marks in the text, but I do not know how. I have read
> >
http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/editors_annotations.htm,
> > but it does not help much. I suppose I will need to add a
> > DocumentListener to listen for changes in the document, then parse the
> > text and add/remove/update the squiggly marks if needed.

> In the JDT world a reconciler (see IReconciler and its implementations)
> updates the Java model (CU) and as a result the model reports the
> temporary problems which we use to display the annotations.

> Dani

> >
> > How do I add/remove/update the squiggly marks, if I know already where
> > I want them?
> >
> > Thank you in advance,
> >
> > Martijn van Steenbergen.
Re: Squiggly marks in my text editor [message #261020 is a reply to message #260727] Tue, 13 July 2004 04:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

Daniel, Ryan, thank you for your replies. Your replies bring up some
more questions:

- I am now keeping my model in my ContentOutlinePage's ContentProvider.
Should I move it to the SourceViewerConfiguration's Reconciler? If not,
what is the usual place to keep the model?

- How does the model report the temporary problems that cause the
annotations to be displayed?

- What is the appropriate place to set the problem markers? My guess is
to override TextEditor.doSave(), check the model for errors, then set or
clear markers if necessary.

Thank you very much in advance,

Martijn van Steenbergen.


Ryan Hollom wrote:
> If you want the error to also show up in the Problems view, you can simply
> create a marker on that resource of type IMarker.PROBLEM (see
> IResource.createMarker()). If you do not want it to show up in the
> Problems view, you can define your own marker type (or use IMarker.TEXT)
> and then specify how it should be annotated by adding markup in your
> plugin.xml. Search the help contents for markerAnnotationSpecification
> for more on that.
>
> Hope this helps,
> Ryan
>
> Daniel Megert wrote:
>
>>In the JDT world a reconciler (see IReconciler and its implementations)
>>updates the Java model (CU) and as a result the model reports the
>>temporary problems which we use to display the annotations.
Re: Squiggly marks in my text editor [message #261155 is a reply to message #261020] Tue, 13 July 2004 10:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

Please ignore my three previously asked questions. I have already solved
parts of my problems.

It seems that all the problems, including the temporary ones, are
signified using markers. Now I know this, it is easier to find
documentation for the markers. The documentation I have found so far are
pages in the Eclipse help files and an article at eclipse.org.

I have moved my data model to my TextEditor. My Reconciler tells the
TextEditor to reparse the Document's contents, and my TextEditor passes
the newly created data model to the ContentOutlinePage and its TreeViewer.

I have overridden the TextEditor's editorSaved() to clear old markers
and create a new one in case of a parse exception. The problem marker
appears immediatly in the Tasks View, but I have to reopen the document
in my editor to cause the red squiggly thingies and the red cross in the
vertical ruler on the left to appear. How do I tell the text editor I
have changed my just created problem marker's attributes so that the
squigglies appear right after saving?

This still leaves the temporary problems unhandled. Just like in the
Java editor, I would like temporary problems to be marked using
squigglies, but not yet appear in the Tasks View. Is creating my own
marker type(s) and/or manipulatin the plugin.xml file the only solution
to this? If not, what are the other solutions?

I thank you very much for your time.

Martijn van Steenbergen.





Martijn van Steenbergen wrote:

> Daniel, Ryan, thank you for your replies...
Re: Squiggly marks in my text editor [message #261158 is a reply to message #261020] Tue, 13 July 2004 10:29 Go to previous messageGo to next message
Eclipse UserFriend
My comments below
Martijn van Steenbergen wrote:

> Daniel, Ryan, thank you for your replies. Your replies bring up some
> more questions:

> - I am now keeping my model in my ContentOutlinePage's ContentProvider.
> Should I move it to the SourceViewerConfiguration's Reconciler? If not,
> what is the usual place to keep the model?
I don't know that there is a "usual" place to keep the model, just make
sure that the model is accessible from both the reconciler and the content
provider. I think that the jdt makes its model accessible from the
document provider.

> - How does the model report the temporary problems that cause the
> annotations to be displayed?
The reconciler will reparse the document and compute any syntax errors.
This can be done any number of ways. As you parse, you can report the
problems as you encounter them or queue them up until you've finished
parsing. Either way will work.

> - What is the appropriate place to set the problem markers? My guess is
> to override TextEditor.doSave(), check the model for errors, then set or
> clear markers if necessary.
I would suggest creating a builder for your resource type. This will be
more consistent with the workbench, and will automatically hook into the
incremental builder and other things for you ('clean', for instance).

> Thank you very much in advance,

> Martijn van Steenbergen.


> Ryan Hollom wrote:
> > If you want the error to also show up in the Problems view, you can simply
> > create a marker on that resource of type IMarker.PROBLEM (see
> > IResource.createMarker()). If you do not want it to show up in the
> > Problems view, you can define your own marker type (or use IMarker.TEXT)
> > and then specify how it should be annotated by adding markup in your
> > plugin.xml. Search the help contents for markerAnnotationSpecification
> > for more on that.
> >
> > Hope this helps,
> > Ryan
> >
> > Daniel Megert wrote:
> >
> >>In the JDT world a reconciler (see IReconciler and its implementations)
> >>updates the Java model (CU) and as a result the model reports the
> >>temporary problems which we use to display the annotations.
Re: Squiggly marks in my text editor [message #261445 is a reply to message #261155] Wed, 14 July 2004 09:26 Go to previous message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

Never mind, solved these problems too :D

The trick was to update the just created markers in a IWorkspaceRunnable.

Thanks a lot for your help!

Martijn.
Previous Topic:Automatic generation of tarballs in viewcvs not enabled
Next Topic:Application as plugins.
Goto Forum:
  


Current Time: Sun Jun 01 16:03:03 EDT 2025

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

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

Back to the top