Autocompletion in Eclipse for Roo project

1.2k Views Asked by At

I've got a Roo project where I've made a couple of entities, and when I load up the project in Eclipse it loads up fine, but if I i.e. make an instance MyEntity entity and then write entity. I don't get any of my properties (i.e. getMyField) in the autocompletion list. If I write entity.getMyField() it compiles fine, that is taken care of by the aspects. How do I enable autocompletion for functions generated by the aspects?

Cheers

Nik

2

There are 2 best solutions below

0
On BEST ANSWER

Which "type" of eclipse are you using? Do you have AJDT intstalled within your eclipse? If so there is still an option to disable weaving of JDT. The note below (taken from the Roo documentation) should help you to turn on JDT weaving (Window -> Preferences > JDT Weaving.

When using AJDT you may be prompted whether to enable weaving of the JDT. You should select to enable weaving so as to ensure the Java Editor in Eclipse (or STS) gives the best AspectJ-based experience. You can also verify this setting is active by loading Eclipse (or STS) and selecting Window > Preferences > JDT Weaving.

By the way have you considered trying the Spring Source Tool Suite? There you find all the plugins (AJDT support...) already installed. And it fits very well for Roo as it offers Roo functionality from within eclipse.

0
On

I have experienced the same problem as niklassaers: Roo AspectJ methods not showing in eclipse autocompletion while compiling fine. I'm using the latest version of STS, with AJDT installed by default, and verified that JDT Weaving is active, but the problem persists.

On the other hand, I've found out that executing Maven > Update project... (Alt-F5) makes the ROO AJ methods visible to auto completion.

This solution might be related on how I structured my project (I have two eclipse Maven projects in my workspace, myproject.data containing roo classes with aj methods, and myproject.services acting as a client for those classes); besides, I have to repeat Alt-F5 every time I open my workspace, but this seems to work.

I'd like to understand better the reasons of this code completion problem, and maybe find some way to solve the problem permanently, without having to update maven projects every time. Could it be related to interactions between the AJDT plugin and m2eclipse Maven plugin?