Resource Marker [message #167875] |
Tue, 09 December 2003 03:34  |
Eclipse User |
|
|
|
Originally posted by: p.vats.zensar.com
I am trying to run workbench wanting to show error in my task view which I
am able to do it, but when I click on the error description on my Task
View then it doesn't take me to the line /location in my file / in editor.
For this I am using resource marker. I am expecting some update on this,
if any one can spare some time and provide some input for this, it would
be great help.
thnx,
|
|
|
|
|
|
Re: Resource Marker [message #172655 is a reply to message #169083] |
Fri, 19 December 2003 17:52  |
Eclipse User |
|
|
|
Originally posted by: jmyron.ioconcepts.com
Sound familiar. Thats the same problem I ran into when I first started
messing with markers. Don't exactly understand why this is the case but you
need to create a MarkerAnnotation and add it to the annotation model to get
your error to immediately show on the margin ruler. You also have to specify
the file offset and length not just the line number (length doesn't really
matter for the ruler annotation). Here is a snippet of code that does what
I'm talking about:
IMarker parseError =
((IFileEditorInput)getEditorInput()).getFile().createMarker( "org.eclipse.cor
e.resources.problemmarker");
IRegion info =
getDocumentProvider().getDocument(getEditorInput()).getLineI nformation(line-
1);
parseError.setAttribute(IMarker.LINE_NUMBER, line);
parseError.setAttribute(IMarker.MESSAGE, msg);
parseError.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
MarkerAnnotation markerAnot = new MarkerAnnotation( parseError );
int errorOffset = info.getOffset() + column-1;
int errorLen = info.getLength() - column + 1;
Position pos = new Position( errorOffset, errorLen );
IAnnotationModel am =
getDocumentProvider().getAnnotationModel(getEditorInput());
am.addAnnotation(markerAnot, pos);
Hope this helps.
Myron
"Vinay Choudhary" <v.choudhary@zensar.com> wrote in message
news:br99bb$g1b$1@eclipse.org...
> Hi Guys,
>
> Thanks for your reply .
> I have set "IMarker.LINE_NUMBER" in my code and now when I double click
> the error the focus is correctly set on the line having the error.
>
> But the problem is that the "Red Icon" is not displayed on the line having
> the error. If I close the workbench and run it again the "Error icon" is
> displayed correctly on the line having the error.
>
> Can you let me know if I am missing some setting which will make the error
> icon appear ???
>
> Thanks,
> Prikshit
>
>
> Thomas M
|
|
|
Powered by
FUDForum. Page generated in 0.08284 seconds