Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Issues creating markers in Text Editor
Issues creating markers in Text Editor [message #304133] Wed, 31 May 2006 12:35 Go to next message
Eclipse UserFriend
Originally posted by: awm_abu.yahoo.com

Hello all,

I am developing my own language editor and I want to create errors based on
what is coming back from the compiler
similar to how the jdt does it.

One thing I noticed is that if you make an erroneous change in the
JavaEditor then you get notification that it is an error
in the overview ruler, the red error line appear but the vertical ruler
(left side ruler) is only marked when you save the editor
or if a quick fix is available. And the tab is only marked in the case of
save.
Also the Problems view does not contain the problem unless a save is
executed.

In my implementation I create a marker something like the code shown below.
Doing it this way means that I get the error appearing in the Problems View
which I do not want because if the user
does not save the changes then the problems will no longer exist in the
editor but they will still be listed in the view.

Anyone have on thoughts on how to do this more like the JDT does it ?
I had a look at the jdt code but its so vast its hard to figure it out.

Thanks,

IMarker mark = file.createMarker(IMarker.PROBLEM);
mark.setAttribute(IMarker.MESSAGE, "Test");

mark.setAttribute(IMarker.PROBLEM, true);

mark.setAttribute(IMarker.LINE_NUMBER, new Integer(info[0]).intValue());

mark.setAttribute(IMarker.CHAR_START new Integer(info[1]).intValue());

mark.setAttribute(IMarker.CHAR_END, new Integer(info[2]).intValue());

mark.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR)
Re: Issues creating markers in Text Editor [message #304146 is a reply to message #304133] Thu, 01 June 2006 03:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom_eicher.ch.ibm.com

Frank Abercorn wrote:
> I am developing my own language editor and I want to create errors based on
> what is coming back from the compiler
> similar to how the jdt does it.
>
> One thing I noticed is that if you make an erroneous change in the
> JavaEditor then you get notification that it is an error
> in the overview ruler, the red error line appear but the vertical ruler
> (left side ruler) is only marked when you save the editor
> or if a quick fix is available. And the tab is only marked in the case of
> save.
> Also the Problems view does not contain the problem unless a save is
> executed.

Frank,

Note that there are different compiles: the real incremental compilation
happening when you save a file (which creates class files and reports
problems as markers), and the lean reconcile compilation, which is only
used to report problems as you type, but does not change anything in the
resource layer.

The Java editor behaves in the observed way to avoid frequent
distracting updates as you type. This is done by a specialized
MarkerAnnotationModel (see
CompilationUnitDocumentProvider.CompilationUnitAnnotationMod el) that
maps markers generated by the compiler on the one hand, and temporary
problems created during the reconcile process on the other.

The problems view only shows markers (and thus is also populated without
an editor being open).

HTH, tom
Re: Issues creating markers in Text Editor [message #304151 is a reply to message #304146] Thu, 01 June 2006 05:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: awm_abu.yahoo.com

Tom,

Thanks for the reply.
I had a look at the class you outlined but I'm still not sure I fully
understand whats going on.

I put a breakpoint in
CompilationUnitDocumentProvider.CompilationUnitAnnotationMod el.createMarkerAnnotation(..)
and I created an error that would be picked up by the reconcile.
However it did not break at this point in the code. It did break here when I
did a save (incremental compile)
By any chance do you know where the code will break (marker/annotation wise)
when I get a reconcile problem ?

Thanks again,
Frank.




"Tom Eicher" <tom_eicher@ch.ibm.com> wrote in message
news:e5m6k4$9pj$1@utils.eclipse.org...
> Frank Abercorn wrote:
>> I am developing my own language editor and I want to create errors based
>> on what is coming back from the compiler
>> similar to how the jdt does it.
>>
>> One thing I noticed is that if you make an erroneous change in the
>> JavaEditor then you get notification that it is an error
>> in the overview ruler, the red error line appear but the vertical ruler
>> (left side ruler) is only marked when you save the editor
>> or if a quick fix is available. And the tab is only marked in the case of
>> save.
>> Also the Problems view does not contain the problem unless a save is
>> executed.
>
> Frank,
>
> Note that there are different compiles: the real incremental compilation
> happening when you save a file (which creates class files and reports
> problems as markers), and the lean reconcile compilation, which is only
> used to report problems as you type, but does not change anything in the
> resource layer.
>
> The Java editor behaves in the observed way to avoid frequent distracting
> updates as you type. This is done by a specialized MarkerAnnotationModel
> (see CompilationUnitDocumentProvider.CompilationUnitAnnotationMod el) that
> maps markers generated by the compiler on the one hand, and temporary
> problems created during the reconcile process on the other.
>
> The problems view only shows markers (and thus is also populated without
> an editor being open).
>
> HTH, tom
Re: Issues creating markers in Text Editor [message #304156 is a reply to message #304151] Thu, 01 June 2006 08:28 Go to previous message
Eclipse UserFriend
Originally posted by: tom_eicher.ch.ibm.com

Frank Abercorn wrote:
> Thanks for the reply.
> I had a look at the class you outlined but I'm still not sure I fully
> understand whats going on.
>
> I put a breakpoint in
> CompilationUnitDocumentProvider.CompilationUnitAnnotationMod el.createMarkerAnnotation(..)
> and I created an error that would be picked up by the reconcile.
> However it did not break at this point in the code. It did break here when I
> did a save (incremental compile)
> By any chance do you know where the code will break (marker/annotation wise)
> when I get a reconcile problem ?

@see CompilationUnitAnnotationModel.reportProblems(List)

-tom
Previous Topic:Problem creating Context-Sensitive Help
Next Topic:enablement & IResource
Goto Forum:
  


Current Time: Sun May 11 02:07:19 EDT 2025

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

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

Back to the top