Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Editor Code Annotations
Editor Code Annotations [message #141058] Tue, 07 October 2003 18:09 Go to next message
Eclipse UserFriend
Originally posted by: lopian.netvision.net.il

Hi,
I am writting an editor and would like to implement 'as you type' code
annotation.
i.e. when I write an unknown statment the editor should show an error marker
and underline the bad key-word, when fixed it should disapear (or become
disabled).
Where can I find an example of this?

I extended the TextEditor,and have my own DocumemntPartitioner and Damagers
and Repairer. Where should this go?
in the Damager? in the SourceViewerConfiguration?

I tried adding a DocumentListener and IMarkers but they don't update while
typing and they appear in the Tasks/Problems.

Any ideas, pointers?

regards

Eli
Re: Editor Code Annotations [message #141101 is a reply to message #141058] Tue, 07 October 2003 19:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

I don't know any quick hacks to do this. Here is the not-so-quick method:

1. First, implement a parser that will a) scan the file and produce a list
of errors, and b) clear all markers and generate markers where there are
errors.
2. When the user makes a change (which you can detect in a
DocumentListener), run the (a) part of this parser in the background. When
the parser completes, it should do an asyncExec to do the (b) part on the UI
thread.

Like all multi-threading solutions, the devil is in the details. The Java
editor still hasn't gotten it right after two years, and I can't explain it
in a few sentences. If you search the archives, you may be able to find the
last time I tried to explain it. Whatever I said then still goes.

Bob Foster
Re: Solved - Editor Code Annotations, What about IMarkers [message #143940 is a reply to message #141101] Tue, 14 October 2003 16:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lopian.netvision.net.il

Thanks Bob.
This works now.

How do I make IMarkers that don't appear in the Tasks?

LE

"Bob Foster" <bob@objfac.com> wrote in message
news:blv212$u5e$1@eclipse.org...
> I don't know any quick hacks to do this. Here is the not-so-quick method:
>
> 1. First, implement a parser that will a) scan the file and produce a list
> of errors, and b) clear all markers and generate markers where there are
> errors.
> 2. When the user makes a change (which you can detect in a
> DocumentListener), run the (a) part of this parser in the background. When
> the parser completes, it should do an asyncExec to do the (b) part on the
UI
> thread.
>
> Like all multi-threading solutions, the devil is in the details. The Java
> editor still hasn't gotten it right after two years, and I can't explain
it
> in a few sentences. If you search the archives, you may be able to find
the
> last time I tried to explain it. Whatever I said then still goes.
>
> Bob Foster
>
>
Re: Solved - Editor Code Annotations, What about IMarkers [message #145476 is a reply to message #143940] Fri, 17 October 2003 07:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

"Eli" <lopian@netvision.net.il> wrote in message
news:bmh8d8$t7u$1@eclipse.org...
> Thanks Bob.
> This works now.
>
> How do I make IMarkers that don't appear in the Tasks?

Interesting question. It's easy enough to do by accident. ;-}

I don't know the correct answer because I've always been going in the other
direction, but I seem to recall that markers that are not standard resource
or text markers don't show up.

Bob

> LE
>
> "Bob Foster" <bob@objfac.com> wrote in message
> news:blv212$u5e$1@eclipse.org...
> > I don't know any quick hacks to do this. Here is the not-so-quick
method:
> >
> > 1. First, implement a parser that will a) scan the file and produce a
list
> > of errors, and b) clear all markers and generate markers where there are
> > errors.
> > 2. When the user makes a change (which you can detect in a
> > DocumentListener), run the (a) part of this parser in the background.
When
> > the parser completes, it should do an asyncExec to do the (b) part on
the
> UI
> > thread.
> >
> > Like all multi-threading solutions, the devil is in the details. The
Java
> > editor still hasn't gotten it right after two years, and I can't explain
> it
> > in a few sentences. If you search the archives, you may be able to find
> the
> > last time I tried to explain it. Whatever I said then still goes.
> >
> > Bob Foster
> >
> >
>
>
Re: Solved - Editor Code Annotations, What about IMarkers [message #145635 is a reply to message #145476] Fri, 17 October 2003 11:49 Go to previous message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Bob Foster wrote:

>"Eli" <lopian@netvision.net.il> wrote in message
>news:bmh8d8$t7u$1@eclipse.org...
>
>
>>Thanks Bob.
>>This works now.
>>
>>How do I make IMarkers that don't appear in the Tasks?
>>
>>
>
>Interesting question. It's easy enough to do by accident. ;-}
>
>I don't know the correct answer because I've always been going in the other
>direction, but I seem to recall that markers that are not standard resource
>or text markers don't show up.
>
>
There's the Tasks view shows task markers
(org.eclipse.core.resources.taskmarker) and there's the Tasks List which
shows task markers (org.eclipse.core.resources.taskmarker) and problem
markers (org.eclipse.core.resources.problemmarker). In all cases
sub-type markers are included.

Dani

>Bob
>
>
>
>>LE
>>
>>"Bob Foster" <bob@objfac.com> wrote in message
>>news:blv212$u5e$1@eclipse.org...
>>
>>
>>>I don't know any quick hacks to do this. Here is the not-so-quick
>>>
>>>
>method:
>
>
>>>1. First, implement a parser that will a) scan the file and produce a
>>>
>>>
>list
>
>
>>>of errors, and b) clear all markers and generate markers where there are
>>>errors.
>>>2. When the user makes a change (which you can detect in a
>>>DocumentListener), run the (a) part of this parser in the background.
>>>
>>>
>When
>
>
>>>the parser completes, it should do an asyncExec to do the (b) part on
>>>
>>>
>the
>
>
>>UI
>>
>>
>>>thread.
>>>
>>>Like all multi-threading solutions, the devil is in the details. The
>>>
>>>
>Java
>
>
>>>editor still hasn't gotten it right after two years, and I can't explain
>>>
>>>
>>it
>>
>>
>>>in a few sentences. If you search the archives, you may be able to find
>>>
>>>
>>the
>>
>>
>>>last time I tried to explain it. Whatever I said then still goes.
>>>
>>>Bob Foster
>>>
>>>
>>>
>>>
>>
>>
>
>
>
>
Previous Topic:Java Project : adding src directory
Next Topic:[JFace] - API's are excrutiatingly painful to use and border on useless.
Goto Forum:
  


Current Time: Thu Mar 28 14:40:42 GMT 2024

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

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

Back to the top