Round-trip Engineering

Round-trip engineering is a two-way process that keeps the Java source code and the UML model synchronized. One way, known as reverse engineering, maps the code into its counterpart UML elements, while the opposite way, forward engineering, maps UML elements into code.

IntelliUML Teresa runs this round-trip engineering process transparently, and thus, keeping the Java source code and UML model automatically synchronized at all times. Changes made to code will be reverse engineered, creating and updating the UML elements as necessary to reflect those changes. Likewise, changes to UML elements will be forward engineered into source code.

When IntelliUML Teresa is used by first time in a project, the UML repository is empty, except for the model element which is created automatically.

Initial empty Model Explorer

Reverse Engineering

Java source code will be reverse engineered automatically every time a Java file is opened or edited in IDEA's editor.

For example, starting with an empty UML repository, if the file 'com/intellij/openapi/components/ApplicationComponent.java' (from IDEA's OpenAPI source) is opened in the editor, IntelliUML Teresa will reverse engineer it into the UML elements shown in the Model Explorer.

Reverse engineering example

Reverse engineering may also be invoked manually for any Java class file or package with the help of the actions Reverse Engineer and Synchronize Model.

The difference between Reverse Engineer and Synchronize Model actions is that the former will create UML elements if they don't exist, while the latter will update existing UML elements.

To Reverse Engineer:

  1. Select one or more Java class, interface, package, or module in IDEA's Project View, or set the focus to a Java file in editor.
  2. Either:
    • invoke File | Reverse Engineer.
      or
    • right-click on the selection and invoke Reverse Engineer from the pop up menu.
      Reverse Engineer menu
      or
    • press Ctrl + Alt + E.

To Synchronize Model:

  1. Select one or more Java class, interface, package, or module in IDEA's Project View, or set the focus to a Java file in editor.
  2. Either:
    • invoke File | Synchronize Model.
      or
    • right-click on the selection and invoke Synchronize Model from the pop up menu.
      Synchronize Model menu
      or
    • press Ctrl + Shift + Y.

Forward Engineering

To create a new UML element:

  1. Select the target node in the Model Explorer.
  2. Either:
    • invoke Edit | New.
      or
    • right-click on the selection and invoke New from the pop up menu.
      New context pop up menu
      or
    • press Alt + Insert.
      New menu
  3. Choose the new UML element to be created. Available new UML elements per node type are:
    Node New UML elements
    Model Node model
    Package Node package
    • Class
    • Interface
    • Package
    • Class Diagram
    • Instant Class Diagram
    Class Node class
    Interface Node interface
    • Inner Class
    • Inner Interface
    • Attribute
    • Operation
    Operation Node operation
    • Parameter

To delete a UML element:

  1. Select the desired UML element(s) in the Model Explorer.
  2. Eihther:
    • invoke Edit | Delete.
      or
    • right-click on the selection and invoke Delete from the pop up menu.
      Delete menu
      or
    • press Delete.
  3. Confirm the UML element(s) deletion:
    • If its counterpart exists in source code:
      Safe Delete dialog
    • If its counterpart does not exist in source code (ex., library element, primitive data type):
      Single UML element delete dialog
      Multiple UML element delete dialog

If the UML elements to be deleted have no counterpart in the source code and have dependencies, but not in current selection, (i.e., some other UML element uses it), a dialog will be shown warning about it:
Dependencies Detected dialog