Provide markers (and quick fixes) based on annotations [message #558847] |
Tue, 14 September 2010 11:28  |
Eclipse User |
|
|
|
I want to write a plugin that provides the user with error markers for classes and fields that are annotated with javax.persistence.* annotations.
The idea is to provide markers if an external DSL does not "fit" with the JPA annotations.
I now have an IncrementalProjectBuilder registered, that handles changes to java files and that visits JavaElements and looks for the annotations. It also successfully catches the annotations with the right names.
However, how can I be sure that the annotation is a javax.persistence.Entity? When I query the Java model, i get a String "Entity". Can someone recommend a strategy? I thought about looking at the imports but that seems rather tedious.
Should I try to use the jdt.apt functionality for this, or is the Java model the right place to look for information this detailed and then provide markers and quick fixes?
|
|
|
|
|
|
|
|
Re: Provide markers (and quick fixes) based on annotations [message #632462 is a reply to message #558847] |
Wed, 13 October 2010 01:27  |
Eclipse User |
|
|
|
silvio.heuberger@gmail.com wrote:
> I want to write a plugin that provides the user with error markers for
> classes and fields that are annotated with javax.persistence.* annotations.
> The idea is to provide markers if an external DSL does not "fit" with
> the JPA annotations.
>
> I now have an IncrementalProjectBuilder registered, that handles changes
> to java files and that visits JavaElements and looks for the
> annotations. It also successfully catches the annotations with the right
> names.
>
> However, how can I be sure that the annotation is a
> javax.persistence.Entity? When I query the Java model, i get a String
> "Entity". Can someone recommend a strategy? I thought about looking at
> the imports but that seems rather tedious.
>
> Should I try to use the jdt.apt functionality for this, or is the Java
> model the right place to look for information this detailed and then
> provide markers and quick fixes?
Sorry to respond so late, I have been working on other projects. Yes, an
annotation processor is the right way to do this. This is exactly what
annotation processing was designed for.
|
|
|
Powered by
FUDForum. Page generated in 0.04556 seconds