Editing code and roundtripping

You can edit code with an internal code editor or an external code editor.

About this task

There are two basic methods that can be used to edit code:

  • Highlight the element, then select Code > Edit > Selected classes.
  • Right-click the element, then select Edit <element>.

The specification and implementation files for the selected classes or package open in separate windows. You can use the internal code editor or an external code editor to edit the files.

Depending on the dynamic model-code associativity setting, the changes you make to the code can be automatically roundtripped, or incorporated into the model. If you select automatic roundtripping (the Bidirectional or Roundtrip setting), the model is automatically updated with code changes if one of the following events occurs:
  • You change the window in focus, away from the Code View window.
  • You save the file that you are editing.
  • You close the Code View window.

In addition, the dynamic model-code associativity setting determines whether open code views are updated if the code is modified by an external editor or the code generator. In the case of code generation, the code might have changed significantly. If this happens, the following message might be displayed:


filename: This file has been modified outside the source editor. Do you want 
to reload?

If you click Yes, the code view is refreshed with the new file contents and does not replace implementation files with obsolete information.