Adding annotations using the Annotations view

You can add annotations in your source code by using the Annotations view.

Before you begin

In the Java™ EE perspective, if the Annotations view does not appear in the workspace, you need to add the Annotations view. For more information, see Annotations view.

Procedure

  1. In the Enterprise Explorer view, double-click your Java class to open the file in the Java editor.
  2. Click the Annotations view tab.
  3. Select the Java element to which you want to add an annotation.
  4. Click Add annotation.
    Add annotation
  5. In the Add annotation page, select the annotation that you want to add:
    Add Annotation dialog
  6. To filter the annotations, type a letter or term into the type filter text field. You can use "*", "?", or camel case:
    Add Annotation filter
  7. Select the annotation that you want to insert into your Java class, and click OK
  8. You see in the Java class the @Stateless annotation is added to your code.
  9. When you press CTRL+S to save, you can see a quick fix icon quick fix icon next to the @Stateless line
  10. Right-click the quick fix icon and select Quick Fix:
  11. Select Import 'Stateless' (javax.ejb) and press CTRL+S to save:
    Add Import 'Stateless' (javax.ejb)
  12. You see in the Java class that your annotation is added to the code. Highlight the annotation, and the details for this annotation appear in the Annotation view.
  13. The attributes pane shows both the default values (which you can change) and assigned values.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: taddannoview.html