Add Code Modules

When creating an MDG Technology file, you can include code modules. To use the code modules section of the MDG Technology Types Wizard, follow the steps below:

  1. Follow the steps in the Create MDG Technologies topic up to and including Step 6, where you select the Code Modules checkbox. The MDG Technology Wizard -  Code Modules dialog displays.
     
    MDGWizardCode
     
  2. Click on the checkboxes (Product, Data Types, and Code Templates) for each of the required Code Modules.

Note:

The code modules listed are those defined in your current project. These could be the Enterprise Architect default languages, or those you have defined yourself using code templates and the Code Template Editor. Before you can set up a code template for the new language in the editor, you must define at least one data type for the language. Once the MDG Technology file is created it can be loaded into your current model and into other models.

  1. To select any code options for a module, click on the [ ... ] button in the Code Options column for that module. This enables you to select an XML document that provides additional settings for the language that are not covered by the data types or code templates.
     
    The root node of the XML document should be CodeOptions. The child nodes should be called CodeOption and should contain a name attribute. The supported code options are as follows:
     

Code Option

Description

ConstructorName

The name of a function used as a constructor. Used by the classHasConstructor code template macro.

CopyConstructorName

The name of a function used as a copy constructor. Used by the classHasCopyConstructor code template macro.

DefaultExtension

The default extension when generating code.

DefaultSourceDirectory

The default path to which Enterprise Architect generates new files.

DestructorName

The name of a function used as a destructor. Used by the classHasDestructor code template macro.

Editor

The external editor used for editing source of this language.

ImplementationExtension

The extension used by Enterprise Architect to generate an implementation file.

ImplementationPath

The relative path from the source file to generate the implementation file.

PackagePathSeparator

The delimiter used to separate package names when using the packagePath macro from the code templates.

 
An example of a valid code options file is shown below.

 

<CodeOptions>

<CodeOption name="DefaultExtension">.ext</CodeOption>

<CodeOption name="Editor">C:\Windows\notepad.exe</CodeOption>

</CodeOptions>

 

  1. Click on the Next button to proceed.

You can edit the code option values for source code engineering and for each required language using the appropriate Language Options page of the Options dialog.