Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to force Annotation Processing to be enabled?
How to force Annotation Processing to be enabled? [message #249110] Mon, 29 October 2007 14:13 Go to next message
Eclipse UserFriend
Originally posted by: myawn.ebay.com

Is there a way to turn on annotation processing globally? Currently I'm
having to do this on a project-by-project basis; I haven't been able to
find a place to change the setting so it takes effect for all projects.
(Ideally we'd like to have this turned on when a developer installs
Eclipse so they don't even have to think about it).

If that isn't possible, is there an API that I can call from my plugin
activator to turn on annotation processing for the project?

Thanks,
Mike
Re: How to force Annotation Processing to be enabled? [message #249122 is a reply to message #249110] Mon, 29 October 2007 21:13 Go to previous message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"Mike Yawn" <myawn@ebay.com> wrote in message
news:fg4pq9$v5$1@build.eclipse.org...
>
> Is there a way to turn on annotation processing globally? Currently I'm
> having to do this on a project-by-project basis; I haven't been able to
> find a place to change the setting so it takes effect for all projects.
> (Ideally we'd like to have this turned on when a developer installs
> Eclipse so they don't even have to think about it).

There is not; there are no globally configurable APT settings, only
per-project. It's a long story, but at core it has to do with performance
concerns for non-APT projects and some UI snafus that would have otherwise
been awkward to resolve.


> If that isn't possible, is there an API that I can call from my plugin
> activator to turn on annotation processing for the project?

Absolutely; indeed, what is normally done is that if a project is of a type
for which APT would be appropriate - for instance, a web services project -
the project creation wizard turns on APT at the same time that it constructs
the factory path.

The API you want is
org.eclipse.jdt.apt.core.util.AptConfig.setEnabled(IJavaProj ect jproj,
boolean enable). This turns APT on (or off) for the specified project.

Note that turning this setting on causes a change in the project, which will
ultimately trigger a build if autobuilding is turned on. This can be
awkward if you're planning on making a bunch of other changes as well. So,
you'd want to wrap that in a workspace job, or at least turn autobuilding
off for the duration of your configuration code.
Previous Topic:override for interface question
Next Topic:Eclipse/Ant properties bug?
Goto Forum:
  


Current Time: Thu Nov 07 05:03:04 GMT 2024

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

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

Back to the top