AJDT 1.2.0 M1 - New and Noteworthy

Part 1: Aspect structure
Part 2: Visualiser enhancements
Part 3: Other changes

Please note: All of the new functionality mentioned on this page requires your aspects to be contained in .aj files. You can use the wizard described below to change the extension of your existing files.


New wizard for changing file extensions

The best arrangement for your source code is to only put pure Java code in .java files, and to use .aj files for aspects. We've made it easier to change the extension of your files by adding actions to convert from .java to .aj, and vice versa. Multiple files can be selected for these operations, plus we've added a wizard to convert all of the source files in a project. This is available by right-clicking on a project and selecting Convert file extensions...


Aspect structure in package explorer

You can now expand aspects in the package explorer, just like Java classes. Furthermore, the structure is updated as the source code is parsed, without having to wait for a build.


Code completion

This is now available inside aspects for a larger number of cases. Here are some examples:

Code assist for members of thisJoinPoint and thisJoinPointStaticPart:

Within inter-type declared methods, the completions occur against the target class (and members from the aspect are not included):


Folding editor

The AspectJ editor now supports folding, just like the Java editor. Normal methods, inter-type methods, advice blocks, and multi-line pointcuts can all be folded.


Organize imports

The Source > Organize Imports action (or Ctrl+Shift+O) operation is now possible inside aspects. (Note: there is a current limitation here which means imports of aspects are not recognised.)


Add import

As with the Java editor, if you have an unknown type you can position the cursor over it, right click and select Source > Add Import, or press Ctrl+Shift+M, and the appropriate statement will be added to the import section.


Code formatting

Formatting is greatly improved; the following constructs should format correctly:

  • Comments
  • Methods, and inter-type declared methods
  • Fields, and inter-type declared fields
  • Advice bodies, which are formatted like methods

Pointcuts are indented appropriately, but any whitespace within the pointcut is left unchanged.


Reminder

All of the above functionality only works if your aspects are in .aj files! These are handled by AJDT, but .java files are handled by Eclipse's JDT which doesn't understand AspectJ syntax. The AspectJ examples included with AJDT have been updated to use .aj files as appropriate.


Next section:
Part 2: Visualiser enhancements