Marker not displayed on correct line [message #303961] |
Fri, 26 May 2006 12:15  |
Eclipse User |
|
|
|
Originally posted by: matt.querix.com
Hi all,
My problem marker is not displayed on the correct line of my source file
in the editor even though I have checked that the IMarker.LINE_NUMBER
attribute is correct. Can anyone help?
Thanks in advance
Matt D.
|
|
|
|
Re: Marker not displayed on correct line [message #303972 is a reply to message #303968] |
Fri, 26 May 2006 13:33  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Matt,
I've run into the same kind of issue where the SAX parser gives me line
and column, but I can't easily/efficiently convert that to a char_start
at the point in the code where the marker is being created. If you have
access to the IDocument object, the conversion is supported quite easily:
IDocument document =
textEditor.getDocumentProvider().getDocument(textEditor.getE ditorInput());
marker.setAttribute(IMarker.CHAR_START,
document.getLineOffset(startLine) + startColumn - 1);
marker.setAttribute(IMarker.CHAR_END,
document.getLineOffset(endLine) + endColumn - 1);
It would be very nice if the marker could specify start line/column and
end line/column in addition to the character offset approach.
I'm not sure if there's a feature request for that, but it might be a
good thing. I'd love to have such support...
Matt Dickie wrote:
> Hi,
>
> I figured this out, and to the problem of markers spanning lines.
> CHAR_START is not the offset from the beginning of the line specified
> by LINE_NUMBER, as I thought, but the offset from the beginning of the
> document. Unfortunately this makes it rather difficult for me to mark
> an area of text as our compiler gives its output in terms of
> start_line, end_line, start_column, end_column. For the moment I just
> set LINE_NUMBER to start_line and this puts the error in the ruler on
> the left of the editor at the right line.
>
> Matt
>
>
>
> Matt Dickie wrote:
>> Hi all,
>>
>> My problem marker is not displayed on the correct line of my source
>> file in the editor even though I have checked that the
>> IMarker.LINE_NUMBER attribute is correct. Can anyone help?
>>
>> Thanks in advance
>>
>> Matt D.
|
|
|
Powered by
FUDForum. Page generated in 0.10497 seconds