Prev Next

Source Code Panel

The 'Source Code' panel brings together a number of facilities for working with source code. Here you can import existing source code files into your model, creating new model elements that represent the classes in those files. You can select a Class in your model, then click a button to open the code editor window and automatically load the source code file associated with that Class. Facilities are also provided for issuing commands to generate source code from the model and to synchronize the model from the source code.

Part of the Code ribbon in Sparx Systems Enterprise Architect.

Available Facilities

Facility

Description

See also

Behavior

Click on this icon to display the Source Code editor, to create or edit Behavior code for the operations in the selected element, or in the parent of the selected operation. You have three options:

  • Edit Behavior
  • Edit Internal Code
  • Edit (or View) Source Code

All three options display the Code Editor window, but show the appropriate features, code and editing options for the type of code identified by the option.

Behavior Code

Solutions

Click on the drop-down arrow to display a list of options for importing project code from certain popular development products into the current project. For example:

  • Import a Visual Studio Solution
  • Import a Mono Solution
  • Import an Eclipse Project
  • Import a Netbeans Project

Having imported the material, you can perform a comparison between the external project source code and the Enterprise Architect model to check for Class differences, using the 'Compare with Model' option, and you can refresh the Enterprise Architect model to update it with any changes to the source.

Import Projects

Files

Click on the drop-down arrow to display a list of options for importing code files into the current model from a variety of sources, selecting from a range of popular coding languages.

  • Import Directory - display the 'Import Source Directory' dialog, through which you import a complete directory tree in one pass; language and other options can be specified within the dialog

You can also import:

  • ActionScript Files
  • C Files
  • C# Files
  • C++ Files
  • Delphi Files
  • Java Files
  • PHP Files
  • Python Files
  • Visual Basic Files
  • VB .Net Files
  • Binary File - supported file types are: Java JAR files and .NET PE or IL format (exe, dll)
  • Windows .RC File (a Windows C/C++ .RC file), as a series of screen definitions

If you have developed model structures for any customized programming language, those languages are also included in the list.

Import Binary Module Import a Directory Structure Importing Source Code

Generate

Click on this icon to display options to generate source code for:

  • The currently selected model element(s), or
  • A single element, with options, or
  • All elements in the current context

Source code is generated into the file that is associated with each individual element. Code is generated only for elements that are of type Class or Interface.

Generate a Package Generate a Group of Classes Generate a Single Class

Synchronize

Click on this icon to display options to synchronize the currently selected model elements with their associated source code files, or to synchronize the whole Package containing the selected elements.

Update Package Contents Synchronize Model and Code

Learn more