# Annotation Editor

A lot of the Java classes that will be created to add behavior to the application require Annotations to provide metadata about the implementation (see "Java Annotations" chapter in the Developer Guide).

The annotation editor plugin provides a convenient way to edit the annotations on these classes. It is available on any class that has an existing annotation, under the Package Explorer panel in Eclipse. Right-click on the file in the Package Explorer, to get to Edit Annotation menu item.

Choosing this menu item will cause a new dialog window to appear, and the file to open into an editor if it is not already open. The dialog that appears will allow maintenance of the file's current annotation contents.

The appearance of the dialog is dependent upon the annotation, but the standard dialog will present a layout of two columns, a label and an input for each annotation property. The bottom of the dialog will always present the Finish and Cancel buttons. The Cancel button is always available, and will throw away any changes made, leaving the file with the annotation unchanged.

The Finish button will only be enabled when the annotation has no errors. The annotation is validated after any change, and errors will be displayed near the top of the dialog and the Finish button disabled.

When the property value is itself a list of values or another annotation, there will be a button instead of an input text box. Clicking the button will bring up another dialog to edit its information. In the case of lists, there is a standard dialog where elements can be added, deleted, or reordered.

To add a new element, click the '+' button. This will pop up a new dialog for the annotation being added (or sometimes a choice of the new annotation's type might need to be chosen first). Clicking the '-' button will delete the highlighted element. The 'up' and 'down' buttons can be used to move the highlighted element up or down within the list. To modify an existing element, double click its row in the list dialog, and a new dialog will open to edit its values.

Finally, there is a special list dialog for lists of strings. Instead of editing the elements in the list in a new dialog, a single input field near the bottom of the dialog is used to edit the highlighted entry.

When the finish button is finally pressed, the annotation (and only the annotation) in the file will change to contain the new values entered into the annotation dialogs. The changed file's annotation may be slightly reformatted. The changed file will also remain unsaved, pending user review of the annotation's changes.

Parent topic: Eclipse Tools/Wizards