Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

The Source Code Viewer

Access:     View | More Element Tools | Source Code   (Alt+7)
                    Tools | Open Source File     (Ctrl+Alt+O)

Use the Source Code viewer to view any source code files for an element. If a Class is selected, the Source Code viewer shows the source code for that Class, provided it has already been generated. For C++ a second tab displays to show the implementation file.

The Source Code viewer also displays any DDL generated for a selected table in your diagram.

A number of options change the way the Source Code viewer works. They can be altered via the Options dialog (select the Tools | Options | Source Code Engineering | Code Editors menu option). There are also many options for developing the code, available through the code editor context menu and through the Toolbar.

Topics:

Topic

Detail

See also

Source Code Viewer

By default the Source Code viewer is set to:

  • Parse all opened files, and show a tree of the results
  • Show line numbers

If you are editing an XML file, the structure tree is presented in a folder hierarchy rather than a Class structure hierarchy, as follows:

xmlstruct

 

External File Editor

If you intend to edit external code, XML and DDL files (that is, code not selected from the Project Browser) use the Tools | Open Source File menu option, or press (Ctrl+Alt+O).

If you try to close the window or select another file, the editor prompts you to save your changes.

 

File Parsing

The Source Code viewer parses files for a number of reasons. The first is to enable it to jump to the location in the file at which the currently selected item is found (but not when editing external files).

Additionally, parsing displays a structure tree showing an overview of the file in a similar fashion to the main Project Browser. You can also select anything in that and jump to the appropriate line in the editor.

The viewer cannot parse DDL, and therefore does not show the structure tree for a DDL file.

 

Notes:

  • You view source code for an element by selecting menu options in a number of places, or by pressing either ( Ctrl+E )  or ( F12 ) . If the element does not have a generation file (that is, code has not been or cannot be generated, such as for a Use Case), Enterprise Architect checks whether the element has a link to either an operation or an attribute of another element. If such a link exists, and that other element has source code, the code for that element displays

Learn More: