Chapter 5. Working with Apollo for Eclipse

Table of Contents

The Diagrams
Display Canonical Package Diagram
Create Non-Canonical Class Diagram
Adding and Removing Elements
Rapid Buttons
Editing Elements
Associations and Multi-Valued Attributes
Referenced Packages
Open the Source Code in a Diagram Editor
View the Source Code in the Diagram View
Linking Views and Editors
Create Java Source Code from the Diagram
Reverse Engineer .jar Files

It is strongly recommended to work with Apollo for Eclipse with automatic reverse engineering turned on. To toggle reverse engineering, right-click on the project name in the package explorer and select Apollo -> Automatic Reverse Engineering. A checkmark next to this option indicates that automatic reverse engineering is activated.

The examples and instructions in this section all assume that automatic reverse engineering is active.

The Diagrams

Display Canonical Package Diagram

The contents of a package can be displayed in a canonical package diagram (the section called “Canonical Package Diagrams”) in several ways. From the Diagram View, the package content diagram will open in the same tab; from the Diagram Editor, an new tab will be opened.

  1. Select "Open in Diagram View" or "Open in Diagram Editor" from the context menu of the package in the Package Explorer.

  2. In the diagram, right-click on the package and select "Navigate->Show Package Contents". (The reverse of this is also true, e.g. select "Show Parent Package" to go up one level.)

  3. In the diagram with the package selected, use the quick-key combination "Ctrl-Down Arrow". (The reverse of this is also true, e.g. use "Ctrl-Up Arrow" to go to the parent package.)

Create Non-Canonical Class Diagram

Non-canonical class diagrams (the section called “Non-Canonical Class Diagrams”)may be added in any number to any package.

  1. From the context menu of the Package Explorer or the File menu, select "New ->Other".

  2. From the wizard, select "Apollo->Class Diagram".

  3. Select the package in which to create the diagram. Click "Next" to set more properties including the name of the diagram or "Finish" to use the defaults.

  4. From the advanced properties, you may select the parent folder, set the file name, and link the diagram to another file. Click "Finish".

Adding and Removing Elements

Adding an element to a diagram also adds the element to the package in which the diagram resides and automatically adds all edges.

To add a new element to the project from the palette toolbar:

  1. Click the desired element in the palette toolbar.

  2. Click anywhere in the diagram.

To add an existing element to a non-canonical class diagram through drag and drop:

  1. Click and drag an element from the Package Explorer view, Hierarchy view, or Search tab.

  2. Elements and non-canonical class diagrams may also be dragged to a new package from the Package Explorer view.

    Multiple representations of a single element may be added to non-canonical class diagrams.

To delete an element from a project:

  1. Select the element in either the Package Explorer view or in a diagram.

  2. Press the delete button on the keyboard or select "Delete from Model" from the context menu.

    This action will delete the element from the project completely.

To remove an element from a diagram ( non-canonical class diagrams only):

  1. Select the element in a non-canonical class diagram.

  2. Select "Remove from Diagram" from the context menu.

Discovery Functions in Non-Canonical Class Diagrams

Discovery actions automatically add ancestors, descendants, or dependencies to a non-canonical class diagram. This is useful for examining the hierarchy of an element in the diagram.

To add all ancestors of an element to a non-canonical class diagram:

  1. Hover over an element in a non-canonical class diagram to activate the rapid buttons.

  2. Click Show All Ancestors. The family lineage up to and including the selected element will be displayed.

To add all descendants of an element to a non-canonical class diagram:

  1. Hover over an element in a non-canonical class diagram to activate the rapid buttons.

  2. Click Show All Descendants. The family lineage beginning with the selected element will be displayed.


Rapid buttons and context menus allow you to quickly move up or down the package hierarchy or edit the source code.

  • Show Element Parent Package - Displays the element within the parent's canonical package diagram.

  • Show Diagram Parent Package - Displays the parent package within the grandparent's canonical package diagram.

  • Show Package Contents - Displays the canonical package diagram of the selected package.

  • Java Source - Opens the java source code editor for the selected class.

Many of these options are also available via rapid buttons.

Rapid Buttons

Rapid buttons speed up model development by providing convenient access to some of the most-used functions. For instance, a package can be added to a diagram by hovering over the the diagram, then selecting "Add Package" from the rapid button toolbar that appears.

The set of available rapid buttons is context-sensitive; tool-tip explanations of the buttons appear by hovering over the button with the mouse.

For example, a class in a canonical package diagram has only two rapid buttons:

And the very same class in a non-canonical class diagram has many more options:

Editing Elements

Rename an element in the diagram:

Rename an element (such as a package) by selecting the element in the diagram, then hit F2 to open the editor.

Rename an element in the Package Explorer:

Right-click on the element, then select "Refactor->Rename...".

In the case of packages, the option to rename subpackages is presented.

When selected, the package and all subpackages are renamed. No additional packages are created.

When not selected, a new package is created with the new name, and the new package will not contain the subpackages from the old package. The old package and its subpackages will remain.

Edit an element within a diagram:

Double-click on an element to open the inline editor. Double-clicking on a class will provide access to the entire class. You may also double-click on a single attribute or operation to open just that segment in the editor:

UML Properties Tab:

The UML Properties tab is available for attributes from the properties view. To open this view, click "Window->Show View->Properties".

Here, the attribute name, ordering, and multiplicity may be set. Changes made to these properties will be forward engineered and updated in the source code.

Multi-valued attributes can be mapped to Java arrays or generic collections. This is set in Apollo preferences: "Window->Preferences->Apollo".


Package Explorer

Filtering at the Package Explorer level provides controls to set the visibility of various Java elements. This includes the UML diagram files and UML model files.

Open the filter dialog through the Package Explorer menu.


Two types of filters are available in the diagrams: a diagram-wide filter and an element filter.

Open the diagram filter by right-clicking in the diagram and select "Filters->Open Filter Dialog...".

Open the element diagram by selecting the element, then select a filter option from the context menu of that element.