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

Editing Source Code

Use the Source Code editors to view and edit any source code files for an element. If a Class is selected in a diagram or the Project Browser, the Source Code editor shows the source code for that Class, provided it has already been generated. For C++ two tabs display, to show the implementation and header files.

A number of options change the way the Source Code editor works. They can be altered using 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, Toolbar or function keys.

There are several variations on the Source Code editor, with different access methods. The variants are discussed in the Compare Editors topic.

Access     Project Browser element context menu | View Source Code (F12) or (Ctrl+E)
Diagram element context menu | View Source Code   (F12)
Element | Show Source Viewer   (Alt+7)
Tools | Open Source File     (Ctrl+Alt+O) (files not imported to or created in Enterprise Architect)




See also

Source Code editor

By default the Source Code editor 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:




File Parsing

The Source Code editor 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.




There are no context menu options to display XML or DDL.sql files; select the appropriate object and use the keyboard keys (F12, Alt+7)
When you select an element to view source code, 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
You can also locate the directory containing a source file that has been created in or imported to Enterprise Architect, and edit it or its related files using an external editor such as Notepad or Visual Studio; right-click on the element in the Project Browser and select the Open Source Directory context menu option (Ctrl+Alt+Y)

Learn more

Learning Center topics

(Alt+F1) | Software Engineering | Code Editor