Copyright © 2003 Eclipse.org. All Rights Reserved

# Common Problems

- AspectJ keywords aren’t highlighted in the editor / I don’t see AspectJ constructs in the outline view.
- AspectJ keywords are indicated as errors with a red squiggle
- I get warnings about unused imports in my aspect source files
- I don’t see the AspectJ build button in the toolbar
- I don’t see the new aspect icon directly in the ‘new…” list
- I can’t rename a ".java" file to have a ".aj" extension.

The fixes to all of these problems should be automated by the new installation process in AJDT 1.1.4 and later, but in case you still see any of them, here are the fixes:

### Editor/Outline doesn’t recognize AspectJ constructs

If your editor looks like this when displaying aspects:

Then you’re using the Java editor instead of the AspectJ editor. Close the editor, then go to Window -> Preferences -> Workbench -> File Associations. Select “*.java” and then click “Add…” next to the Associated Editors box.

The following dialog appears:

Select “AspectJ/Java Editor” and click OK. Then press the “Default” button to make this the default editor for “*.java” files.

### Keywords underlined in red

If your editor is highlighting the aspect keyword as an error with a red squiggle like this:

Then you still have early error annotations turned on. Go to Window -> Preferences -> Java -> Editor. Click on the “Annotations” tab and then deselect “Analyse annotations while typing.” Click “Apply” and then “OK.”

### Unused import warnings

If you get unused import warnings for imports that are used in your aspects, go to Window -> Preferences -> Java -> Compiler and set the “Unused Imports” severity level to ignore. (The analysis engine for unused imports doesn’t understand aspects yet).

### No AspectJ build button

The build button only appears in the Java perspective. If the AspectJ build button doesn’t appear in the Java Perspective, first switch to that perspective and then go to Window -> Customize Perspective. In the resulting dialog go to the "Commands" tab, select “AspectJ Actions” in the list of available command groups and click “OK.”

### Missing “new aspect” icon

If you don’t see a new aspect icon in the list of “new” shortcuts then go to the Java Perspective and select customize perspective as above. In the resulting Customize Perspective dialog, go to the "Shortcuts" tab, select the "New" submenu and check the items you want to see.

### Renaming aspects with a ".java" extension.

If you need to rename your aspect to have a ".aj" extension instead of ".java", first open the resource perspective. Right click on the aspect in the Navigator, click "Rename", then type in the new name and press return.