0% found this document useful (0 votes)
26 views

Software Modeling Fundamentals

The document provides an overview of integrated development features in Enterprise Architect including generating source code from models, importing source code, editing source code, application patterns, and MDG integration. It also covers modeling various technologies like wireframes, state machines, dialogs, patterns, and programming languages.

Uploaded by

hod.cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Software Modeling Fundamentals

The document provides an overview of integrated development features in Enterprise Architect including generating source code from models, importing source code, editing source code, application patterns, and MDG integration. It also covers modeling various technologies like wireframes, state machines, dialogs, patterns, and programming languages.

Uploaded by

hod.cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 373

Enterprise Architect

User Guide Series

Software Modeling
Fundamentals

Author: Sparx Systems & Stephen Maguire

Date: 16/01/2019

Version: 1.0

CREATED WITH
Table of Contents

Introduction 7
Integrated Development 9
Feature Overview 11
Generate Source Code 13
Generate a Single Class 15
Generate a Group of Classes 16
Generate a Package 17
Update Package Contents 19
Synchronize Model and Code 21
Namespaces 22
Importing Source Code 23
Import Projects 25
Import Source Code 27
Notes on Source Code Import 28
Import Resource Script 30
Import a Directory Structure 32
Import Binary Module 33
Classes Not Found During Import 34
Editing Source Code 35
Languages Supported 37
Configure File Associations 38
Compare Editors 39
Code Editor Toolbar 40
Code Editor Context Menu 43
Create Use Case for Method 46
Code Editor Functions 48
Function Details 49
Intelli-sense 52
Find and Replace 54
Search in Files 57
Find File 60
Search Intelli-sense 62
Code Editor Key Bindings 65
Application Patterns (Model + Code) 69
MDG Integration and Code Engineering 72
Wireframe Models 73
Android Wireframe Toolbox 74
Apple iPhone/Tablet Wireframe Toolbox 82
Windows Phone Wireframe Toolbox 90
Dialog Wireframe Toolbox 97
Webpage Wireframe Toolbox 107
Behavioral Models 109
Code Generation - StateMachines 111
Legacy StateMachine Templates 115
Java Code Generated From Legacy StateMachine Template 117
StateMachine Modeling For HDLs 123
Code Generation - Interaction Diagrams 125
Code Generation - Activity Diagrams 126
Win32 UI Technology 128
Modeling UI Dialogs 130
Import Single Dialog from RC File 132
Import All Dialogs from RC File 133
Export Dialog to RC File 134
Design a New Dialog 135
GoF Patterns 138
Configuration Settings 140
Source Code Engineering Options 141
Code Generation Options 143
Import Component Types 145
Source Code Options 146
Options - Code Editors 148
Editor Language Properties 150
Options - Object Lifetimes 152
Options - Attribute/Operations 153
Modeling Conventions 155
ActionScript Conventions 157
Ada 2012 Conventions 159
C Conventions 162
Object Oriented Programming In C 164
C# Conventions 166
C++ Conventions 169
Managed C++ Conventions 172
C++/CLI Conventions 173
Delphi Conventions 175
Java Conventions 177
AspectJ Conventions 179
PHP Conventions 180
Python Conventions 182
SystemC Conventions 183
VB.NET Conventions 185
Verilog Conventions 188
VHDL Conventions 190
Visual Basic Conventions 193
Language Options 195
ActionScript Options - User 197
ActionScript Options - Model 198
Ada 2012 Options - User 199
Ada 2012 Options - Model 200
ArcGIS Options - User 201
ArcGIS Options - Model 202
C Options - User 203
C Options - Model 204
C# Options - User 206
C# Options - Model 207
C++ Options - User 208
C++ Options - Model 209
Delphi Options - User 211
Delphi Options - Model 212
Delphi Properties 213
Java Options - User 214
Java Options - Model 215
PHP Options - User 217
PHP Options - Model 218
Python Options - User 219
Python Options - Model 220
SystemC Options - User 221
SystemC Options - Model 222
VB.NET Options - User 223
VB.NET Options - Model 224
Verilog Options - User 225
Verilog Options - Model 226
VHDL Options - User 227
VHDL Options - Model 228
Visual Basic Options - User 229
Visual Basic Options - Model 230
MDG Technology Language Options 231
Reset Options 232
Set Collection Classes 233
Example Use of Collection Classes 235
Local Paths 238
Local Paths Dialog 239
Language Macros 241
ICONIX 243
Developing Programming Languages 245
Code Template Framework 247
Code Template Customization 248
Code and Transform Templates 249
Base Templates 251
Export Code Generation and Transformation Templates 254
Import Code Generation and Transformation Templates 255
Synchronize Code 256
Synchronize Existing Sections 258
Add New Sections 259
Add New Features and Elements 260
The Code Template Editor 261
Code Template Syntax 263
Literal Text 264
Variables 265
Macros 267
Template Substitution Macros 269
Field Substitution Macros 271
Substitution Examples 272
Attribute Field Substitution Macros 274
Class Field Substitution Macros 276
Code Generation Option Field Substitution Macros 279
Connector Field Substitution Macros 283
Constraint Field Substitution Macros 287
Effort Field Substitution Macros 288
File Field Substitution Macros 289
File Import Field Substitution Macros 290
Link Field Substitution Macros 291
Linked File Field Substitution Macros 293
Metric Field Substitution Macros 294
Operation Field Substitution Macros 295
Package Field Substitution Macros 297
Parameter Field Substitution Macros 298
Problem Field Substitution Macros 299
Requirement Field Substitution Macros 300
Resource Field Substitution Macros 301
Risk Field Substitution Macros 302
Scenario Field Substitution Macros 303
Tagged Value Substitution Macros 304
Template Parameter Substitution Macros 306
Test Field Substitution Macros 307
Function Macros 308
Control Macros 314
List Macro 315
Branching Macros 317
Synchronization Macros 319
The Processing Instruction (PI) Macro 320
Code Generation Macros for Executable StateMachines 321
EASL Code Generation Macros 331
EASL Collections 334
EASL Properties 337
Call Templates From Templates 344
The Code Template Editor in MDG Development 345
Create Custom Templates 346
Customize Base Templates 348
Add New Stereotyped Templates 349
Override Default Templates 351
Grammar Framework 352
Grammar Syntax 353
Grammar Instructions 354
Grammar Rules 355
Grammar Terms 356
Grammar Commands 357
AST Nodes 359
Editing Grammars 367
Parsing AST Results 369
Profiling Grammar Parsing 370
Macro Editor 371
Example Grammars 372
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 6 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Introduction

Enterprise Architect in addition to its powerful business model simulation, coding and visual execution analysis
capability is a fully fledged Integrated Development Environment. This allows Software Engineers, Programmers and
other technical staff to develop, maintain and round trip engineer source code in a wide range of programming languages
with all the facilities that developers using other IDEs such as Eclipse and Visual Studio would expect and much more.

Round trip code engineering is supported by the Code Template Framework and the Grammar framework allowing any
programming language to be incorporated. These frameworks provide a mechanism for developers to create support for
additional languages or to configure the way that round trip engineering works out to the box.
In addition to the IDE there is support for the design, visualization and resource generation for Win32 screens.
There is also an integrated Database Engineering tool that connects to live databases and allows database schemas to be
imported and exported including support for incremental changes. XML schemas can also be developed and managed
using the powerful Schema Composer allowing user defined Schemas to be generated that are compliant with industry
standard schemas such as NIEM.

(c) Sparx Systems 2018 Page 7 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Software engineering is the discipline of designing, implementing and maintaining software. The process of software
engineering starts with requirements and constraints as inputs and results in programming code and schemas that are
deployed to a variety of platforms, creating running systems.
Enterprise Architect has a rich set of tools and features that assist Software Engineers to perform their work efficiently
and to reduce the number of errors in implemented solutions. The features include design tools to create models of
software, automated code generation, reverse engineering of source code, binaries and schemas, and tools to synchronize
source code with the design models. The programming code can be viewed and edited directly in the integrated Code
Editors within Enterprise Architect, which provide Intelli-sense and other features to aid in coding.
Another compelling aspect of the environment is the ability to trace the implementation Classes back to design elements
and architecture, and then back to the requirements and constraints and other specifications, and ultimately back to
stakeholders and their goals and visions.
Enterprise Architect supports a wide range of programming languages and platforms and provides a lightweight and
seamless integration with the two most prevalent Integrated Development Environments: Visual Studio and Eclipse. In
addition there is a fully featured Execution Analyzer that allows the Software Engineer to design, build debug and test
software modules right inside Enterprise Architect.

(c) Sparx Systems 2018 Page 8 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Integrated Development

Enterprise Architect provides an unmatched set of tools and features for the Software Engineer, to assist in the process of
creating robust and error free software systems. The engineer can start by defining the architecture and ensuring that it
traces back to the requirements and specification. Technology neutral models can be transformed to target a
comprehensive range of programming languages. The Model Driven Development Environment fits the bill for various
technologies.

Features

Development Tools · Model driven development with best-in-class UML tools


· Generate and reverse engineer code
· Customize code generation with templates
· Analyzer Scripts to manage your applications
· Code editors to author the code base
· Debuggers to investigate behavior
· Profilers to visualize behavior
· Analyzers to record behavior
· Testpoints for validation of programming contracts
· Integration with jUnit and nUnit
· Eclipse or Visual Studio Integration where required

Traceability At a glance traceability of Generalizations, Realizations, Associations,


Dependencies and more. Customize relationship views. Easily navigate related
elements in the model.

Usage Quickly browse element usage across all diagrams. Perform powerful element
searches using sophisticated queries.

Popular Languages · C/ C++


· Java

(c) Sparx Systems 2018 Page 9 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Microsoft .NET family


· ADA
· Python
· Perl
· PHP

Toolboxes Toolboxes are provided for a vast array of modeling technologies and programming
languages.

Application Patterns Enterprise Architect provides complete starter projects, including model
information, code and build scripts, for several basic application types.

(c) Sparx Systems 2018 Page 10 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Feature Overview
Code Engineering with Enterprise Architect broadly encompasses various processes for the design, generation and
transformation of code from your UML model.

Features

Model Driven Code · Source code generation and reverse engineering for many popular languages,
Engineering including C++, C#, Java, Delphi, VB.Net, Visual Basic, ActionScript, Python
and PHP
· A built in 'syntax highlighting' source code editor
· Code generation templates, which enable you to customize the generated
source code to your company specifications

Transformations for · Advanced Model Driven Architecture (MDA) transformations using


Rapid Development transformation templates
· Built-in transformations for DDL, C#, Java, EJB and XSD
· One Platform Independent Model can be used to generate and synchronize
multiple Platform Specific Models, providing a significant productivity boost
· XSL Transform diagram, toolbox, editor and debugger.

Visual Execution Analysis · Execute build, test, debug, run and deploy scripts
/ Debugging, Verification · Integrate UML development and modeling with source development and
and Visualization compilation
· Generate NUnit and JUnit test Classes from source Classes using MDA
Transformations
· Integrate the test process directly into the Enterprise Architect IDE
· Debug .NET, Mono, Java and Microsoft Native (C, C++ and Visual Basic)
applications
· Design and execute Test suites based on Programming by Contract principles
· XSL Stylesheet debugging

Database Modeling Enterprise Architect enables you to:


· Reverse engineer from many popular DBMSs, including SQL Server, My SQL,
Access, PostgreSQL and Oracle
· Model database tables, columns, keys, foreign keys and complex relationships
using UML and an inbuilt data modeling profile
· Forward generate DDL scripts to create target database structures

XML Technology Enterprise Architect enables you to rapidly model, forward engineer and reverse
Engineering engineer two key W3C XML technologies:
· XML Schema (XSD)
· Web Service Definition Language (WSDL)
XSD and WSDL support is critical for the development of a complete Service
Oriented Architecture (SOA), and the coupling of UML 2.5 and XML provides the
natural mechanism for implementing XML-based SOA artifacts within an
organization.

(c) Sparx Systems 2018 Page 11 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 12 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Generate Source Code

Source code generation is the process of creating programming code from a UML model. There are great benefits in
taking this approach as the source code Packages, Classes and Interfaces are automatically created and elaborated with
variables and methods.
Enterprise Architect can also generate code from a number of behavioral models, including StateMachine, Sequence and
Activity diagrams. There is a highly flexible template mechanism that allows the engineer to completely tailor the way
that source code is generated, including the comment headers in methods and the Collection Classes that are used.
From an engineering and quality perspective, the most compelling advantage of this approach is that the UML models
and therefore the architecture and design are synchronized with the programming code. An unbroken traceable path can
be created from the goals, business drivers and the stakeholder’s requirements right through to methods in the
programming code.

Facilities

Facility Description

Languages Enterprise Architect supports code generation in each of these languages:


· Action Script
· C
· C# (for .NET 1.1, .NET 2.0 and .NET 4.0)
· C++ (standard, plus .NET managed C++ extensions)
· Delphi
· Java (including Java 1.5, Aspects and Generics)
· PHP
· Python
· Visual Basic
· Visual Basic .NET

Elements Code is generated from Class or Interface model elements, so you must create the
required Class and Interface elements to generate from.
Add attributes (which become variables) and operations (which become methods).

Settings Before you generate code, you should ensure the default settings for code
generation match your requirements; set up the defaults to match your required
language and preferences.
Preferences that you can define include default constructors and destructors,
methods for interfaces and the Unicode options for created languages.
Languages such as Java support 'namespaces' and can be configured to specify a
namespace root.
In addition to the default settings for generating code, Enterprise Architect
facilitates setting specific generation options for each of the supported languages.

(c) Sparx Systems 2018 Page 13 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Template Framework The Code Template Framework (CTF) enables you to customize the way Enterprise
Architect generates source code and also enables generation of languages that are
not specifically supported by Enterprise Architect.

Local Paths Local path names enable you to substitute tags for directory names.

Behavioral Code You can also generate code from three UML behavioral modeling paradigms:
· StateMachine diagrams (SW & HW)
· Interaction (Sequence) diagrams (SW)
· Activity diagrams (SW)

Live Code Generation On the 'Code > Configure > Options' drop-down menu, you have the option to
update your source code instantly as you make changes to your model.

Tasks When you generate code, you perform one or more of these tasks:
· Generate a Single Class
· Generate a Group of Classes
· Generate a Package
· Update Package Contents

Notes

· Most of the tools provided by Enterprise Architect for code engineering and debugging are available in the
Professional and higher editions of Enterprise Architect; Behavioral Code Generation is available in the Unified and
Ultimate editions
· When security is enabled you require the access permissions 'Generate Source Code and DDL' and 'Reverse
Engineer from DDL and Source Code'

(c) Sparx Systems 2018 Page 14 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Generate a Single Class


Before you generate code for a single Class, you:
· Complete the design of the model element (Class or Interface)
· Create Inheritance connectors to parents and Associations to other Classes that are used
· Create Inheritance connectors to Interfaces that your Class implements; the system provides an option to generate
function stubs for all interface methods that a Class implements

Generate code for a single Class

Step Action

1 Open the diagram containing the Class or Interface for which to generate code.

2 Click on the required Class or Interface and select the 'Code > Source Code > Generate > Generate Single
Element' ribbon option, or press F11.
The 'Generate Code' dialog displays, through which you can control how and where your source code is
generated.

3
In the 'Path' field, click on the button and select a path name for your source code to be generated to.

4 In the 'Target Language' field, click on the drop-down arrow and select the language to generate; this
becomes the permanent option for that Class, so change it back if you are only doing one pass in another
language.

5 Click on the Advanced button.


The 'Object Options' dialog displays, providing subsets of the 'Source Code Engineering' and code
language options pages on the 'Preferences' dialog.

6 Set any custom options (for this Class alone), then click on the Close button to return to the 'Generate
Code' dialog.

7 In the 'Import(s) / Header(s)' fields, type any import statements, #includes or other header information.
Note that in the case of Visual Basic this information is ignored; in the case of Java the two import text
boxes are merged; and in the case of C++ the first import text area is placed in the header file and the
second in the body (.cpp) file.

8 Click on the Generate button to create the source code.

9 When complete, click on the View button to see what has been generated.
Note that you should set up your default viewer/editor for each language type first; you can also set up the
default editor on the 'Code Editors' page of the 'Preferences' dialog ('Start > View > Preferences > Source
Code Engineering > Code Editors').

(c) Sparx Systems 2018 Page 15 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Generate a Group of Classes


In addition to being able to generate code for an individual Class, you can also select a group of Classes for batch code
generation. When you do this, you accept all the default code generation options for each Class in the set.

Generate Class Group

Step Detail

1 Select a group of Classes and/or interfaces in a diagram.

2 Click on an element in the group and select the 'Code > Source Code > Generate > Generate Selected
Element(s)' ribbon option (or press Shift+F11).
If no code exists for the selected elements, the 'Save As' dialog displays on which you specify the file path
and name for each code file; enter this information and click on the Save button.

3 The 'Batch Generation' dialog displays, showing the status of the process as it executes (the process might
be too fast to see this dialog).
If code already exists for the selected Class elements, and changes have been made to the Class name or
structure, the 'Synchronize Element <package name>.<element name>' dialog might also display; this
dialog helps synchronize the model and code.

Notes

· If any of the elements selected are not Classes or interfaces the option to generate code is not available

(c) Sparx Systems 2018 Page 16 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Generate a Package
In addition to generating source code from single Classes and groups of Classes, you can generate code from a Package.
This feature provides options to recursively generate code from child Packages and automatically generate directory
structures based on the Package hierarchy. This helps you to generate code for a whole branch of your project model in
one step.

Access

Ribbon Code > Source Code > Generate > Generate All

Keyboard Shortcuts Ctrl+Alt+K

Generate code from a Package, on the Generate Package Source Code dialog

Step Action

1 In the 'Synchronize' field, click on the drop-down arrow and select the appropriate synchronize option:
· 'Synchronize model and code': Code for Classes with existing files is forward synchronized with that
file; code for Classes with no existing file is generated to the displayed target file
· 'Overwrite code': All selected target files are overwritten (forward generated)
· 'Do not generate': Generate code for only those selected Classes that do not have an existing file; all
other Classes are ignored

2 Highlight the Classes for which to generate code; leave unselected any to not generate code for.
If you want to display more of the information within the layout, you can resize the dialog and its
columns.

3 To make Enterprise Architect automatically generate directories and filenames based on the Package
hierarchy, select the 'Auto Generate Files' checkbox; this enables the 'Root Directory' field, in which you
select a root directory under which the source directories are to be generated.
By default, the 'Auto Generate Files' feature ignores any file paths that are already associated with a Class;
you can change this behavior by also selecting the 'Retain Existing File Paths' checkbox.

4 To include code for all sub-Packages in the output, select the 'Include Child Packages' checkbox.

5 Click on the Generate button to start generating code.


As code generation proceeds, Enterprise Architect displays progress messages. If a Class requires an
output filename the system prompts you to enter one at the appropriate time (assuming Auto Generate
Files is not selected). For example, if the selected Classes include partial Classes, a prompt displays to
enter the filename into which to generate code for the second partial Class.

Further information on the dialog options

(c) Sparx Systems 2018 Page 17 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Option Action

Root Package Check the name of the Package for which code is to be generated.

Synchronize Select options that specify how existing files should be regenerated.

Auto Generate Files Specify whether Enterprise Architect should automatically generate file names and
directories, based on the Package hierarchy.

Root Directory If Auto Generate Files is selected, display the path under which the generated
directory structures are created.

Retain Existing File Paths If Auto Generate Files is selected, specify whether to use existing file paths
associated with Classes.
If Auto Generate Files is unselected, Enterprise Architect generates Class code to
automatically determined paths, regardless of whether source files are already
associated with the Classes.

Include all Child Packages Also generate code for all Classes in all sub-Packages of the target Package in the
list.
This option facilitates recursive generation of code for a given Package and its
sub-Packages.

Select Objects to Generate List all Classes that are available for code generation under the target Packages;
only code for selected (highlighted) Classes is generated.
Classes are listed with their target source file.

Select All Mark all Classes in the list as selected.

Select None Mark all Classes in the list as unselected.

Generate Start the generation of code for all selected Classes.

Cancel Exit the 'Generate Package Source Code' dialog; no Class code is generated.

(c) Sparx Systems 2018 Page 18 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Update Package Contents


In addition to generating and importing code, Enterprise Architect provides the option to synchronize the model and
source code, creating a model that represents the latest changes in the source code and vice versa. You can use either the
model as the source, or the code as the source.
The behavior and actions of synchronization depend on the settings you have selected on the 'Attributes and Operations'
page of the 'Preferences' dialog. Working with these settings, you can either protect or automatically discard information
in the model that is not present in the code, and prompt for a decision on code features that are not in the model. In these
two examples, the appropriate checkboxes have been selected for maximum protection of data:
· You generated some source code, but made subsequent changes to the model; when you generate code again,
Enterprise Architect adds any new attributes or methods to the existing source code, leaving intact what already
exists, which means developers can work on the source code and then generate additional methods as required from
the model, without having their code overwritten or destroyed
· You might have made changes to a source code file, but the model has detailed notes and characteristics you do not
want to lose; by synchronizing from the source code into the model, you import additional attributes and methods
but do not change other model elements
Using the synchronization methods, it is simple to keep source code and model elements up to date and synchronized.

Access

Ribbon Code > Source Code > Synchronize > Synchronize Package

Synchronize Package contents against source code

Field/Button Action

Update Type Select the radio button to either Forward Engineer or Reverse Engineer the Package
Classes, as appropriate.

Include child packages in Select the checkbox to include child Packages in the synchronization.
generation

OK Click on the button to start synchronization.


Enterprise Architect uses the directory names specified when the project source was
first imported/generated and updates either the model or the source code depending
on the option chosen. If:
· Performing forward synchronization AND
· There are differences between the model and code AND
· The 'On forward synch, prompt to delete code features not in model' checkbox
is selected in the 'Options - Attributes and Operations' dialog
THEN the 'Synchronize Element <package name>.<element name>' dialog
displays.
Otherwise, no further action is required.

(c) Sparx Systems 2018 Page 19 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes

· Code synchronization does not change method bodies; behavioral code cannot be synchronized, and code generation
only works when generating the entire file
· In the Corporate, Unified and Ultimate editions of Enterprise Architect, if security is enabled you must have
'Generate Source Code and DDL' permission to synchronize source code with model elements

(c) Sparx Systems 2018 Page 20 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Synchronize Model and Code


You might either:
· Synchronize the code for a Package of Classes against the model in the Project Browser, or
· Regenerate code from a batch of Classes in the model
In such processes, there might be items in the code that are not present in the model.
If you want to trap those items and resolve them manually, select the 'On forward synch, prompt to delete code features
not in model' checkbox in the 'Options - Attributes and Operations' dialog, so that the 'Synchronize Element <package
name>.<element name>' dialog displays, providing options to respond to each item.

Synchronize Items

Button Detail

Select All Highlight and select all items in the Feature column.

Clear All Deselect and remove highlighting from all items in the Feature column.

Delete Mark the selected code features to be removed from the code (the value in the
Action column changes to Delete).

Reassign Mark the selected code features to be reassigned to elements in the model.
This is only possible when an appropriate model element is present that is not
already defined in the code.
The Select the Corresponding Class Feature dialog displays, from which you select
the Class to reassign the feature to. Click on the OK button to mark the feature for
reassignment.

Ignore Mark the selected code elements not present in the model to be ignored completely
(the default; the value in the Action column remains as or changes to <none>).

Reset to Default Reset the selected items to Ignore (the value in the Action column changes to
<none>).

OK Make the assigned changes to the items, and close the dialog.

(c) Sparx Systems 2018 Page 21 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Namespaces
Languages such as Java support Package structures or namespaces. In Enterprise Architect you can specify a Package as
a namespace root, which denotes where the namespace structure for your Class model starts; all subordinate Packages
below a namespace root will form the namespace hierarchy for contained Classes and Interfaces.
To define a Package as a namespace root, click on the Package in the Project Browser and select the 'Code > Configure >
Options > Set as Namespace Root' ribbon option. The Package icon in the Project Browser changes to show a colored
corner indicating this Package is a namespace root.

Generated Java source code, for example, will automatically add a Package declaration at the beginning of the generated
file, indicating the location of the Class in the Package hierarchy below the namespace root.
To clear an existing namespace root, click on the namespace root Package in the Project Browser and deselect the 'Code
> Configure > Options > Set as Namespace Root' ribbon option
To view a list of namespaces, select the 'Configure > Reference Data > Settings > Namespace Roots' ribbon option; the
'Namespaces' dialog displays. If you double-click on a namespace in the list, the Package is highlighted in the Project
Browser; alternatively, right-click on the namespace and select the 'Locate Package in Browser' option.
You can also clear the selected namespace root by selecting the 'Clear Namespace Attribute' option.
To omit a subordinate Package from a namespace definition, select the 'Code > Configure > Options > Suppress
Namespace' ribbon option; to include the Package in the namespace again, deselect the ribbon option.

Notes

· When performing code generation, any Package name that contains whitespace characters is automatically treated as
a namespace root

(c) Sparx Systems 2018 Page 22 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Importing Source Code

The ability to view programming code and the models it is derived from at the same time brings clarity to the design of a
system. One of Enterprise Architect's powerful code engineering features is the ability to Reverse Engineer source code
into a UML model. A wide range of programming languages are supported and there are options that govern how the
models are generated. Once the code is in the model it is possible to keep it synchronized with the model regardless of
whether the changes were made directly in the code or the model itself. The code structures are mapped into their UML
representations; for example, a Java class is mapped into a UML Class element, variables are defined as attributes,
methods modeled as operations, and interactions between the Java classes represented by the appropriate connectors.
The representation of the programming code as model constructs helps you to gain a better understanding of the structure
of the code and how it implements the design, architecture and the requirements, and ultimately how it delivers the
business value.
It is important to note that if a system is not well designed, simply importing the source into Enterprise Architect does
not turn it into an easily understandable UML model. When working with a poorly designed system it is useful to assess
the code in manageable units by examining the individual model Packages or elements generated from the code; for
example, dragging a specific Class of interest onto a diagram and then using the 'Insert Related Elements' option at one
level to determine the immediate relationships between that Class and other Classes. From this point it is possible to
create Use Cases that identify the interaction between the source code Classes, providing an overview of the application's
operation.
Several options guide how the code is reversed engineered, including whether comments are imported to notes and how
they are formatted, how property methods are recognized and whether Dependency relationships are created for
operation return and parameter types.

Copyright Ownership

Situations that typically lend themselves to reverse engineering tend to operate on source code that:
· You have already developed
· Is part of a third-party library that you have obtained permission to use
· Is part of a framework that your organization uses
· Is being developed on a daily basis by your developers
If you are examining code that you or your organization do not own or do not have specific permission to copy and edit,
you must ensure that you understand and comply with the copyright restrictions on that code before beginning the
process of reverse engineering.

Supported languages for Reverse Engineering

Language

Action Script

Ada 2012 (Unified and Ultimate editions)

(c) Sparx Systems 2018 Page 23 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C#

C++

CORBA IDL (MDG Technology)

Delphi

Java

PHP

Python

SystemC (Unified and Ultimate editions)

Verilog (Unified and Ultimate editions)

VHDL (Unified and Ultimate editions)

Visual Basic

Visual Basic .NET

Notes

· Reverse Engineering is supported in the Professional, Corporate, Unified and Ultimate editions of Enterprise
Architect
· If security is enabled you must have 'Reverse Engineer From DDL And Source Code' permission to reverse engineer
source code and synchronize model elements against code
· Using Enterprise Architect, you can also import certain types of binary files, such as Java .jar files and .NET PE files
· Reverse Engineering of other languages is currently available through the use of MDG Technologies listed on the
MDG Technology pages of the Sparx Systems website

(c) Sparx Systems 2018 Page 24 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Projects
Enterprise Architect provides support for importing software projects authored in Visual Studio, Mono, Eclipse and
NetBeans. Importing projects has multiple benefits, not least the immediate access to Enterprise Architect's renowned
modeling tools and management features, but importantly development tools such as simulation, debugging and
profiling.

Access

Ribbon Code > Import > Project > Import <project type>

Import Options

Option Description

Prompt for Missing Macro For C++ projects the parser might encounter unrecognized macros. If you select
Definitions this option, you will be prompted when such an event occurs and have the
opportunity to define the macro. If you do not select this option, the resultant Class
model could be missing certain items.

Create Diagram for Each When selected, a Class diagram is created depicting the Class model for each
Package Package. The result is a larger but more colorful model. Deselecting this option will
the cause diagram creation to be skipped and the import to run faster.

Generate Analyzer Scripts Selecting this option will generate Analyzer Scripts for each project configuration
in addition to scripts for each Solution configuration. The scripts will allow for
building and debugging the program(s) described by the solution immediately after
the import completes. Note: Select the Windows platform. If you do not select this
option no Execution Analyzer features will be configured.

Startup Project When this is selected, this script for this Project will become the model default. The
Execution Analyzer Ribbon and Toolbars buttons will automatically target this
program.

Import Visual Studio Solution

This option allows you to import one or more projects from an existing Visual Studio Solution file or running instance of
Visual Studio. The dialog that is presented has some options.

Import Mono Solution

This option allows you to import Mono projects from a solution file. The dialog that is presented is the same as the
'Visual Studio Import' dialog, but you can choose to target either Linux or Windows. The wizard will generate a Class
model for each of the projects and configure them for debugging.

(c) Sparx Systems 2018 Page 25 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Options

Option Description

Find and Select the The Mono Solution files have a .sln file extension the same as Visual Studio.
Solution File.

Select the Projects to After the solution is selected, the projects in the solution are displayed. Select the
Import Projects in the list that should be imported by the wizard.

Prompt for Missing Macros Not applicable.

Create Diagram for Each When selected, a Class diagram is created depicting the Class model for each
Package Package. The result is a larger but more colorful model. Deselecting this option will
cause diagram creation to be skipped and the import to run faster.

Generate Analyzer Scripts This option allows you to target either Linux or Windows. If you select Linux, it is
assumed the machine on which Enterprise Architect is running is Linux, that Mono
is installed there and that the compiled programs run on Linux.

Startup Project Selecting the Startup project means that the debugging tools will be set to target
that program by default.

Import Eclipse Project

The Eclipse 'Wizard' can reverse engineer a Java project described by its Eclipse .project file and ANT build. The feature
will result in a UML Class model and Analyzer Scripts for each of the ANT targets you select. The process will also
generate a script for each debug protocol you select through the 'Wizard'. You will be presented with the choice of JDWP
(Java Debug Wire Protocol), good for servers, and JVMTI (Java Virtual Machine Tools Interface), which is suited to
standalone Java applications. These scripts should be used for debugging the project in Enterprise Architect.

Import NetBeans Project

The NetBeans 'Wizard' can reverse engineer a Java project described by a NetBeans XML project file and ANT build.
The 'Wizard' will create a UML Class model of the project and Analyzer Scripts for each of the ANT targets you select.
The process will also generate a script for each debug protocol you select through the 'Wizard'. These scripts should be
used for debugging the project in Enterprise Architect. You will be presented with the choice of JDWP (Java Debug
Wire Protocol), good for servers, and JVMTI (Java Virtual Machine Tools Interface), which is suited to standalone Java
applications

(c) Sparx Systems 2018 Page 26 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Source Code


You can import source code into your Enterprise Architect model, to reverse-engineer a module. As the import proceeds,
Enterprise Architect provides progress information. When all files are imported, Enterprise Architect makes a second
pass to resolve associations and inheritance relationships between the imported Classes.

Procedure - Import source code

Step Action

1 In the Project Browser, select (or add) a diagram into which to import the Classes.

2 Click on the diagram background and either:


· Select the 'Code > Import > File' ribbon option and click on the appropriate language, or
· If the Code Generation toolbar is displayed, click on the 'Import' drop-down arrow and select the
language to import
The list of languages will include any customized languages you have created model structures for.

3 From the file browser that appears, locate and select one or more source code files to import.

4 Click on the Open button to start the import process.

(c) Sparx Systems 2018 Page 27 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes on Source Code Import


You can import code into your Enterprise Architect project, in a range of programming languages. Enterprise Architect
supports most constructs and keywords for each coding language. You select the appropriate type of source file for the
language, as the source code to import.
If there is a particular feature you require support for that you feel is missing, please contact Sparx Systems.

Notes

· When reverse engineering attributes with parameter substitutions (templated attributes):


- If a Class with proper template parameter definitions is found, an Association connector is
created and its parameter substitutions are configured
- An Association connector is also created if a matching entry is defined as a Collection Class or
in the 'Additional Collection Classes' option (for C#, C++ and Java); for an example, see Example
Use of Collection Classes

Programming Language notes

Language Notes

ActionScript Appropriate type of source file: .as code file.

C Appropriate type of source file: .h header files and/or .c files.


When you select a header file, Enterprise Architect automatically searches for the
corresponding .c implementation file to import, based on the options for extension
and search path specified in the C options.
Enterprise Architect does not expand macros that have been used, these must be
added into the internal list of Language Macros.

C++ Appropriate type of source file: .h header file.


Enterprise Architect automatically searches for the .cpp implementation file based
on the extension and search path set in the C++ options; when it finds the
implementation file, it can use it to resolve parameter names and method notes as
necessary.
When importing C++ source code, Enterprise Architect ignores function pointer
declarations.
To import them into your model you could create a typedef to define a function
pointer type, then declare function pointers using that type; function pointers
declared in this way are imported as attributes of the function pointer type.
Enterprise Architect does not expand macros that have been used; these must be
added into the internal list of Language Macros.

C# Appropriate type of source file: .cs.

Delphi Appropriate type of source file: .pas.

Java Appropriate type of source file: .java.


Enterprise Architect supports the AspectJ language extensions.

(c) Sparx Systems 2018 Page 28 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Aspects are modeled using Classes with the stereotype aspect; these aspects can
then contain attributes and methods as for a normal Class.
If an intertype attribute or operation is required, you can add a tag 'className' with
the value being the name of the Class it belongs to.
Pointcuts are defined as operations with the stereotype <<pointcut>>, and can occur
in any Java Class, Interface or aspect; the details of the pointcut are included in the
'behavior' field of the method.
Advice is defined as an operation with the stereotype <<advice>>; the pointcut this
advice operates on is in the 'behavior' field and acts as part of the method's unique
signature.
afterAdvice can also have one of the Tagged Values returning or throwing.

PHP Appropriate type of source file: .php, .php4, or .inc.


Nested if condition syntax is enabled.

Python Appropriate type of source file: .py.

Visual Basic Appropriate type of source file: .cls Class file.

Visual Basic .NET Appropriate type of source file: .vb Class file.

(c) Sparx Systems 2018 Page 29 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Resource Script


Enterprise Architect supports the import and export of Microsoft Windows Resource Scripts (as .rc files), which contain
the Win32® dialog definitions (those with the stereotype «win32Dialog») for an application's graphical user interface.
Dialog resources are imported and exported for a specific language, defaulting to the locale of the current computer
system.

Access

Ribbon Code > Import > File > Import Resource Script

Keyboard Shortcuts F7 (synchronize element with code)

Import dialog resources from a .rc file

Option Action

Resource File
Click on the button and locate the .rc file to import the screen elements(s)
from.

Resource ID Either:
· Leave the default value 'All' to import all screen elements from the file, or
· Click on the drop-down arrow and select the screen ID of a specific dialog to
import

Language Click on the drop-down arrow and select the language version (such as English -
United States) of the dialog(s) to import.

Import Click on this button to import the screens from the resource file.
The progress of the import is reported in the field underneath the 'Language' field.

Export a dialog to a .rc file

Option Action

Screen ID Defaults from the Win32UI ID Tagged Value of the selected Screen element.
(If the dialog does not have this ID, open the 'Win32UI' page of the element's
'Properties' dialog and provide a value for the ID tag.)

Resource File
Click on the button and locate the .rc file into which to export the screen
element(s).

(c) Sparx Systems 2018 Page 30 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

If the element was previously imported, this field defaults to the source file.

Language Click on the drop-down arrow and select the language version (such as English -
United States) of the exported dialog.

Export Click on this button to export the screens from the resource file.
The progress of the export is reported in the field underneath the 'Language' field.

Notes

· New dialogs are exported to an existing .rc file


· In an export to an existing .rc file, no dialogs are ever deleted from the file, even when they are deleted from the
model
· In an import, no dialogs are deleted from the model even when omitted from the original .rc file

(c) Sparx Systems 2018 Page 31 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import a Directory Structure


You can import from all source files in a complete directory structure, which enables you to import or synchronize
multiple files in a directory tree in one pass.
Enterprise Architect creates the necessary Packages and diagrams during the import process.

Access

Ribbon Code > Import > File > Import Source Directory

Keyboard Shortcuts Ctrl+Shift+U

Import a directory structure, using the 'Import Source Directory' dialog

Step Action

1 Select the options you require; you can configure:


· The source directory
· The source type
· The file extensions to look at
· Whether to recurse sub directories
· Whether to create a diagram for each Package
· Whether to import additional files as described in the 'Import Component Types' dialog
· Whether to exclude private members from libraries being imported from the model
· Whether to Synchronize or Overwrite existing Classes when found; if a model Class is found
matching the one in code:
- 'Synchronize' updates the model Class to include the details
from the one in code, which preserves information not
represented in code, such as the location of Classes in diagrams
- 'Overwrite' deletes the model Class and generates a new one
from code, which deletes and does not replace the additional
information
· Whether to create a Package for every directory, namespace or file; this might be restricted depending
on the source type selected
· How to handle Classes not found during the import (prompt for action enables you to review Classes
individually)
· What is shown on diagrams created by the import

2 Click on the OK button to start.

(c) Sparx Systems 2018 Page 32 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Binary Module


Enterprise Architect enables you to reverse-engineer certain types of binary modules.

Access

Ribbon Code > Import > File > Import Binary Module

Use

Currently the permitted types are:


· Java Archive (.jar)
· .NET PE file (.exe, .dll) - Native Windows DLL and EXE files are not supported, only PE files containing .NET
assembly data
· Intermediate Language file (.il)
Enterprise Architect creates the necessary Packages and diagrams during the import process; selecting the 'Do not import
private members' checkbox excludes private members from libraries from being imported into the model.
When importing .NET files, you can import via reflection or via disassembly, or let the system select the best method -
this might result in both types being used.
The reflection-based importer relies on a .NET program, and requires the .NET runtime environment to be installed.
The disassembler-based importer relies on a native Windows program called Ildasm.exe, which is a tool provided with
the MS .NET SDK; the SDK can be downloaded from the Microsoft website.
A choice of import methods is available because some files are not compatible with reflection (such as mscorlib.dll) and
can only be opened using the disassembler; however, the reflection-based importer is generally much faster.
You can also configure:
· Whether to Synchronize or Overwrite existing Classes when found; if a model Class is found matching the one in
the file:
- Synchronize updates the model Class to include the details from the one in the file, which
preserves information not represented in the file, such as the location of Classes in diagrams
- Overwrite deletes the model Class and generates a new one from the file, which deletes and
does not replace the additional information
· Whether to create a diagram for each Package
· What is shown on diagrams created by the import

(c) Sparx Systems 2018 Page 33 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Classes Not Found During Import


When reverse engineering from your code, there might be times when Classes are deliberately removed from your source
code.
The 'Import Source Directory' functionality keeps track of the Classes it expects to synchronize with and, on the 'Import
Directory Structure' dialog, provides options for how to handle the Classes that weren't found.
You can select the appropriate option to make Enterprise Architect, at the end of the import, ignore the missing Classes,
automatically delete them or prompt you to manage them.
On the 'Import Directory Structure' dialog, if you select the 'Prompt For Action' radio button to manually review missing
Classes, a dialog displays on which you specify the handling for each Class that was missing in the imported code.
By default, all Classes are marked for deletion; to keep one or more Classes, select them and click on the Ignore button.

(c) Sparx Systems 2018 Page 34 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Editing Source Code


Enterprise Architect contains a powerful source code editor that helps you to view, edit and maintain your source code
directly inside the tool. Once source code has been generated for one or more Classes it can be viewed in this flexible
editing environment. Seeing the code in the context of the UML models from which it is derived brings clarity to both
the code and the models, and bridges the gap between design and implementation that has historically introduced errors
into software systems.
The Source Code Editor is fully-featured, with a structure tree for easy navigation of attributes, properties and methods.
Line numbers can be displayed and syntax highlight options can be configured. Many of the features that software
engineers are familiar with in their favorite IDE, such as Intelli-sense and code completion are included in the editor.
There are many additional features, such as macro recording that makes it easy to manage the source code inside
Enterprise Architect. There are also many options for managing the code, available through the code editor context
menu, toolbar and function keys.
For most programming languages a single file is created from a UML Class, but in the case of C++ both header and
implementation classes are created and the source code editor displays these files in separate tabs.
A number of options change the way the source code editor works; they can be altered using the 'Preferences' dialog
available from the Start ribbon:
'Start > View > Preferences > Source Code Engineering > Code Editors'
There are four variants of the Source Code Editor, with different access methods. The variants are discussed in the
Compare Editors topic.

Access

Ribbon Code > Source Code > Edit > Open Source File or
Code > Source Code > Edit > Edit Element Source or
Code > Source Code > Edit > Edit New Source File

Keyboard Shortcuts Ctrl+Alt+O (for external files)

Facilities

Facility Description

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:

(c) Sparx Systems 2018 Page 35 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Structure Tree The structure tree is available for supported language files, such as C++, C#, Java,
XML files such as XSD, XSL

Notes

· There are no ribbon options to display XML or DDL.sql files; select the appropriate object and use the keyboard
keys F12 or 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; click on the
element in the Project Browser and press Ctrl+Alt+Y

(c) Sparx Systems 2018 Page 36 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Languages Supported
The Source Code Editors can display code in a wide range of languages, as listed here. For each language, the editor
highlights - in colored text - the standard code syntax.
· Ada (.ada, .ads, .adb)
· ActionScript (.as)
· BPEL Document (.bpel)
· C++ (.h, .hh, .hpp, .c, .cpp, .cxx)
· C# (.cs)
· DDL Structured Query Language (.sql)
· Delphi/Pascal (.pas)
· Diff/Patch Files (.diff, .patch)
· Document Type Definition (.dtd)
· DOS Batch Files (.bat)
· DOS Command Scripts (.cmd)
· HTML (.html)
· Interface Definition Language (.idl, .odl)
· Java (.java)
· JavaScript (.javascript)
· JScript (.js)
· Modified Backus-Naur Form Grammar (.mbnf)
· PHP (.php, .php4, .inc)
· Python (.py)
· Standard Generalized Markup Language (.sgml)
· SystemC (.sc)
· Visual Basic 6 (.bas)
· VB.NET (.vb)
· VBScript (.vbs)
· Verilog (.v)
· VHSIC Hardware Description Language (.vhdl)
· Visual Studio Resource Configuration (.rc)
· XML (eXtensible Markup Language) (.xml)
· XSD (XML Schema Definition)
· XSL (XML Stylesheet Language)

(c) Sparx Systems 2018 Page 37 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Configure File Associations


If you are a Windows® user, you can configure Enterprise Architect to be the default document handler for your
language source files.

Access

Ribbon Start > View > Preferences > Source Code Engineering > Code Editors : Configure
Enterprise Architect File Associations

Actions

For each file type that you would prefer to open in Enterprise Architect, click on the checkbox to the left of the file type
name. After selecting all of the document types you require, click on the Save button.
After this, clicking on any corresponding file in Windows® Explorer will open it in Enterprise Architect.

Notes

· You can change the default programs, or documents handled by them, directly through the 'Default Programs' option
in Windows ® Control panel.

(c) Sparx Systems 2018 Page 38 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Compare Editors
Enterprise Architect provides four principal code editor variants, available through a number of access paths. The most
direct access options are identified in these descriptions.
The first three code editor variants listed have the same display format, option toolbar, context menu options and internal
function keys. They differ in their method of access and display mechanism.

Editor Variants

Variant DDetails

Source Code window Alt+7


(Dockable) 'Code > Source Code > Edit > Open Source File'
Description: Displays the contents of the source file for a selected Class (except if
the language is C++, when the window displays a tab for the Header file and a tab
for the Implementation file).
If you select a different Class, the window changes to show the code for the new
Class (unless the first Class calls the second, in which case the window scrolls
down to the second Class's code instead).

Source Code View F12


Ctrl+E
Class context menu | 'View Source Code'
Description: Displays the code on a tab of the Diagram View; the tab label shows
the file name and extension (such as .java); again, for C++, there are two tabs for
the Header and Implementation files.
You can display the source code for other Classes on additional tabs, by reselecting
the menu option/keys on the next Class.

Internal Editor, External Ctrl+Alt+O


Source Code 'Code > Source Code > Edit > Open Source File' ribbon option
Description: Use this option if you intend to edit external code, XML or DDL files
(that is, code not imported to or generated in Enterprise Architect).
Displays an external browser, then opens the specific selected code file as a tab of
the Diagram View (for C++, not two code files); otherwise this is identical to the
F12 option.

External Editor, Internal or Ctrl+Alt+Y


External Source Code Class context menu | Open Source Directory
Description: Displays an external file browser, open to the directory containing the
selected Class's source files; you can open the files in Notepad, Visual Studio or
other tools you might have on your system.

(c) Sparx Systems 2018 Page 39 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Editor Toolbar


When you are reviewing the code for a part of your model in the Source Code editor, you can access a wide range of
display and editing functions from the editor toolbar.

Code Editor Toolbar

Toolbar Options

Structure Tree Click on this icon to show or hide the element hierarchy panel (the left panel of the
Source Code editor).

Line Numbers Click on this icon to show or hide the line numbers against the lines of code.

Source Code Engineering Click on the drop-down arrow to display a menu of options to select individual
Properties 'Source Code Engineering' pages of the 'Preferences' dialog, from which you can
configure display and behavior options for source code engineering:
· Syntax Highlighting Options
· Code Editor Options
· Code Engineering Options
· Code Editor Key Bindings

Editor Functions Click on the drop-down arrow to display a menu providing access to a range of
code editing functions:
· 'Open Corresponding File' (Ctrl+Shift+O) - opens the header or
implementation file associated with the currently-open file
· 'Go to Matching Brace' (Ctrl+E) - for a selected opening or closing brace,
highlights the corresponding closing or opening brace in the pair
· 'Go to Line (Ctrl+G) - displays a dialog on which you select the number of the
line to highlight; click on the OK button to move the cursor to that line
· 'Cursor History Previous' (Ctrl+-) - the Source Code viewer keeps a history of
the previous 50 cursor positions, creating a record when the cursor is moved
either more than 10 lines away from its previous position, or in a
find-and-replace operation; the menu option moves the cursor to the position in
the immediately-previous cursor history record
· 'Cursor History Next' (Ctrl+Shift+-) - if you have moved to an earlier cursor
position, this option moves the cursor to the position in the
immediately-following cursor history record
· 'Find' (Ctrl+F) - displays a dialog in which you define a text string and search
options to locate that text string in the code
· 'Replace' (Ctrl+R) - displays a dialog in which you define a text string and
search options to locate that text string in the code and replace it with another
text string; the dialog has options to locate and replace each occurrence as you
decide, or to replace all occurrences immediately
· 'Highlight Matching Words' - (Ctrl+3) Enables or disables the highlighting of
matching words during a find operation; by default this option is enabled

(c) Sparx Systems 2018 Page 40 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· 'Record Macro' - records your next keystrokes to be saved as a macro


· 'Stop Recording and Save Macro' - stops recording the keystrokes and displays
the 'Save Macro' dialog on which you specify a name for the macro
· 'Play Macro' - displays the 'Open Macro' dialog from which you select and
execute a saved macro, to repeat the saved keystrokes
· 'Toggle Line Comment' (Ctrl+Shift+C) - comments out (//) or re-establishes the
code for each full line in which text is highlighted
· 'Toggle Stream Comment' (Ctrl+Shift+X) - inserts a stream comment (/* */) at
the cursor position (comments out only the highlighted characters and lines), or
re-establishes the commented text as code
· 'Toggle Whitespace Characters' (Ctrl+Shift+W) - shows or hides the spacing
characters: --> (tab space) and . (character space)
· 'Toggle EOL Characters' (Ctrl+Shift+L) - shows or hides the end-of-line
characters: CR (carriage return) and LF (line feed)
· 'Open Containing Folder' - opens the file browser at the folder containing the
code file; you can open other files in your default external editor for
comparison and parallel work

Save Source and Click on this icon to save the source code and resynchronize the code and the Class
Resynchronize Class in the model.

Code Templates Click on this icon to access the Code Templates Editor, to edit or create code
templates for code generation.

Find in Project Browser For a selected line of code, click on this icon to highlight the corresponding
structure in the Project Browser. If there is more than one possibility the 'Possible
Matches' dialog displays, listing the occurrences of the structure from which you
can select the required one.

Search in Files Click on this icon to search for the selected object name in associated files, and
display the results of the search in the File Search window. You can refine and
refresh the search by specifying criteria on the Find in Files window toolbar.

Search in Model Click on this icon to search for the selected text throughout the model, and display
the results of the search in the Find in Project view.

Go to Declaration Click on this icon to locate the declaration of a symbol in the source code.

Go to Definition Click on this icon to locate the definition of a symbol in the source code (applicable
to languages such as C++ and Delphi, where symbols are declared and defined in
separate files).

Autocomplete List Click on this icon to display the autocompletion list of possible values; double-click
on a value to select it.

Parameter Information When the cursor is between the parentheses of an operation's parameter list, click
on this icon to display the operation's signature, highlighting the current parameter.

Find Current Class in Click on this icon to display the name of the currently-selected Class in the code,
Project Browser and highlight that name in the Project Browser; if there is more than one possibility
the 'Possible Matches' dialog displays, listing the occurrences of the Class from
which you can select the required one.

Find Member Click on this icon to display the name of the currently-selected attribute or method
in the code, and highlight that name in the Project Browser; if there is more than

(c) Sparx Systems 2018 Page 41 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

one possibility the 'Possible Matches' dialog displays, listing the occurrences of the
feature from which you can select the required one.

Notes

· The 'Record Macro' option disables Intelli-sense while the macro is being recorded
· You can assign key strokes to execute the macro, instead of using the toolbar drop-down and 'Open Macro' dialog

(c) Sparx Systems 2018 Page 42 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Editor Context Menu


When working on a file with a code editor, you can perform a number of code search and editing operations to review
the contents of the file. These options are available through the editor context menu, and can vary depending on which
code editor you are using.

Access

Context Menu Right-click on the code text string you are working on

Options

Go to Declaration Locate and highlight the declaration of a symbol in the source code.

Go to Definition Locate and highlight the definition of a symbol in the source code (applicable to
languages such as C++ and Delphi, where symbols are declared and defined in
separate places).

Search for '<string>' Display a submenu providing options to locate the selected text string in a range of
locations.
· 'Find in Project Browser' - Highlight the object containing the selected text in
the Project Browser
· 'Search in Open Files' - Search for the selected text string in associated open
files and display the results of the search in the Find in Files window; you can
refine and refresh the search by specifying criteria on the Find in Files window
toolbar
· 'Search in Files' - Search for the selected text string in all associated files
(closed or open), and display the results of the search in the Find in Files
window; you can refine and refresh the search by specifying criteria on the
Find in Files window toolbar (shortcut key: F12)
· 'Search in Model' - Perform an 'Element Name' search in the Model Search
facility, and display the results on the Model Search tab
· 'Search in Scripts' - (Available while working in the Script Editor) Open the
Find in Files window, set the 'Search Path' field to 'Search in Scripts' and the
'Search Text' field to the selected text, then search all scripts for the text string
and display the results of the search; you can refine and refresh the search by
specifying criteria on the Find in Files window toolbar
· 'EA User Guide' - Display the description of the code item in the Enterprise
Architect User Guide
· 'Google' - Display the results of a Google search on the text
· 'MSDN' - Display the results of a search on the text in the Microsoft Developer
Network (MSDN)
· 'Sun Java SE' - Display the results of a search on the text in the Sun
Microsystems 'Sun Search' facility
· 'Wikipedia' - Display any entry on the object on the Wikipedia web site
· 'Koders' - Display the results of a search for the text string on Koders.com

(c) Sparx Systems 2018 Page 43 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Search Intelli-sense | <list Perform a search on the specified string in any Intelli-sense libraries listed in the
of query names> active Execution Analyzer script, and display the results in the Find in Files
window, 'Intelli-sense Search' tab.
Shortcut key: Shift+F12

Set Debugger to Line (If the debugger is executing and has reached a breakpoint.) Move the execution
point to the current line. Check that you do not skip over any code or declarations
that affect the next section of code being debugged.

Display Variable (If the debugger is executing.) Open the Locals window and highlight the local
variable for the current point in the code.

Show in String Viewer Display the full contents of a variable string in the String Viewer.

Create Use Case for Display the 'Create Use Case For Method' dialog, through which you create a Use
'<string>' Case for the method containing the text string.

Breakpoint Display a submenu of options for creating a recording marker on the selected line
of code. The recording markers you can add include:
· Breakpoint
· Start Recording Marker
· End Recording Marker
· Stack Auto Capture Marker
· Method Auto Record Marker
· Tracepoint

Testpoints Display options to add a new Testpoint, show the Testpoints Manager (Testpoints
window) or edit an existing Testpoint if one or more are already defined at the
selected location.
(The sub-options depend on the type of code file you are reviewing.)

XML Validation Allows an XML document to be checked for compliance with its own schema
references or using a user-specified schema; either a local schema file or a URL.

Open (Close) IME Open (or close) the Input Method Editor, so that you can enter text in a selected
foreign language script, such as Japanese. You set the keyboard language using the
Windows Control Panel - Regional and Language Options facility.

Line Numbers (Script Editor only.) Show or hide the code line numbers on the left hand side of the
editor screen.

Undo These six options provide simple functions for editing the code.
Cut
Copy
Paste
Delete
Select All

Notes

· The options in the lower half of the 'Search for <string>' submenu (after 'Search in Scripts') are configurable; you

(c) Sparx Systems 2018 Page 44 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

can add new search tools or remove existing ones by editing the searchProviders.xml file in the Sparx Systems > EA
> Config folder - this file is in OpenSearch description document format

(c) Sparx Systems 2018 Page 45 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Create Use Case for Method


Using the code editor context menu, you can create a Use Case element for a method that you select from the code. You
can also:
· Link the Use Case directly to the method
· Add the parent Class to a diagram (if it is not already in the selected diagram) and/or add the Use Case element to
the diagram
· Block from display any attributes or methods that are not also the targets of feature links

Create a Use Case for a method, through the code editor

Step Action

1 (If you want to depict the Use Case and its link to the method in a diagram) click on the diagram name in
the Project Browser.

2 In the code editor, right-click on either the method name or any part of the method body, and select the
'Create Method for <methodname>' option.
The 'Create Use Case for Method' dialog displays.

3 The basic function of this dialog is to create a Use Case for the selected method:
· If this is all that is required, click on the OK button; the Use Case element is created in the Project
Browser, in the same Package as the parent Class for the method, and with the same name as the
method
· If you intend to make the relationship tangible, continue with the procedure

4 To create a Trace connector linking the Use Case to the method, select the 'Link Use Case to Method'
checkbox.

5 To add the method's parent Class to the diagram, if it is not already there, select the 'Add Class to
Diagram' checkbox.

6 To add the newly-created Use Case to the diagram, select the 'Add Use Case to Diagram' checkbox; this
would now show the Use Case, Class and Trace connector on the diagram.

7 To only show the features (attributes and methods) of the parent Class that are the targets of 'link to
feature' relationships, select the 'Display only linked features in Class' checkbox.
The Class might contain any number of attributes and methods, but those without a 'link to feature'
relationship are hidden.

8 Click on the OK button to create and depict the Use Case and relationship; if you selected all options, the
diagram now contains linked elements resembling this illustration:

(c) Sparx Systems 2018 Page 46 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 47 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Editor Functions


The common Code Editor provides a variety of functions to assist with the code editing process, including:
· Syntax Highlighting
· Bookmarks
· Cursor History
· Brace Matching
· Automatic Indentation
· Commenting Selections
· Scope Guides
· Zooming
· Line Selection
· Intelli-sense
· Find and Replace
· Find in Files
A range of these functions is available through keyboard key combinations and/or context menu options.
You can customize several of the Code Editor features by setting properties in the Code Editor configuration files; for
example, by default the line containing the cursor is always highlighted, but you can turn the highlighting off.

(c) Sparx Systems 2018 Page 48 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Function Details
Code Editor Functions

Function Description

Syntax Highlighting The Code Editor highlights - in colored text - the standard code syntax of all
language file formats supported by Enterprise Architect

You can define how the Code Editor implements syntax highlighting for each
language, through the 'Code Editors' page of the 'Preferences' dialog.

Bookmarks Bookmarks denote a line of interest in the document; you can toggle them on and
off for a particular line by pressing Ctrl+F2.
Additionally, you can press F2 and Shift+F2 to navigate to the next or previous
bookmark in the document.
To clear all bookmarks in the code file, press Ctrl+Shift+F2.

Cursor History The Code Editor Control keeps a history of the previous 50 cursor positions; an
entry in the history list is created when:
· The cursor is moved more than 10 lines from its previous position
· The cursor is moved in a find/replace operation
You can navigate to an earlier point in the cursor history by pressing Ctrl+-, and to
a later point by pressing Ctrl+Shift+-.

Brace Matching When you place the cursor over a brace or bracket, the Code Editor highlights its
corresponding partner; you can then navigate to the matching brace by pressing
Ctrl+E.

Automatic Indentation For each supported language, the Code Editor adjusts the indentation of a new line
according to the presence of control statements or scope block tokens in the lines
leading up to the cursor position.

(c) Sparx Systems 2018 Page 49 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The levels of indent are indicated by pale horizontal lines.


You can also manually indent selected lines and blocks of code by pressing the Tab
key; to un-indent the selected code, press Shift+Tab.

Commenting Selections For languages that support comments, the Code Editor can comment entire
selections of code.
The Code Editor recognizes two types of commenting:
· Line Commenting - entire lines are commented from the start (for example:
// This is a comment)
· Stream Commenting - sections of a line are commented from a specified start
point to a specified end point (for example:
/* This is a comment */)
You can toggle comments on the current line or selection by pressing:
· Ctrl+Shift+C for line comments, or
· Ctrl+Shift+X for stream comments

Scope Guides If the cursor is placed over an indentation marker, the Code Editor performs a 'look
back' to find the line that started the scope at that indentation level; if the line is
found and is currently on screen, it is highlighted in light blue.

Alternatively if the line is off screen, a calltip is displayed advising of the line
number and contents:

Zooming You can zoom into and out of the contents of the Code Editor using:
· Ctrl+keypad + and
· Ctrl+keypad -
Zoom can be restored to 100% using Ctrl+keypad /.

Line Selection If you want to move the cursor to a specific line of code, press Ctrl+G and, in
response to the prompt, type in the line number.
Press the OK button; the editor displays the specified line of code with the cursor at

(c) Sparx Systems 2018 Page 50 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

the left.

(c) Sparx Systems 2018 Page 51 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Intelli-sense
Intelli-sense is a feature that provides choices of code items and values as you type. Not all code editors use Intelli-sense;
for example, Intelli-sense is disabled while you record a macro in the Source Code Viewer.
Intelli-sense provides you with context-based assistance through autocompletion lists, calltips and mouseover
information.

Facilities

Facility Description

Autocompletion List An autocompletion list provides a list of possible completions for the current
text;the list is automatically invoked when you enter an accessor token (such as a
period or pointer accessor) after an object or type that contains members.

You can also invoke the autocompletion list manually by pressing Ctrl+Space; the
Code Editor then searches for matches for the word leading up to the invocation
point.
Select an item from the list and press the Enter key or Tab key to insert the item
into the code; to dismiss the autocompletion list, press Esc.

Calltips Calltips display the current method's signature when you type the parameter list
token (for example, opening parenthesis); if the method is overloaded, the calltip
displays arrows that you can use to navigate through the different method
signatures

(c) Sparx Systems 2018 Page 52 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Mouseover Information You can display supporting documentation for code elements (for example,
attributes and methods) by hovering the cursor over the element in question.

(c) Sparx Systems 2018 Page 53 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Find and Replace


Each of Enterprise Architect's code editors facilitates searching for and replacing terms in the editor, through the 'Find
and Replace' dialog.

Access

Keyboard Shortcuts Highlight the required text string and press:


· Ctrl+F for the find controls only, or
· Ctrl+R for both find and replace controls
In each instance, the 'Find what' field is populated with the text currently selected in
the editor. If no text is selected in the editor, the 'Find what' field is populated with
the word at the current cursor position. If no word exists at the current cursor
position, the last searched-for term is used.

Basic Operations - Commands

Command Action

Find Next Locate and highlight the next instance (relative to the current cursor position) of the
text specified in the 'Find what' field.

Replace Replace the current instance of the text specified in the 'Find what' field with the
text specified in the 'Replace with' field, and then locate and highlight the next
instance (relative to the current cursor position) of the text specified in the 'Find
what' field.

Replace All Automatically replace all instances of the text specified in the 'Find what' field with
the text specified in the 'Replace with' field.

Basic Operations - Options

Option Action

Match Case Specify that the case of each character in the text string in the 'Find what' field is
significant when searching for matches in the code.

Match whole word Specify that the text string in the 'Find what' field is a complete word and should
not be matched with instances of the text that form part of a longer string.
For example, searches for ARE should not match those letters in instances of the
words AREA or ARENA.

Search up Perform the search from the current cursor position up to the start of the file, rather

(c) Sparx Systems 2018 Page 54 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

than in the default direction of current cursor position to end of file.

Use Regular Expressions Evaluate specific character sequences in the 'Find what' and 'Replace with' fields as
Regular Expressions.

Concepts

Regular Expressions A Regular Expression is a formal definition of a Search Pattern, which can be used
to match specific characters, words or patterns of characters.
For the sake of simplicity, the Code Editor's 'find and replace' mechanism supports
only a subset of the standard Regular Expression grammar.
Text in the 'Find what' and 'Replace with' fields is only interpreted as a Regular
Expression if the 'Use Regular Expressions' checkbox is selected in the 'Find and
Replace' dialog.

Metasequences If the 'Use Regular Expressions' checkbox is selected, most characters in the 'Find
what' field are treated as literals (that is, they match only themselves).
The exceptions are called metasequences; each metasequence recognized in the
Code Editor 'Find and Replace' dialog is described in this table:
· \< - Indicates that the text is the start of a word; for example: \<cat is matched
to catastrophe and cataclysm, but not concatenate
· \> - Indicates that the text is the end of a word; for example: hat\> is matched
to that and chat, but not hate
· (...) - Indicates alternative single characters that can be matched - the characters
can be specific (chr) or in an alphabetical or numerical range (a-m); for
example: (hc) at is matched to hat and cat but not bat, and (a-m) Class is
matched to any name in the range aClass-mClass
· (^...) - Indicates alternative single characters that should be excluded from a
match - the characters can be specific (^chr) or in an alphabetical or numerical
range (^a-m); for example: (^hc) at is matched to rat and bat, but hat and cat
are excluded, and (^a-m) Class is matched to any name in the range nClass to
zClass, but aClass to mClass are excluded
· ^ - Matches the start of a line
· $ - Matches the end of a line
· * - Matches the preceding character (or character set) 0 or more times; for
example: ba*t is matched to bt, bat, baat, baaat and so on, and b(ea) *t is
matched to bt, bet, bat, beat, beet, baat and so on
· + - Matches the preceding character (or character set) 1 or more times; for
example: ba+t is matched to bat, baat and baaat but not bt, and b(ea) +t is
matched to bet, bat, beat, beet and baat but not bt
If a single character metasequence is preceded by a backslash (\) it is treated as a
literal character: c\(at\) matches c(at) as the brackets are treated literally.
When the 'Use Regular Expressions' checkbox is selected, a metasequence helper
menu is available to the right of both of the 'Find what' and 'Replace with' fields;
selecting a metasequence from this menu inserts the metasequence into the field,
replacing or wrapping the currently selected text as appropriate.

Tagged Regions When 'find and replacing' with Regular Expressions, up to nine sections of the
original term can be substituted into the replacement term.

(c) Sparx Systems 2018 Page 55 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The metasequences '\(' and '\)' denote the start and the end of a tagged region; the
section of the matched text that falls within the tagged region can be included in the
replacement text with the metasequence '\n' (where n is the tagged region number
between 1 and 9).
For example:
Find: \((A-Za-z) +\)'s things
Replace with items that belong to \1
Original text: These are all Michael's things.
Replaced text: These are all items that belong to Michael.

(c) Sparx Systems 2018 Page 56 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Search in Files
File Text Searches are provided by the Find in Files window and from within the Code Editors, to search files for data
names and structures. These files can be external code files, code files that you have already opened in Enterprise
Architect, internal model scripts or the Help subsystem.
The 'File Search' tab maintains a history of the file paths you have explored, helping you to quickly return to
frequently-used folders in your file system. You can similarly select a previously-used search string, if you need to repeat
a search several times. When you are searching code files, you can also confine the search to files of specific types, by
selecting the file extensions, and to include just the selected folder or all of its subfolders as well. Another useful facility
is being able to select to show the results of the search as either a list of every instance of the string, or a list of files
containing the string with the instances grouped under the file in which they are found.
For all searches, you can qualify the search to be case-sensitive and/or to match the search string to complete words.

Access

Ribbon Start > Explore > Search > Files

Context Menu Right-click on selected text | Search for <selected text> | Search in Files

Keyboard Shortcuts F12, Ctrl+Shift+Alt+F

Search Toolbar

You can use the toolbar options in the Find in Files window to control the search operation. The state of each button
persists over time to always reflect your previous search criteria.

Options

Option Action

The 'Search Path' field. Specify the folder to search, or the type of search.
You can type the folder path to search directly into the text box, or click on the
drop-down arrow and select 'Browse for folder' to search using the 'Browse for
Folder' dialog.
Any paths you enter are automatically saved in the drop-down list, up to a
maximum of ten; paths added after that overwrite the oldest path in the list. You
can select one of these saved paths if you prefer.
Apart from 'Browse for folder', there are three other fixed options in the drop-down
list:
· 'Search in scripts', which searches the local and user-defined scripts in the
'Scripts' tab of the Scripting window
· 'Search in open files', which confines the search to the files that you have open
in Enterprise Architect

(c) Sparx Systems 2018 Page 57 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· 'Search in local help', which searches the local Help files that have been
installed from the Sparx Systems web site; the results list the Help topics
containing the search term, and the line number and line in which the text
occurs
These options disable the 'Search File Types' list box.

The 'Search Text' field. Type the text string to search for.
Any text you type in is automatically saved in the drop-down list, up to a maximum
of ten strings; text added after that overwrites the oldest text string in the list. You
can click on the drop-down arrow and select one of these saved text strings, if you
prefer.

The 'Search File Types' field. Click on the drop-down arrow and select the file
types (file extensions) to search.

Click on this icon to begin the search.


During the course of the search all other buttons in the toolbar are disabled. You
can cancel the search at any time by clicking on the Search button again.
If you switch any of these toggle buttons, you must run the search again to change
the output.

Click on this icon to toggle the case sensitivity of the search. The tool-tip message
identifies the current setting.

Click on this icon to toggle between searching for any match and searching for only
those matches that form an entire word. The tool-tip message identifies the current
setting.

Click on this icon to toggle between limiting the search to a single path and
including all subfolders under that path. The tool-tip message identifies the current
setting.

Click on this icon to select the presentation format of the search results; you have
two options:
· List View - (as shown) each result line consists of the file path and line
number, followed by the line text; multiple lines from one file are listed as
separate entries

· Tree View - ( ) each result line consists of the file path that matches the
search criteria, and the number of lines matching the search text within that
file; you can expand the entry to show the line number and text of each line

Click on this icon to add a new search tab. You can create up to four new search
tabs. Searches can also run concurrently.

Click on this icon to clear the results.

If necessary, click on this icon to remove all the entries in the Search Path, Search

(c) Sparx Systems 2018 Page 58 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Text and Search File Types drop-down lists.

Click on this icon to display this Help topic.

(c) Sparx Systems 2018 Page 59 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Find File
The Find in Files window 'Find File' tab provides a tool that can help you find files quicker. The tab acts as a file system
explorer and offers a speedy alternative to the common open file dialog. File searches are quick and simple, allowing you
to look up files of interest without losing your current workflow. The display can be switched between report and small
icon view.

Access

Ribbon Start > Explore > Search > Files > Find File

Keyboard Shortcuts Ctrl+Shift+F

Toolbar

The toolbar provides a folder navigation combo box that maintains your file search history, and a file filter control to
limit search results.

Options

Click to navigate to the parent folder.

Enter the path of a directory and press the Enter key to display the files in that
location
Use the drop down list to select from book marked locations. New locations are
automatically book marked whenever a file in that location is opened.

The filter control allows you to exclude files that do not match the criteria you type.
The wildcard symbol * is automatically appended to the text so it is not necessary
to add it yourself. To search for all files that contain the term jvm simply type jvm.
To find png images containing the term red you could type *red*.png. Press the
Enter key to update the results.

In this view the list displays the columns 'filename', 'modified date', 'file type' and
'file size'.
Columns can be sorted in either ascending or descending order. Click the column a
third time to remove the sort order.

The small icon view removes columns and is great when a folder contains many
files.

(c) Sparx Systems 2018 Page 60 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Keyboard Shortcuts

Sets focus to the filter control

Navigates to the parent folder

Navigates to the parent folder

If a folder is selected, opens the folder, otherwise opens the selected files.

(c) Sparx Systems 2018 Page 61 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Search Intelli-sense
The Intelli-sense capabilities of Enterprise Architect are built using Sparx Systems' Code Miner tool. The Code Miner
provides fast and comprehensive access to the information in an existing code base. The system provides complete
access to all aspects of the original source code, either on the fly as one might in a code editor, or as search results
produced by queries written in the Codeminer mFQL language.
This feature is available from Enterprise Architect Release 14.1.

Access

On the Find in Files window, click on the 'Intelli-sense Search' tab at the bottom of the window.

Ribbon Start > Explore > Search > Files > Intelli-sense Search

Keyboard Shortcuts Ctrl+Shift+Alt+F > Intelli-sense Search

The Code Miner Control

This control presents an interface for performing queries on several code bases at once. The code bases it uses are
databases built using Enterprise Architect's Code Miner tool. These databases form a library. The Library can also be
shared when deployed as a service. The queries that can be run are listed and selected using the toolbar. The control
allows easy access to the source code for the queries, for editing and composition. Queries do not need to be compiled.
They are viewed, edited and saved as one would process any source code file. Queries that take a single parameter can
utilize any selection in an open code editor. The interface also supports manual parameter entry for queries that take
multiple arguments.

The first control on the toolbar displays the active Analyzer Script name. To its right is a button that allows the script to
be edited. The Analyzer Script specifies the file containing the mFQL queries.

The next control is a combo box that lists the available queries in the query file.

The next control is an edit combo box. By default a single query parameter is taken from the selected text in an any open
code editor, but you can also type the parameter(s) directly into this field. Multiple parameters should be separated by
commas. This is followed by the Search button to run the query. Queries can be edited at any time using the Edit button
next to it.

The results window is a tree control that lists the results of the query grouped by file.

(c) Sparx Systems 2018 Page 62 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Miner Libraries

Code Miner libraries are a collection of databases that can be used by Enterprise Architect Intelli-sense providers to
obtain and query for information across several code bases. Each database is created from the root source code directory
of a code base, using a specialized grammar appropriate for its language (C++, Java or C#).
The libraries are created, updated, removed or added in the 'Analyzer Script Editor'. A typical scenario for using this
feature would be to create a database for a development project and additional databases for frameworks referenced by
the project. Your development database can be updated frequently as code changes accrue, while the static frameworks
would be updated less often. Libraries can be searched in a similar way to the 'File Search' tool, but offers advanced
search capabilities due to its mFQL language.
· Multiple domains / frameworks can be searched at once
· A query can be run in a fraction of the time required for a File Search
· Queries can be coded to assist with complex search criteria
· Queries can take multiple parameters
· All files are indexed based on equivalent UML constructs, allowing intelligent searches producing meaningful
results in a modeling setting

Code Miner Query Files

Code Miner queries are maintained in a single source code file which should have the .mFQL extension. A basic set of
queries is provided with each Enterprise Architect installation; these can be located in the config\codeminer sub
directory. This query file should be named by default in any Analyzer Script you edit.
Before editing any queries it is advisable that you copy this file to a working location and name the copy in any Analyzer
Script you use. This way you will always have a reference file to go back to.
Queries are best considered as functions that are written in the mFQL language. As such they have unique names, can be
qualified by a single namespace and can specify parameters. The file provides the queries listed in the Intelli-sense
control's toolbar. Whenever edits to a query file are saved, the queries listed in the search toolbar combo box will be
updated accordingly. This image is an example of a simple query written in mFQL.

(c) Sparx Systems 2018 Page 63 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 64 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Editor Key Bindings


Keys

Key Description

Ctrl+G Move cursor to a specified line

↓ Move cursor down one line

Shift+↓ Extend selection down one line

Ctrl+↓ Scroll down one line

Alt+Shift+↓ Extend rectangular selection down one line

↑ Move cursor up one line

Shift+↑ Extend selection up one line

Ctrl+↑ Scroll up one line

Alt+Shift+↑ Extend rectangular selection up one line

Ctrl+( Move cursor up one paragraph

Ctrl+Shift+( Extend selection up one paragraph

Ctrl+) Move cursor down one paragraph

Ctrl+Shift+) Extend selection down one paragraph

← Move cursor left one character

Shift+← Extend selection left one character

Ctrl+← Move cursor left one word

Ctrl+Shift+← Extend selection left one word

Alt+Shift+← Extend rectangular selection left one character

→ Move cursor right one character.

Shift+→ Extend selection right one character

Ctrl+→ Move cursor right one word

Ctrl+Shift+→ Extend selection right one word

(c) Sparx Systems 2018 Page 65 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Alt+Shift+→ Extend rectangular selection right one character

Ctrl+/ Move cursor left one word part

Ctrl+Shift+/ Extend selection left one word part

Ctrl+\ Move cursor right one word part

Ctrl+Shift+\ Extend selection right one word part

Home Move cursor to the start of the current line

Shift+Home Extend selection to the start of the current line

Ctrl+Home Move cursor to the start of the document

Ctrl+Shift+Home Extend selection to the start of the document

Alt+Home Move cursor to the absolute start of the line

Alt+Shift+Home Extend rectangular selection to the start of the line

End Move cursor to the end of the current line

Shift+End Extend selection to the end of the current line

Ctrl+End Move cursor to the end of the document

Ctrl+Shift+End Extend selection to the end of the document

Alt+End Move cursor to the absolute end of the line

Alt+Shift+End Extend rectangular selection to the end of the line

Page Up Move cursor up a page

Shift+Page Up Extend selection up a page

Alt+Shift+Page Up Extend rectangular selection up a page

Page Down Move cursor down a page

Shift+Page Down Extend selection down a page

Alt+Shift+Page Down Extend rectangular selection down a page

Delete Delete character to the right of the cursor

Shift+Delete Cut selection

(c) Sparx Systems 2018 Page 66 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Ctrl+Delete Delete word to the right of the cursor

Ctrl+Shift+Delete Delete until the end of the line

Insert Toggle overtype

Shift+Insert Paste

Ctrl+Insert Copy selection

Backspace Delete character to the left of the cursor

Shift+Backspace Delete character to the left of the cursor

Ctrl+Backspace Delete word to the left of the cursor

Ctrl+Shift+Backspace Delete from the start of the line to the cursor

Alt+Backspace Undo delete

Tab Indent cursor one tab

Ctrl+Shift+I Indent cursor one tab

Shift+Tab Unindent cursor one tab

Ctrl+keypad(+) Zoom in

Ctrl+keypad(-) Zoom out

Ctrl+keypad(/) Restore Zoom

Ctrl+Z Undo

Ctrl+Y Redo

Ctrl+X Cut selection

Ctrl+C Copy selection

Ctrl+V Paste

Ctrl+L Cut line

Ctrl+T Transpose line

Ctrl+Shift+T Copy line

Ctrl+A Select entire document

Ctrl+D Duplicate selection

(c) Sparx Systems 2018 Page 67 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Ctrl+U Convert selection to lowercase

Ctrl+Shift+U Convert selection to uppercase

Ctrl+E Move cursor to matching brace

Ctrl+Shift+E Extend selection to matching brace

Ctrl+Shift+C Toggle line comment on selection

Ctrl+Shift+X Toggle stream comment on selection

Ctrl+F2 Toggle bookmark

F2 Go to next bookmark

Shift+F2 Go to previous bookmark

Ctrl+Shift+F2 Clear all bookmarks in current file

Ctrl+Shift+W Toggle whitespace characters

Ctrl+Shift+L Toggle EOL characters

Ctrl+Spacebar Invoke autocomplete

Ctrl+- Go backwards in cursor history

Ctrl+Shift+- Go forwards in cursor history

F12 Start/Cancel search for keyword in file(s).

Ctrl+F Find text

Ctrl+R Replace text

Notes

· In addition to these keys, you can assign (Ctrl+Alt+<n>) key combinations to macros that you define within the
Source Code Editor

(c) Sparx Systems 2018 Page 68 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Application Patterns (Model + Code)


To get you going with a code based project as fast as possible, Enterprise Architect helps you to generate starter projects
including model information, code and build scripts for one of several basic application types. Patterns include:
· MFC Windows applications
· Java programs
· ASP.NET web services

Access

Ribbon Design > Package > Insert > Insert using Model Wizard > Application Patterns

Context Menu In Project Browser | Right-click on a Package | Add a Model using Wizard >
Application Patterns

Keyboard Shortcuts Ctrl+Shift+M > Application Patterns

Generate Models

(c) Sparx Systems 2018 Page 69 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Option Action

Technology Select the appropriate technology.

Name Displays the Application Patterns available for the selected technology; select the
required Pattern to import.

<description> Displays a description of the selected Pattern.

Destination folder Browse for and select the directory in which to load the source code for the
application.

Use Local Path Enable the selection of an existing local path to place the source code under;
changes the 'Destination folder' field to a drop-down selection.

Compiler command Displays the default compiler command path for the selected technology; you must
either:

(c) Sparx Systems 2018 Page 70 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Confirm that the compiler can be found at this path, or


· Edit the path to the compiler location

Edit Local Paths Many application Patterns specify their compiler using a local path.
The first time you use any Pattern you must click on this button to ensure the local
path points to the correct location.
The 'Local Paths' dialog displays.

Notes

· If required, you can publish custom application Patterns by adding files to the AppPatterns directory where
Enterprise Architect is installed; top level directories are listed as Technologies and can contain an icon file to
customize the icon displayed for the technology
Directories below this are defined as groups in the Patterns list; the Patterns are identified by the presence of four
files with a matching name: a zip file (.zip), XMI file (.xml), config file (.cfg) and optional icon (.ico)
· The config file supports these fields:
- [provider], [language], [platform], [url], [description], [version] - all displayed in the <description>
field
- [xmirootpaths] - the root path of the source code in the exported XMI; this is replaced with the
selected destination folder when the user applies the Application Pattern

(c) Sparx Systems 2018 Page 71 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

MDG Integration and Code Engineering


MDG Integration for Eclipse and MDG Integration for Visual Studio are products that help you to create and maintain
your UML models directly inside these two popular Integrated Development Environments, using the Enterprise
Architect Project Browser. Models can be generated to source code using the powerful and flexible template engine that
gives the engineer complete control over how the code is generated. Existing source code can also be reverse engineered
and synchronized with the UML models. With the integration installed the IDE will become a feature rich modeling
platform, saving time and effort and reducing the risk of error by linking requirements management, architecture and
design to source code engineering.
Rich and expressive documentation can be generated automatically into a wide range of formats including Docx, PDF
and HTML. The documentation can include diagrams of requirements, design and architecture as well as source code
descriptions, putting the source code into context.
You can purchase MDG Integration for Eclipse and MDG Integration for Visual Studio or download trial versions, from
the Sparx Systems web site.

(c) Sparx Systems 2018 Page 72 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Wireframe Models
The Wireframe Toolbox pages provide a wide range of icons that you can use in wireframe modeling to represent the
appearance of a device at a particular point in the execution of an application. Devices you can model include:
· Android Phones and Tablets
· Apple iPhones and Tablets
· Windows 8.1 Phones
· Screen dialogs
· Webpages - to model how the web pages work

Access

On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing', 'Android',
'Apple', 'Dialog', 'Windows Phone' or 'Webpage'.

Ribbon Design > Diagram > Toolbox

Keyboard Shortcuts Alt+5

Notes

· Each of the Wireframing Diagram Toolboxes provides one or more Patterns that you can drag onto a diagram as an
illustration of what you might achieve, or to act as the basis of the model you are developing
· The 'Properties' dialog for Wireframe elements automatically opens to either a top-level 'Wireframe' tab on which
you can edit the element rendering directly, or a second-level 'Wireframing' Tagged Values tab if you define the
element rendering by editing the XML for the properties of that element type
· Some of the elements you create from the 'Wireframe' Toolbox pages are properly rendered after you edit the
Tagged Values that define their characteristics
· As you develop your Interface diagrams you can establish the positions and layout of the elements freehand by
dragging and 'nudging' the elements, or impose some regularity using the 'Snap To Grid' diagram options

(c) Sparx Systems 2018 Page 73 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Android Wireframe Toolbox


The 'Android Wireframing' Diagram Toolbox pages provide the templates for modeling the physical appearance of an
Android tablet or phone at a given state of execution of an application. They also provide Patterns for generating a
standard model structure for each Android appliance.

4:26 PM

Title Book Title Blurb Overview of the story for the user
to read.
Year Year published

Sort order Author Series Year Genre

Author1
Book1
Book2
Book3
Author2
Author3
Book1
Book2

4:26 PM

Stopwatch
Total
00
Lap
00

Start Lap Reset

Lap # Running Total This lap


Lap 1 01:00.0 01:00.0
Lap 2 02:00.0 01:00.0
Lap 3 04:00.0 02:00.0

Access

On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or 'Android'.

Ribbon Design > Diagram > Toolbox

(c) Sparx Systems 2018 Page 74 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Keyboard Shortcuts Alt+5

Android Screen Types

Item Description

Android Phone Generates a frame for the face of the Android Phone you are modeling. A prompt
displays for you to specify portrait or landscape orientation.
Child controls will be contained within the area of the screen.
Tagged Values:
· MenuButtons - click on the drop-down button and select to 'Show' or 'Hide' the
menu button bar at the bottom of the screen
· NotificationBar - click on the drop-down button and select to 'Show' or 'Hide'
the Notification bar at the top of the screen

Android Tablet Generates a frame for the Android Tablet you are modeling. A prompt displays for
you to specify portrait or landscape orientation.
Child controls will be contained within the area of the screen.
Tagged Values:
· MenuButtons - click on the drop-down button and select to 'Show' or 'Hide' the
menu button bar at the bottom of the screen
· NotificationBar - click on the drop-down button and select to 'Show' or 'Hide'
the Notification bar at the top of the screen

Client Area Generates a frame element that represents the client area of the device.
Tagged Values:
· Border Style - click on the drop-down arrow and select to render the border as
a solid line or a dashed line, or to have no border at all (None)
· ScrollbarH - click on the drop-down arrow and select to place a horizontal
scrollbar at the top or bottom of the client area, or to have no horizontal
scrollbar (<none>)
· ScrollbarV - click on the drop-down arrow and select to place a vertical
scrollbar on the left or right of the client area, or to have no vertical scrollbar
(<none>)

Composite

Item Description

Expandable List View Generates an element that represents a two-level grouped list that can be expanded
to show one or both levels of item.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page, which shows the root node (the Expandable List element name), the group
heading items (directly under the element name) and the group items (under the
group headings).

(c) Sparx Systems 2018 Page 75 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· To add a new item click on the level above (the element name or the group
heading names) and on the Add button, and in response to the prompt type in
the name of the item, which adds the name to the bottom of the section of the
list you have created it in
To position the item on the list, click on it in the list and click on the
buttons
· To remove an item from the list, click on it and click on the Remove button;
the item is immediately removed from the list
Click on the Item Name (the first-level list item directly underneath the element
name).
· Name - type in the name for this item group
· Expanded - click on the drop-down arrow and select True to show the
sub-items for this item, or False to hide the sub-items
Click on a sub-item name (the second-level list item) directly under an Item name.
Sub-item nodes do not have any child nodes.
· Name - type the name of the sub-item
· Selected - click on the drop-down arrow and select True to highlight the item
as selected, or False to omit the highlight

Table Generates a Table element with labeled columns, rows and cells.
Double-click on the table to bring up the element 'Properties' dialog at the
'Wireframe' page, which provides the facilities for editing the table (adding,
renaming and deleting columns and rows, changing the column width and editing
the cell text) through context menu options and buttons. Note that the editor does
not provide a true image of the table's appearance on the screen.
· Draw Lines - click on the drop-down arrow and select True to display
horizontal and vertical lines between the table cells, or False to hide the lines
· Highlight Headers - click on the drop-down arrow and select True to highlight
the header of each column, or False to leave the table columns a uniform color

Tab Host Generates a tab control element on the diagram. You can name the tabs and mark
them as selected; however, child elements will not 'switch' when changing tabs (that
is, setting a different tab as selected will still display the same child items in the tab
space).
Tagged Values:
· Tabs - click on the drop-down arrow and click on the tab that is to be
highlighted as selected
You can name the tabs, and add more to the list, by editing the 'Values:' list in
the Tagged Value notes
If you reduce the size of the element so that all tabs cannot be shown, a scroll icon

( ) automatically displays in the top right corner of the element.

Simple List Generates a list box containing a list of items with no sub-items.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page. To:
· Change an item to different text, overtype the 'Item<n>' text in the 'Name' field
· Highlight the item as selected, in the 'Selected' field click on the drop-down
arrow and select True
· Add another item, click on the element name and on the Add button, and type
in the item name
· Remove an item from the list, click on it and click on the Remove button

(c) Sparx Systems 2018 Page 76 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Move an item to a different position in the list, click on it and click on one of
the buttons as appropriate

2 Lane List Generates a list box as for a Simple List, but each item name is in bold and can
have a description underneath the item name.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page.
· To add the description, click on the item name and, in the 'Text' field, type the
description text
Other options are the same as for the Simple List.

Checklist Generates a list box as for a Simple List, but each item name has a tick outline to
the right of it. For selected items, the outline is filled.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page.
· To set a tick to selected (filled) click on the 'Checked' drop-down arrow and
click on True; to change the tick to unselected (outline), set the field to False
Other options are the same as for the Simple List.

Single Choice List Generates a list box as for a Simple List, but each item name has a radio button
outline to the right of it. For a selected item, the outline is filled.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page.
· To set a radio button to selected (filled) click on the 'Selected' field drop-down
arrow and click on True; to change the radio button to unselected (outline), set
the field to False
All items can be set to False (unselected), but if more than one item is set to
True (selected) only the item lowest on the list displays as selected
Other options are the same as for the Simple List.

Form Widgets

Item Description

Switch Generates an element representing a simple Android switch. The switch can have
two states (such as On and Off) and a label taken from the name of the element.
Tagged Values:
· States - click on the drop-down arrow and select the switch position depicted
by the element
You can edit the 'Values:' field in the Tagged Value Notes to change the text of
the state values
You can add more than two values, but you can only toggle the 'States' field
between the first two values in the list; the other values are ignored if selected

Rating Control Generates an element depicting a star-rating band. The element always shows five
stars, and the number of filled stars indicates the rating.
Tagged Values:
· Rating - click on the drop-down arrow and select the number of stars to show

(c) Sparx Systems 2018 Page 77 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

filled (the rating)


You can only re-size the element horizontally; the vertical dimension adjusts
automatically to always depict five uniformly-shaped stars.

Toggle Button Generates an element depicting a single-celled switch with no label (the element
name is not shown).
You can edit the depicted state in the same way as for the 'Switch' element.

Progress Bar (Large) Generates an element representing the circular Android progress icon.

Progress Bar (Horizontal) Generates an element representing the progress of a process, defaulted to 30%
complete.
Tagged Values:
· Progress - type the percentage completion of the progress to depict on the
element

Button Generates a simple labeled Button element, the label text being the name of the
element.

Radio Button Generates a labeled radio button element, the label text being the name of the
element.
Tagged Values:
· State - click on the drop-down arrow and select the state to depict - 'Selected'
(filled) or 'Unselected' (outline)

Checkbox Generates a labeled checkbox element, the label text being the name of the element.
Tagged Values:
· State - click on the drop-down arrow and select the state to depict - 'Checked'
(tick icon) or 'Unchecked' (box outline)

Seek Bar Generates an element representing the progress in playing through an audio or
video file.
Tagged Values:
· Progress - type the percentage progress to depict on the element

Keyboard Generates an element that depicts a keyboard for Android applications.


Tagged Values:
· Type - switches the image between a text (QWERTY) keyboard and a numeric
keyboard

Spinner Generates an element representing the Android version of a drop-down combo box.
Tagged Values:
· Expanded - click on the drop-down arrow and select True to depict the combo
box in use, displaying all values, or False to depict the combo box with a single
selected value
· Values - click on the drop-down arrow and select the value to depict as
currently selected in the combo box
You can change the text of the values, and add more to the list, by editing the
'Values:' list in the Tagged Value notes

(c) Sparx Systems 2018 Page 78 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Text Fields

Item Description

Plain Text Generates a text element with no border, the text being the element name.
Tagged Values:
· Align Text - click on the drop-down arrow and select to align the text to the
left, center or right of the element frame
· Multiline - click on the drop-down arrow and select True to allow the text to
wrap around onto more than one line (automatically increasing the element
depth), or False to only show the text that fits on one line within the current
element width

Multiline Text Generates a text element with no border, but that can contain multi-line text with
basic HTML formatting.
Tagged Values:
· Align Text - click on the drop-down arrow and select to align the text to the
left, center or right of the element frame

· Text - click on the button to edit the Tagged Value Note screen, on which
you can create the text to depict on the diagram; this can use HTML formatting
tags such as <b> </b> for bold or <u> </u> for underlined - not all HTML
formatting is supported

Image_Media

Item Description

Image Generates a place holder to indicate where an image will be placed on the phone or
tablet.
You can display an actual image by assigning an alternative image to the element.

Video Player Generates an element that represents a video player control on the phone or tablet.

Audio Player Generates an element that represents an audio player control on the phone or tablet.

Time_date

Item Description

Calendar Generates an element depicting a calendar (the default image), showing the current
month, day and year based on the system date.
Tagged Values:
· DateFormat - click on the drop-down arrow and select the date format to

(c) Sparx Systems 2018 Page 79 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

display if spinners are shown:


- d/m/y
- m/d/y
- y/m/d (not possible if the calendar is also displayed)
· ShowCalendar - defaults to True to display the calendar; if spinners are also
displayed, the calendar will force the spinner display to show the year at the
right-hand end, and will replace the year spinner
If set to False, the day, month and year spinners display regardless of the
'ShowSpinners' value
· ShowSpinners
- If set to True AND 'ShowCalendar' is True, displays spinner
controls for the day and month (the calendar acts as a year
marker)
- If set to False AND 'ShowCalendar' is True, no spinners are
shown with the calendar
- If 'ShowCalendar' is set to False, the day, month and year
spinners are automatically displayed in the format defined in
'DateFormat', showing the system date
You cannot resize this element.

Date Picker Generates an element that depicts a set of spinners showing today's date, derived
from the system date.
Tagged Values:
· Date - click on the drop-down arrow and select a different date from the
calendar; if the current date is not today, you can reset it to today's date by
clicking on the Today button, or by simply clearing the 'Date' value field
· DateFormat - as for the Calendar element
· ShowCalendar - defaults to False to hide the calendar; otherwise, as for the
Calendar element
· ShowSpinners - as for the Calendar element
You cannot resize this element.

Time Picker Generates an element that depicts a pair of spinners showing the current time, in
hours and minutes, derived from the system clock.
Tagged Values:
· 24 Hour View - click on the drop-down arrow and set to True to show the time
in 24-hour format, or False to display the time in 12-hour format with AM or
PM to the right of the time
· Time - overtype the hours, minutes and AM/PM setting to display a time other
than the system time (you can only set the time in 12-hour format); to revert to
the system time, overtype the field with '12:00 AM'
You cannot resize this element.

Clock Generates an element that represents an analog clock face with hour and minute
hands and no numerals, displaying the system time. You can change the rendition to
a digital display.
Tagged Values:
· 24 Hour View - if you set the 'Type' to 'Digital', click on the drop-down arrow
and select True to display the time in 24-hour format, or False to display the
time in 12-hour format with AM or PM to the right, as appropriate
· Time - overtype the hours, minutes and AM/PM setting to display a time other
than the system time (you can only set the time in 12-hour format); to revert to
the system time, overtype the field with 12:00 AM

(c) Sparx Systems 2018 Page 80 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Type - click on the drop-down arrow and select 'Digital' to display the time as a
digital display, or 'Analog' to display the time as the clock face
You can resize the element in 'Analog' format, but not in 'Digital' format.

Android Patterns

Item Description

Android Phone / Android These Patterns create example models of the two Android product configurations.
Tablet You can use them as your examples of how the elements are designed, as basic
components of a larger model, or as the starting point to develop a more detailed
model of one or more of the products.

(c) Sparx Systems 2018 Page 81 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Apple iPhone/Tablet Wireframe Toolbox


The 'Apple Wireframing' Diagram Toolbox pages provide the templates for modeling the physical appearance of an
Apple iPhone or tablet at a given state of execution of an application. They also provide a number of Patterns for
generating model structures for different versions of the iPhone or iPad.

3G 4:26 PM
T itle

Enabled

Option1

Option2 Radio1-1 Radio2-1

Option3 Radio1-2 Radio2-2

Option4 Next

3G 4:26 PM
File Search
Item

All Media Downloads

Item1
Item2
Item3
Item4

Q W E R T Y U I O P

A S D F G H J K L

Z X C V B N M X

.?123 space return

Access

On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or 'Apple'.

Ribbon Design > Diagram > Toolbox

Keyboard Shortcuts Alt+5

(c) Sparx Systems 2018 Page 82 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Apple Screen Types

Item Description

iPad Air, iPad Mini, iPhone These icons each generate a frame for the device type you have selected. A prompt
4s, iPhone 5c, iPhone 5s, displays for you to specify portrait or landscape orientation. (The main illustration
iPhone 6, iPhone 6 Plus shows a landscape iPhone 5s frame and a portrait iPhone 4s frame.)
Tagged Values:
· ShowStatusBar - click on the drop-down button and select to 'Show' or 'Hide'
the status bar image on the element

Controls

Item Description

Check Box Generates a labeled checkbox element, the label text being the name of the element.
Tagged Values:
· State - click on the drop-down arrow and select the state to depict - 'Checked'
(tick icon) or 'Unchecked' (box outline)

Radio Button Generates a labeled radio button element, the label text being the name of the
element.
Tagged Values:
· State - click on the drop-down arrow and select the state to depict - 'Selected'
(filled) or 'Unselected' (outline)

Combo Box Generates an element representing a drop-down combo box.


Tagged Values:
· DropDownState - click on the drop-down arrow and select 'Open' to depict the
combo box in use, displaying all values, or 'Closed' to depict the combo box
with a single selected value
· Items - click on the drop-down arrow and select the item to depict as currently
selected in the combo box and, if the list of items is expanded, highlighted in
the list
You can change the text of the items, and add or remove items in the list, by
editing the 'Values:' list in the Tagged Value notes

Label Generates a Label text element. The name of the element is the text of the label.
Tagged Values:
· Align Text - sets the alignment of the text to either left, centered or right
· Multiline - sets the label to display text over multiple lines

List Generates a List box element.


Tagged Values:

(c) Sparx Systems 2018 Page 83 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Items - click on the drop-down arrow and select the item to show highlighted in
the list
You can add, remove and rename items by editing the 'Values:' list in the
Tagged Values Notes
· ListType - click on the drop-down arrow and select to display the list as
'Simple', 'Numbered' or 'Bulleted'

Table Generates a Table element with labeled columns, rows and cells.
Double-click on the table to bring up the element 'Properties' dialog at the
'Wireframe' page, which provides the facilities for editing the table (adding,
renaming and deleting columns and rows, changing the column width and editing
the cell text) You can either edit the text by clicking on it, or by right-clicking and
selecting an option. Note that the editor does not provide a true image of the table's
appearance on the screen.
Tagged Values:
· Draw Lines - hides (or shows) the lines on all cells under the column headings
so the table resembles a List element instead
· Highlight Headers - highlights the header of each column so that it is easily
distinguishable
· Properties - displays the HTML of the table

Image Generates a place holder to indicate where an image will be placed on the dialog.
You can display an actual image by assigning an alternative image to the element.

Apple Controls

Item Description

Address Bar Generates a URL Address Bar element.


Tagged Values:
· Address - defines the text displayed in the address bar

App Icon Generates an App Icon element.


Tagged Values:
· Image - specifies the name of an image held in the Image Manager, which is
displayed as the appearance of the App icon (simply type in the name of the
image as listed in the 'Name' column of the Image Manager)
· Notification count - indicates the number of notifications this app has waiting;
the number is displayed in the circle in the top right corner of the element

Button Generates a labeled Button element. The label text is the name of the element.
Tagged Values:
· Button Style - sets the element shape:
- 'Normal' draws a rectangle with rounded edges
- 'Previous' draws a pennant shape pointing to the left
- 'Next' draws a pennant shape pointing to the right
· Text Alignment - defines the alignment of the button text within the element;
left aligned, centered or right aligned

(c) Sparx Systems 2018 Page 84 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Date/Time Picker Generates a Date and Time display element.


Tagged Values:
· Date - sets the date that the element displays; if no date is specified this will be
the current system date
· Expanded - if True, draws the element as a section of calendar with the current
date and/or time selected (as defined by the 'Type' Tagged Value); if False,
draws the element as a simple text string showing the date and/or time
· Time - sets the time displayed on the element; overtype the hour, minute and
AM/PM segments as necessary
If no time is specified it will display the current system time (non-specified
time is displayed as 12:00 AM)
· Type - draws the element showing the Date, the Time or both Date & Time

Group List Generates a grouped list element with two levels of entry.
Double-click on the element to open the 'Properties' dialog at the 'Wireframe' page.
Use this page to compose the list entries.
Click on the root node (the element name).
· Show Groups - click on the drop-down arrow and select True to show the
first-level list items, or False to hide them; the second-level list items display in
either case but must belong to a group item whether it is shown or not
Click on the Group node (the first-level list item) directly underneath the root node.
· Name - type in the text for the first-level list item (the item group name)
Click on an item node (the second-level list item) directly under a Group node. Item
nodes do not have any child nodes.
· Name - type the name of the list item
· Text - type any additional text to be displayed (by default) under the item name
· Text near link - click on the drop-down arrow and select True to display the
additional text opposite the item name, where you can also add a link, or False
to keep the text underneath the item name
· Image - select an image name from the drop-down list or simply type in the
name as listed in the 'Name' column of the Image Manager, to display the
image to the left of the item name
· Is Link - click on the drop-down arrow and select True to indicate that the item
links to another page or additional information by displaying a '>' character to
the right of the item name; select False to hide the link character
· Link Image - select an image name from the drop-down list or simply type in
the name as listed in the 'Name' column of the Image Manager, to display the
image (if 'Is Link' is True) as the link icon instead of the > character
· Selected - click on the drop-down arrow and select True to highlight the item
name as selected, or False to not highlight the item

Keyboard Generates an element that depicts a keyboard.


Tagged Values:
· Type - switches the image between a text (QWERTY) keyboard and a numeric
keyboard

Loading Icon Generates an element that depicts the Apple loading icon.

Page Control Generates an element rendered as a row of gray circles, indicating the number of
pages available and which of those represents the currently-displayed page.
Tagged Values:

(c) Sparx Systems 2018 Page 85 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Current page - draws a white circle in the sequence of gray circles to indicate
which represents the current page displayed
· Pages - the number of circles to draw, indicating the number of pages this
control moves through (resize the element manually to display all the specified
number of circles)

Search Bar Generates an element representing a search field.


Tagged Values:
· DrawStyle - toggles the element's appearance between the default app search
with a query spyglass, and a web search on an Apple device
· Placeholder - type in the text that will be displayed in the control, to prompt the
user to enter the search term
· Prompt - type the prompt text to display above the query field, such as a
reminder of what to search for; for example, if the search is to look up
movies/recorded videos on the device, you might type 'Search for Videos'
('DrawStyle' must be set to default)
· Scope - click on the drop-down arrow and select which search location is
highlighted in the Scope Bar ('DrawStyle' must be set to default and 'Show
Scope Bar' must be set to True)
· Show Bookmarks - when set to True will draw a small book symbol on the
right side of the query field, to indicate that this search control will store
previous searches and can use them again ('DrawStyle' must be set to default)
· Show Cancel Button - displays a Cancel button to the right of the query field
('DrawStyle' must be set to default)
· Show Scope Bar - displays a row of scope options for this search control,
underneath the query field ('DrawStyle' must be set to default)
· Show search results - displays a drop down arrow on the right side of the
search area, to indicate that the query will display the search results (overrides
the Bookmark icon if both are set to display) ('DrawStyle' must be set to
default)
· Text alignment - aligns the Placeholder text to the Left, Right or Center of the
query field

Segment Control Generates an element depicting a set of tabs (defaulted to three tabs).
Tagged Values:
· Tabs - click on the drop-down arrow and select the number of the tab to
highlight to indicate the current tab; open and edit the Tagged Value Notes to
add, remove or rename tabs

Spinner Control Generates an element representing a spinner control with a list of items that can be
selected from.
Tagged Values:
· Check Selected Item - when set to True will draw a tick on the left hand side of
the item defined as selected
· Items - click on the drop-down arrow and select the item to indicate as
selected; you can open and edit the Tagged Value Notes to add, rename or
remove items from the list
· Rounded Edges - click on the drop-down arrow and select the side(s) that show
rounded corners; you can use this property to dock multiple spinner controls
next to each other to create more complex spinner control selections, such as a
page displaying a selection for Country, State, City and Suburb - set:
- Both to set rounded corners on both sides, if the spinner
control is on its own

(c) Sparx Systems 2018 Page 86 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

- Left to set rounded corners on the left edge and sharp corners
on the right edge, if this spinner is the first in a row of docked
spinner controls
- Right to set rounded corners on the right edge and sharp corners
on the left edge, if this spinner is the last in a row of docked
spinner controls, or
- None to set sharp corners on both sides, if this spinner is
docked between two others
· Text alignment - click on the drop-down arrow and select where to align the
item text - to the left, right or center of the control

Stepper Generates an element depicting a decrement/increment (minus/plus) control.

Switch Generates an element representing a sliding on/off switch.


Tagged Values:
· DisplayText - toggles between displaying and hiding the two state text values
· State - toggles between the 'on' state (gray background with white circle on the
right and - if DisplayText is True - the 'on' text) and the 'off' state (white
background with white circle on the left and - if DisplayText is True - the 'off'
text)
The state text values default to On and Off; you can edit the Tagged Value
Notes to change these to any other pair of values (you can add more values but
only the first two are applied)

Text Field Generates a text field in which the end user can type free text, such as the name for
a login page. The field contains the text 'TextField' and a crossed circle.
Tagged Values:
· Border Style - click on the drop-down arrow and select the border style for the
element:
- Rounded Rect - a rectangle with rounded corners
- Bezel - a rectangle with bevelled top and left edges
- Line - a rectangle with sharp corners and single-line edges
- None - a rectangle with no borders
· Text alignment - click on the drop-down arrow and set the text to align to the
left, right or center of the control

Title Generates an element that represents the title for a page, the element name being
the title text (such as 'Settings'). The element is a rectangle with gray background
and white text.

Toolbar Generates an image that represents a Toolbar with default icons, which you can add
to or replace with images from the Image Manager.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page, which lists the icons displayed in the frame of the Toolbar element.
· To add a new icon click on 'Toolbar' and on the Add button, and in response to
the prompt type in the name of the icon, which adds the name to the bottom of
the list; click on the name and in the 'Image' Property field type the name of the
icon file, as displayed in the 'Loaded Image' panel of the Image Manager
You can add a 'Separator' (displayed as |) to the list, to separate different
groups of icons on the toolbar; simply type the name 'Separator' in the name
prompt
To position the icon on the toolbar, click on it in the list and click on the
buttons
· To remove an icon from the list, click on it and click on the Remove button;

(c) Sparx Systems 2018 Page 87 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

the icon is immediately removed from the list and, when you close the dialog,
from the Toolbar

Tab Bar Generates an element that depicts a row of tabs represented by images.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page, which shows the root node (the TabBar element itself) and the items
contained in the TabBar (as images).
· To add a new icon click on 'TabBar' and on the Add button, and in response to
the prompt type in the name of the item, which adds the name to the bottom of
the list
To position the item on the TabBar, click on it in the list and click on the
buttons
· To remove an item from the list, click on it and click on the Remove button;
the item is immediately removed from the list and, when you close the dialog,
from the TabBar
Root node Properties:
· Show Text - displays (True) or hides (False) the item names as text underneath
the tab images
· Background Color - click on the drop-down arrow and select the background
color of the TabBar
· Selected Font Color - click on the drop-down arrow and select the font color of
the text if the item is selected
· Non Selected Font Color - click on the drop-down arrow and select the font
color of the text if the item is not selected
Item node Properties:
· Name - the name of the item, which can be displayed underneath the image in
the TabBar (see Show Text)
· Image - the name of the image file to show if the item is not selected; the file
name is as listed in the Image Manager
· Selected Image - the name of the image file to show if the item is selected; the
file name is as listed in the Image Manager
Select the 'General' page of this Tab Bar element's 'Properties' dialog, and click on
the 'Tags' tab.
Element Tagged Value:
· SelectedTab - Click on the drop-down arrow and select the name of the item to
represent as selected

Apple Patterns

You can use any of these Patterns as examples of how the elements are used, as basic components of a larger model, or
as the starting point to develop a more detailed model of one or more of the products.

Item Description

Apple iPad Air Creates an example model for the Apple iPad Air.

Apple iPad Mini Creates an example model for the Apple iPad Mini.

Apple iPhone 4s Creates an example model for the Apple iPhone 4s.

(c) Sparx Systems 2018 Page 88 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Apple iPhone 5c Creates an example model for the Apple iPhone 5c.

Apple iPhone 5s Creates an example model for the Apple iPhone 5s.

Apple iPhone 6 Creates an example model for the Apple iPhone 6.

Apple iPhone 6 Plus Creates an example model for the Apple iPhone 6 Plus.

(c) Sparx Systems 2018 Page 89 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Windows Phone Wireframe Toolbox


The 'Windows Phone' Diagram Toolbox pages provide the templates for modeling the physical appearance of a Windows
8.1 Phone at a given state of execution of an application.

Business Charting
3rd quarter

Portrait Display Downloaded File

Landscape Display Generated File

Previous Next

᛫᛫᛫

Access

On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or 'Windows
Phone'.

Ribbon Design > Diagram > Toolbox

Keyboard Shortcuts Alt+5

(c) Sparx Systems 2018 Page 90 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Windows Screen Types

Item Description

Windows Phone Generates a frame with a screen area for the Windows 8 Phone device. A prompt
displays in which you specify portrait or landscape orientation.
Elements created within the screen area cannot be resized or moved to sit outside
the borders of the screen. Elements created outside the frame can be dragged onto
and off the frame, and can be as large as the view or element properties permit.

Text

Item Description

Text Block Generates an element that represents dominant text such as headings and labels.
The element name is the displayed text.
Double-click on the element to open the 'Properties' dialog at the 'Wireframe' page.
This displays a default set of six levels of heading styles. Click on a style name to
populate the 'Properties' panel on the right of the dialog, and click on the
down-arrow for each property and select the appropriate settings for the style. If
you prefer, you can also change the name of the style in the 'Name' property.
If necessary, you can add further styles to the list. Click on the style group name
and on the Add button. In the 'Enter name for item' prompt, type a name for the
style and click on the OK button. The new style is added to the end of the list; if
you want to move it further up the list, click on it and on the icon. Again, you
define the style using the 'Properties' panel.
If you want to remove styles from the list, click on the style name and on the
Remove button.
When you have set the styles that can be used for this text, click on the 'General'
page of the Properties dialog and, in the 'Header Type' Tagged Value, click on the
drop-down arrow and select the style to apply to the text of this specific Text Box.

Text Box Generates a simple text field with a border, into which you can type any text you
require. The element name is the displayed text, and does not wrap.

Controls

Item Description

Button Generates a rectangular icon representing a screen button, with the element name as
the button text.
Tagged Values:
· State: click on the drop-down arrow and select the button state to represent:

(c) Sparx Systems 2018 Page 91 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

- Normal - the unselected button


- Focused - the button when the cursor is passed over it
- Selected - the button when it is clicked on
- Disabled - the button grayed out, when it is not available

Checkbox Generates an element representing a labeled checkbox, the element name being the
label.
Tagged Values:
· Enabled: click on the drop-down arrow and select True to show the checkbox
enabled for selection, or False to show the checkbox disabled and unavailable
· State: click on the drop-down arrow and select 'Unchecked' to show the
checkbox empty and unselected, or 'Checked' to show the checkbox selected
with a tick inside it

Hyperlink Button Generates a text element with the element name as the underlined text displayed,
representing a hyperlink on the screen.
Double-click on the element to open the 'Properties' dialog at the 'Wireframe' page,
which lists the three hyperlink states of normal 'Link', 'Visited' and 'Hover'. Click
on a state name to populate the 'Properties' panel on the right of the dialog, and
click on the down-arrow for each property and select the appropriate settings for the
style to apply to that state. If you prefer, you can also change the name of the state
in the 'Name' property.
If necessary, you can add further states to the list. Click on the state group name
and on the Add button. In the 'Enter name for item' prompt, type a name for the
state and click on the OK button. The new state is added to the end of the list; if you
want to move it further up the list, click on it and on the icon. Again, you
define the style using the 'Properties' panel.
If you want to remove states from the list, click on the state name and on the
Remove button.
When you have set the states that the hyperlink can have, click on the 'General'
page of the 'Properties' dialog and, in the 'State' Tagged Value, click on the
drop-down arrow and select the state in which this hyperlink is to be depicted.

Image Generates a rectangular object containing an 'X', to indicate the location of an


image on the screen. There are no properties to set.

Radio Button Generates an element representing a labeled radio button, the element name being
the label.
Tagged Values:
· Enabled: click on the drop-down arrow and select True to show the radio
button enabled for selection, or False to show the radio button disabled and
unavailable
· State: click on the drop-down arrow and select 'Unselected' to show the radio
button empty, or 'Selected' to show the radio button with a filled circle inside it

Tiles

Tile elements add to the phone screen a panel that, depending on type, shows an image and/or some text. The panel
cannot be resized, and if it displays text the text occupies the top half of the element only. The amount of text displayed
is influenced by the tile type, so you will need to experiment with the required type to see how much meaningful text you
can display.

(c) Sparx Systems 2018 Page 92 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Item Description

Collection Tile Adds a tile with a random pattern, to represent a Windows Collection Tile.
Tagged Values:
· Header: type a suitable text string as the tile heading; the text is displayed
when 'Show Back' is set to True and if the 'Tile Type' supports it
· Show Back: click on the drop-down arrow and select True to display the back
of the tile instead of the front; for some tile types the back does not display
regardless of this setting
· Text: a <memo> Tagged Value in which you type the text to display on the
back of the tile; the format and font of the displayed text depends on the 'Tile
Type'
· Tile Type: click on the drop-down arrow and select the type of the collection
tile; this will only affect the display of the back of the tile, the front will always
remain the same (see the Windows Tile Template Type Descriptions web page
for more information on tile types)

Image Tile Adds a tile that initially displays as a box with an 'X' in the center, but is intended to
show an image that you select.
Tagged Values:

· Image: click on the icon and select the image to display for this tile, from
the 'Image Manager' dialog
· Text: type in the text that will be displayed in white at the bottom of the image,
dependent on the 'Tile Type'
· Tile Type: click on the drop-down arrow and select the type of Image tile to
display; this will either be an image only, or an image with text (see the
Windows Tile Template Type Descriptions web page for more information on
tile types)

Peek Tile Adds a tile similar to an Image Tile, except that it can display the back of the tile to
show more information.
Tagged Values:
· Header: type a suitable text string as the tile heading; the text is displayed
when 'Show Back' is set to True and if the 'Tile Type' supports it

· Image: click on the icon and select the image to display on the front of
this tile, from the Image Manager window
· Show Back: click on the drop-down arrow and select True to display the back
of the tile instead of the front
· Text: a <memo> Tagged Value in which you type the text to display on the
back of the tile; the format and font of the displayed text depends on the 'Tile
Type'
· Tile Type: click on the drop-down arrow and select the type of Peek tile to
display (see the Windows Tile Template Type Descriptions web page for more
information on tile types)

Text Tile Adds a tile that displays text only. Depending on tile type, you can show a text
string in the top half of the panel and two text items in the bottom right corner of
the panel.
Tagged Values:
· Block Text: type in a two-part text string to display at the bottom right of the
tile, comprising a longer string that will be displayed in a small font, followed

(c) Sparx Systems 2018 Page 93 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

by a shorter string that will be displayed in a large font, the two strings
separated by a semicolon; the short string will only display two characters in a
square tile, or up to 5 characters in a wide tile, whilst the longer string can
contain many more characters, for example: Messages;16
· Text: type in some additional text to display at the top of the tile (dependent on
tile type) such as a description or definition of the object identified in the lower
text
· Tile Type: click on the drop-down arrow and select the type of Text tile to
display (see the Windows Tile Template Type Descriptions web page for more
information on tile types)

Windows Phone Controls

Item Description

App Bar Generates an element that represents the 'Windows App Bar', which is displayed at
the bottom of the phone screen to supply additional commands. This can include up
to a maximum of five icons and six strings. When you drag the icon onto the
diagram, you are prompted to select the orientation of 'Portrait' or 'Landscape' to
match the screen orientation.
Double-click on the element to display the 'Properties' dialog at the 'Wireframe'
page, displaying the element name at the top as the root node.
Click on the element name and, in the right-hand 'Properties' panel, click on the
drop-down arrow in the value field for the 'Mode' property and select:
· 'Mini' - to represent the App Bar as a thin bar with just the expand menu icon
( ) in the top right, with no other icons or text
· 'Default' - to represent the App Bar as a thin bar unless it contains items, in
which case it will display just the icon in a circle, with no text or icon names
· 'Expanded' - to show the App Bar containing each icon in a circle, the name of
the item under the circle and up to six text strings representing additional menu
options
You might prefer to set the App Bar properties after you have added some icons to
it as child nodes. To add a child node, click on the root node and on the Add button,
and type in the name of the icon or object. In the right-hand panel, set the properties
of the child node:
· 'Name': displays the name of the item, which you can edit if necessary; if the
App Bar is rendered in 'Expanded' mode, the name of a symbol or font item
will be displayed below the icon, whilst for a text item it will be displayed
below and to the left of the icons in a vertical list
· 'Type': click on the drop-down arrow and select from the list of item types; the
type you select will determine what other property prompts are displayed:
- 'SymbolIcon': displays the item as a symbol icon
- 'FontIcon': displays the item as a glyph, using a font
- 'BitmapIcon': draws a selected image as the icon
- 'Text': (applies only in 'Expanded' mode) displays the item
name as a member of a vertical list below and to the left
of the icons; a maximum of six items can be listed at once
- 'Separator': draws a vertical line between icons, which counts
as one of the five available spots for icons on the App Bar;
Separator items do not display names
· 'Symbol': (displays if the 'Type' is set to 'SymbolIcon') click on the drop down

(c) Sparx Systems 2018 Page 94 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

arrow and select the symbol from the list


· 'FontFamily': (displays if the 'Type' is set to 'FontIcon') type in the name of the
font to draw with, such as 'Segoe UI Symbol'
· 'Glyph': (displays if the 'Type' is set to 'FontIcon') type in the Hex value of the
glyph to draw - for example, for the © symbol you can set 'FontFamily' to
'Arial' and type the Hex code '00A9'; font codes in Windows can be found via
'Control Panel | Fonts | Find a Character'
· 'Bitmap': (displays if the 'Type' is set to 'BitmapIcon') click on the drop-down
arrow and select a bitmap (as listed in the Image Manager)

Date Picker Generates an element that depicts three blocks showing today's day and date, month
and year, derived from the system date.
Tagged Values:
· Date - if necessary, click on the drop-down arrow and select a different date
from the calendar; if the displayed date is not today, you can reset it to today's
date by clicking on the Today button
· DateFormat - click on the drop-down arrow and select the date format to
display:
- d/m/y
- m/d/y
- y/m/d

Password Box Generates an element that represents a password field on the screen.
Tagged Values:
· Password: a text string that represents a password
· Password Character: a character that replaces each character of the 'Password'
string when the password is hidden (when either 'Reveal Button' or 'Show Text'
are set to False)
· Reveal Button: if set to True (the default) draws a button that displays the
'Password' text string; if set to False the button is not displayed and the
password string is represented by a string consisting of the 'Password
Character'
· Show Text: when 'Reveal Button' is set to True, setting 'Show Text' to True
will display the 'Password' text string; otherwise a string displays composed of
just the 'Password Character'

Progress Bar Generates an element representing a 'process in progress' status bar, showing a
number of 'dot' stages.

Progress Ring Generates an element depicting the Windows 'processing in progress' circle of dots.

Search Bar Generates an element representing a Windows search field, with the start search
'magnifying glass' icon at the end of it.
Tagged Values:
· Placeholder Text - defaults to the word 'Search'; if necessary, overtype this
with an alternative text string

Slider Generates an element representing a slide control switch, with the slider 50% of the
way across.
Tagged Values:
· Fill amount - overtype the field with a value between 1 and 100, to set the
percentage of the icon shown dark behind the slider

(c) Sparx Systems 2018 Page 95 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Time Picker Generates an element that depicts two blocks showing the time in hours and
minutes, in either 12-hour or 24-hour clock format.
Tagged Values:
· 24 Hour Display - click on the drop-down arrow and select True to display the
time in 24-hour format, or False (the default) to display the time in 12-hour
format
· Time - displays the time in three sections - hours, minutes and AM/PM; click
on and overtype each section with the required value for the time

Toggle Switch Generates an element depicting a slide-over toggle switch with the switch on the
left, representing the 'off' state.
Tagged Values:
· State - click on the drop-down arrow and select 'On' to represent the On state
with the switch on the right of the icon, or 'Off' to move the switch back to the
left of the icon to represent the Off state

(c) Sparx Systems 2018 Page 96 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Dialog Wireframe Toolbox


The 'Dialog Wireframing' Diagram Toolbox pages provide the templates for modeling the physical design, appearance
and operation of a screen dialog. You can see and build on an example of how to model the dialog interface by dragging
the 'Dialog Pattern' icon onto a diagram.

Object position
Position Orientation

X Text Pitch Text

Y Text Yaw Text

Z Text Roll Text

Relative to
World Lo cal

OK Cancel

Access

Ribbon
Design > Diagram > Toolbox : > Specify 'Wireframing - Dialog' in the 'Find
Toolbox Item' dialog

Keyboard Shortcuts
Alt+5 : > Specify 'Wireframing - Dialog' in the 'Find Toolbox Item' dialog

Other You can display or hide the Diagram Toolbox by clicking on the or icons at
the left-hand end of the Caption Bar at the top of the Diagram View.

Screen Types

Item Description

Dialog Generates an element that represents a dialog outline, with a title (the element
name). This has several components that you can expose and define in the element
'Properties' dialog, some using the Tagged Values on the 'Wireframing' tab of the
'General' page, and some using the 'Wireframe' page of the dialog.
Tagged Values:
· Close Button - defaults to True to show a 'close dialog' icon in the top right
corner of the dialog; click on the drop-down arrow and select False to omit the
icon
· Maximize Button - defaults to False to omit a 'maximize dialog' icon from the
top right corner of the dialog; click on the drop-down arrow and select True to
show the icon
· Minimize Button - defaults to False to omit a 'minimize dialog' icon from the

(c) Sparx Systems 2018 Page 97 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

top right corner of the dialog; click on the drop-down arrow and select True to
show the icon
· ScrollbarH - defaults to '<none>' to omit a horizontal scrollbar on the dialog;
click on the drop-down arrow and select 'Bottom' or 'Top' to show a scrollbar in
the corresponding position
· ScrollbarV - defaults to '<none>' to omit a vertical scrollbar on the dialog; click
on the drop-down arrow and select 'Left' or 'Right' to show a scrollbar in the
corresponding position
· StatusBar - define the display of the Status Bar using the 'Wireframe' page
· User Icon - type in the name of an icon exactly as listed in the Image Manager,
to display that icon in the top left corner of the dialog before the dialog
(element) name
Wireframe Page:
Displayed by default when you double-click on the element. Use the options to
modify the Status Bar at the bottom of the dialog.
Click on the element name.
· Zoombar - defaults to True to depict a zoom bar at the right hand end of the
Status Bar; click on the drop-down arrow and select False to omit the zoom bar
· Resize Handle - defaults to True to depict a resize icon (triangle of dots) in the
bottom right corner of the Status Bar; click on the drop-down arrow and select
False to omit the icon
Click on 'Label' - this defines the first segment of the progress bar at the left hand
end of the Status Bar.
· Name - if necessary, overtype the text with another name for the progress bar;
this text is not displayed but the field cannot be blank
· Text - if necessary, overtype the default text with different text to display next
to the progress bar
· Type - defaults to 'Text' to display the string contained in the 'Text' field; if
necessary, click on the drop-down arrow and select:
- Filled Progress Bar - to replace the text with a part-filled
rectangle (to depict a section of Progress Bar with a portion of
processing complete), or
- Block Progress Bar - to replace the text with rectangle containing
blocks (to depict a section of Progress Bar with processing in
action)
Click on 'Progressbar' - this defines a second segment of the progress bar. The
properties are the same as for the first segment except that there is no default 'Text'
and the 'Type' defaults to 'Filled'.
If you want to add another segment to the progress bar, click on the element name,
click on the Add button and provide a name for this segment. Provide values for the
'Text' and 'Type' properties as before.
If you want to remove segments from the progress bar, click on the segment name
and click on the Remove button. If you remove all segments and the 'Zoom Bar' and
'Resize Handle', the status bar itself is removed.
You can change the sequence of segments by clicking on a segment name and on
the buttons.

Client Area Generates a frame element that represents the client area of the device.
Tagged Values:
· BorderStyle - click on the drop-down arrow and select to render the border as a
'Solid' line or a 'Dashed' line, or to have no border at all ('None')
· ScrollbarH - click on the drop-down arrow and select to place a horizontal

(c) Sparx Systems 2018 Page 98 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

scrollbar at the 'Top' or 'Bottom' of the client area, or to have no horizontal


scrollbar ('<none>')
· ScrollbarV - click on the drop-down arrow and select to place a vertical
scrollbar on the 'Left' or 'Right' of the client area, or to have no vertical
scrollbar ('<none>')

Controls

Item Description

Button Generates an element that represents a simple button with the element name as the
button text.
Tagged Values:
· State - click on the drop-down arrow and select a status for the button:
- Normal - simple rectangle, for normal display where the button
is just available
- Focused - a highlighted inner border, indicating, for example,
that the button is the default selection
- Selected - filled rectangle, indicating that the button is
selected
- Disabled - pale text and border, indicating that the button is
not available

Check Box Generates a labeled checkbox element, the label text being the name of the element.
Tagged Values:
· State - click on the drop-down arrow and select the state to depict - 'Checked'
(tick icon) or 'Unchecked' (box outline)

Radio Button Generates a labeled radio button element, the label text being the name of the
element.
Tagged Values:
· State - click on the drop-down arrow and select the state to depict - 'Selected'
(filled) or 'Unselected' (outline)

Combo Box Generates an element representing a drop-down combo box.


Tagged Values:
· DropDownState - click on the drop-down arrow and select 'Open' to depict the
combo box in use, displaying all values, or 'Closed' to depict the combo box
with a single selected value
· Items - click on the drop-down arrow and select the item to depict as currently
selected in the combo box and, if the list of items is expanded, highlighted in
the list
You can change the text of the items, and add or remove items in the list, by
editing the 'Values:' list in the Tagged Value notes

Label Generates a Label text element, on which the label text is the name of the element.
Tagged Values:
· Align Text - click on the drop-down arrow and select to align the text to the
left, center or right of the element frame
· Multiline - click on the drop-down arrow and select True to allow the text to

(c) Sparx Systems 2018 Page 99 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

wrap around onto more than one line (automatically increasing the element
depth), or False to only show the text that fits on one line within the current
element width

List Generates a List box element.


Tagged Values:
· Items - click on the drop-down arrow and select the item to show highlighted in
the list
You can add, remove and rename items by editing the 'Values:' list in the
Tagged Values Notes
· ListType - click on the drop-down arrow and select to display the list as
'Simple', 'Numbered' or 'Bulleted'

Table Generates a Table element with labeled columns, rows and cells.
Double-click on the table to display the element 'Properties' dialog at the
'Wireframe' page, which provides the facilities for editing the table (adding,
renaming and deleting columns and rows, changing the column width and editing
the cell text) through context menu options and buttons. Note that the editor does
not provide a true image of the table's appearance on the screen.
Tagged Values:
· Draw Lines - click on the drop-down arrow and select True to display
horizontal and vertical lines between the table cells, or False to hide the lines
· Highlight Headers - click on the drop-down arrow and select True to highlight
the header of each column, or False to leave the table columns a uniform color

Image Generates a place holder to indicate where an image will be placed on the phone or
tablet.
You can display an actual image by assigning an alternative image to the element.

Dialog Controls

Item Description

Checkbox List Generates an element depicting a checklist where each item has a checkbox on the
left hand side.
Double-click on the table to display the element 'Properties' dialog at the
'Wireframe' page, which you use to maintain this element.
For each 'Checkbox' item, complete these fields:
· Name - type the name or text of the item
· Checked - click on the drop-down arrow and select True to show a ticked
checkbox against the item, or False to show a cleared checkbox
To add another item to the list, click on the element name and on the Add button,
then provide a name for the item.
To remove an item from the list, click on the item and on the Remove button.
You can change the sequence of items by clicking on an item name and on the
buttons.

Format Bar Generates a simple element representing a text formatting bar.

(c) Sparx Systems 2018 Page 100 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

If you want to represent a toolbar containing icons you have defined, use the
'Toolbar' icon.

List View Generates an element representing a horizontal, rectangular or vertical list of text
items (depending on the size of the element) with or without associated images.
Double-click on the table to display the element 'Properties' dialog at the
'Wireframe' page, which you can use to add, remove or change the items and their
icons. For each item, complete these fields:
· Name - type the name or text of the item; this field cannot be left blank
· Image - type the name of the image, or click on the drop-down arrow and select
the name, as listed in the Image Manager
· Selected - click on the drop-down arrow and select True to highlight the name
of the item, or False to omit any highlight; more than one item can be
highlighted at once
To add another item to the list, click on the element name and on the Add button,
then provide a name for the item.
To remove an item from the list, click on the item and on the Remove button.
You can change the sequence of items by clicking on an item name and on the
buttons.
If you reduce the size of the element so that not all items can be shown, a scroll bar
automatically displays on the right edge of the element:

Status Bar Generates a status bar element identical to the automatically-generated status bar on
the 'Dialog' element, except that you can position this element independently of the
dialog, as required.

Toolbar Generates an element to represent a toolbar of icons, already set up with some
standard toolbar icons.
Double-click on the element to display the 'Wireframe' page of the 'Properties'
dialog, which you can use to add, remove or change the items and their icons. For
each item, complete these fields:
· Name - type the name or text of the item; this field cannot be left blank
· Image - type the name of the icon image, or click on the drop-down arrow and
select the name, as listed in the Image Manager
To add another item to the list, click on the element name and on the Add button,
then provide a name for the item. You can add one or more items called 'Separator'
to the list, which display as a |, to partition groups of related icons in the toolbar. If
you add an image to this item, the image is overridden by the |.
To remove an item from the list, click on the item and on the Remove button.
You can change the sequence of items by clicking on an item name and on the
buttons.

Audio Player Generates a simple element to indicate an audio player control.

Calendar Generates an element representing a basic calendar, showing today's date derived
from the system date.
Tagged Values:
· Date - either:

(c) Sparx Systems 2018 Page 101 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

- Overtype the date displayed in this field or


- Click on the drop-down arrow to display an active calendar
page and select the date on that; click on the Today button
to reset the date to the system date
· Highlight Date - click on the drop-down arrow and select True to highlight the
set date on the calendar icon, or False to omit the highlight

Header Generates an element representing a title or header text on a dialog. The text itself
is the element name.
The element can reflect one of a range of header levels, each with a different font
style. You specify which level of header to display using the 'HeaderType' Tagged
Value within the element.
Double-click on the element to display the 'Wireframe' page of the 'Properties'
dialog, which you can use to add, remove or change the header levels and styles.
For each item, complete these fields:
· Name - type the name of the header level; this field cannot be left blank
· Color - click on the drop-down arrow and select the appropriate color from the
palette
· Font Size - type in the font size, or click on the drop-down arrow and select the
type size from the list
· Font Family - click on the drop-down arrow and select the font type from the
list
· Font Style - click on the drop-down arrow and select the style from the list;
select blank for no applied style
· Text Align - click on the drop-down arrow and select to align the text left, right
or centered
· Text Decoration - click on the drop-down arrow and select whether to show an
underline or a line-through, or neither (blank)
To add another heading level to the list, click on the element name and on the Add
button, then provide a name for the level.
To remove a level from the list, click on the item and on the Remove button.
You can change the sequence of heading levels by clicking on a level name and on
the buttons.
Tagged Values:
· HeaderType - click on the drop-down arrow and select the heading level to
display

Hyperlink Generates an element representing a hyperlink in one of three states: 'Link', 'Visited'
and 'Hover' (mouse-over). The Hyperlink text is the element name.
Double-click on the element to display the 'Wireframe' page of the 'Properties'
dialog, which you can use to add, remove or change the hyperlink states. For each
state, complete these fields:
· Name - type the name of the state; this field cannot be left blank
· Color - click on the drop-down arrow and select the appropriate color from the
palette
· Font Size - type in the font size, or click on the drop-down arrow and select the
type size from the list
· Font Family - click on the drop-down arrow and select the font type from the
list
· Font Style - click on the drop-down arrow and select the style from the list;
select blank for no applied style

(c) Sparx Systems 2018 Page 102 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Text Align - click on the drop-down arrow and select to align the text left, right
or centered
· Text Decoration - click on the drop-down arrow and select whether to show an
underline or a line-through, or neither (blank)
To add another hyperlink state to the list, click on the element name and on the Add
button, then provide a name for the state.
To remove a state from the list, click on the item and on the Remove button.
You can change the sequence of states by clicking on a state name and on the
buttons.
Tagged Values:
· State - click on the drop-down arrow and select the state to represent on the
diagram

Menu Bar Generates an element representing a standard menu bar at the top of the screen,
initially with three options ('File', 'Edit' and 'View') with the 'File' option expanded
into a sub-menu.
Double-click on the element to display the 'Wireframe' page of the 'Properties'
dialog, which you can use to add, remove or change the menu options in the top
level, sub-menu and - if you prefer - further sub levels.
For each menu option - at any level - complete these fields:
· 'Name' - type in the name for this menu item
· 'Expanded' - click on the drop-down arrow and select True to show the
sub-menu for this option (if it has one), or False to hide the sub-menu
· 'Highlighted' - click on the drop-down arrow and select True to highlight this
option in the menu, or False to leave it un-highlighted; if 'Expanded' is set to
True, the option is automatically highlighted
To add a menu sub-option at any level, click on the parent option name and on the
Add button, then provide a name for the sub-option. You can add one or more items
called 'Separator' to the list, which displays as a horizontal line across the list, to
partition groups of related options in the menu.
To remove an option from the list, click on the item and on the Remove button.
You can change the sequence of options by clicking on an option name and on the
buttons.
To move an option between two levels of menu, click on the option name and on

the buttons.

Paragraph Generates a text element with no border, but that can contain multi-line text with
basic HTML formatting.
Tagged Values:
· Align Text - click on the drop-down arrow and select to align the text to the
left, center or right of the element frame

· Text - click on the button to edit the 'Tagged Value Note' screen, on which
you can create the text to depict on the diagram; this can use HTML formatting
tags such as <b> </b> for bold or <u> </u> for underlined - not all HTML
formatting is supported

Progress Bar Generates a status bar element representing the progress of a process.
Tagged Values:
· Fill Percentage - defaults to 30% complete; type the percentage completion to

(c) Sparx Systems 2018 Page 103 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

depict (the amount the Progress Bar is filled)


· Fill Style - click on the drop-down arrow and select:
- 'Filled' to represent the percentage completion as a
solid bar, or
- 'Block' to represent the percentage completion as a
series of blocks or vertical bars (similar to the Windows XP
theme)

Rating Control Generates an element depicting a star-rating band. The element always shows five
stars, and the number of filled stars indicates the rating.
Tagged Values:
· Rating - click on the drop-down arrow and select the number of stars to show
filled (the rating)
You can only re-size the element horizontally; the vertical dimension adjusts
automatically to always depict five uniformly-shaped stars.

Scrollbar - Horizontal Generates an element representing a horizontal scrollbar.

Scrollbar - Vertical Generates an element representing a horizontal scrollbar.

Tab Control Generates an element representing a series of tabs or pages. You can name the tabs
and mark them as selected; however, child elements will not 'switch' when
changing tabs (that is, setting a different tab as selected will still display the same
child items in the tab space).
Tagged Values:
· Tabs - click on the drop-down arrow and click on the tab that is to be
highlighted as selected
You can name the tabs, and add more to the list, by editing the 'Values:' list in
the Tagged Value notes
If you reduce the size of the element so that all tabs cannot be shown, a scroll icon

( ) automatically displays in the top right corner of the element.

Text Field Generates a text element with a pale border, the text being the element name,
representing a simple data entry field.

Video Player Generates an element that represents a video player control.

Date/Time Picker Generates an element that represents the Microsoft Date/Time Picker.
Tagged Values:
· CustomFormat - type in a custom format for any or all of the day, date, month,
year, hour, minute and second components, using these case-sensitive codes
(listed in alphabetical order):
- d - display the day of the month using either one or two digits
- dd - display the day of the month using two digits, digits 1 to 9
preceded by a 0
- ddd - display the day of the week as a three-character
abbreviation
- dddd - display the name of the day in full
- h - display the hour using either one or two digits, in 12 hour
clock format
- hh - display the hour using two digits, digits 1 to 9 preceded by
a 0, in 12 hour clock format
- H - display the hour using either one or two digits, in 24 hour
clock format

(c) Sparx Systems 2018 Page 104 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

- HH - display the hour using two digits, digits 1 to 9 preceded by


a 0, in 24 hour clock format
- m - display the minutes using either one or two digits
- mm - display the minutes using two digits, digits 1 to 9
preceded by a 0
- M - display the number of the month using either one or
two digits
- MM - display the number of the month using two digits, digits
1 to 9 preceded by a 0
- MMM - display the name of the month as a three-character
abbreviation
- MMMM -display the name of the month in full
- s - display the seconds using either one or two digits
- ss - display the seconds using two digits, digits 1 to 9
preceded by a 0
- t - identify morning or afternoon with a single character (A for
AM, P for PM)
- tt - identify morning or afternoon with the two-character
abbreviation AM or PM
- y - display the year using a single digit (2001 is displayed as 1)
- yy - display the year using two digits (2001 is displayed as 01)
- yyyy - display the year in full (for example, 2001)
· Date - overtype the date, or click on the drop-down arrow to display a calendar
from which you can select the date to display; defaults to today's date - if you
change this to a fixed date and want to return to the current (system) date, click
on the Today button
· Format - click on the drop-down arrow and select the code for the format to use
to display the date and time:
- Long - the full day name, the day date, the full month name,
the full year (for example: Wednesday, 18 February 2019)
- Short - the day of the month in single/double digits, the
month as a two-digit number, the year in full (for example:
18/02/2019)
- Time - the hour, minutes and seconds in 12-hour format (for
example 12:59:34 PM)
- Custom - applies the custom format you defined in the
'CustomFormat' Tagged Value

Tree Control Generates an element representing a hierarchy or tree of nodes, with broken lines
connecting sibling nodes and an expansion box (+ or -) next to nodes that have
subnodes.
Double-click on the element to display the element 'Properties' dialog at the
'Wireframe' page, which you can use to add, remove or change the tree nodes in the
top level, sub-level and - if you prefer - further sub levels.
For each node - at any level - complete these fields:
· Name - type in the name for this node
· Expanded - click on the drop-down arrow and select True to show the
subordinate nodes for this node (if it has any), or False to hide the subordinate
nodes
· Selected - click on the drop-down arrow and select True to highlight this node,
or False to leave it un-highlighted
To add a sub-node at any level, click on the parent node name and on the Add
button, then provide a name for the sub-node.
To remove a node from the hierarchy, click on the node name and on the Remove
button.
You can change the sequence of nodes by clicking on a node name and on the

(c) Sparx Systems 2018 Page 105 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

buttons.
To move a node between two levels of the hierarchy, click on the node name and on

the buttons.
You can also directly edit the XML of the element on the 'Wireframe' tab of the
Element Properties window.

Groupbox Generates an element representing a Groupbox, with the name of the element in the
top left corner. You can use this element to enclose and group other elements of the
dialog.

Patterns

Item Description

Dialog This Pattern generates a small dialog containing three panels with data entry fields
and radio buttons, and two buttons, as depicted at the start of this topic. You can
use this as an example, or as the basis for a similar dialog design.

(c) Sparx Systems 2018 Page 106 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Webpage Wireframe Toolbox


The 'Webpage Wireframe' Diagram Toolbox pages provide the templates for modeling the schematics, blueprints or
framework of a website, defining how the web pages work. You can see and build on an example of how to model the
webpage interface by dragging the Webpage Pattern icon onto a diagram.

Item name Tab2


w w w .shop.com

Similar Items

Item Name Item Name


Text Text Text Text Text Text Text Text Text Some information
Text Text Text Text Text Text Text Text Text about item for the
Text Text Text Text Text Text Text Text Text user.
Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Item Name
$$$$$$$ Add to cart Some information
about item for the
user.
Reviews
Item Name
User Name User Name User Name
Users text Users text Users text Some information
review placed review placed review placed about item for the
here here here user.

User Name User Name User Name


Item Name
Users text Users text Users text
review placed review placed review placed Some information
here here here about item for the
user.
1 2 3 4 5 6 ... 20

Access

On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or
'Webpage'.

Ribbon Design > Diagram > Toolbox

Keyboard Shortcuts Alt+5

Webpage Toolbox pages

Image Detail

Combobox, List, Progress/Navigation bar and Tab Control all provide lists of
values, which you can extend by opening the 'Tagged Value Note' field of the
appropriate Wireframing Tagged Value and adding, editing or removing items from
the 'Values' list.
In the Paragraph element you can set text alignment in the 'Align Text' Tagged

(c) Sparx Systems 2018 Page 107 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Value, and edit the text itself in the 'Value' field of the 'Text' Tagged Value (which
is of type <memo>). You can also do basic HTML text formatting, as for other
formatted notes in elements.
The Calendar element, when created, defaults to the current day and continues to
update each day unless you set a value in the element's Date Tagged Value. If set,
the date remains static until it is reset to 'Today' in the Tagged Value.
Navigation Control defines a menu with, if required, multiple levels of sub-menu
options. You can add and remove options at any level using the 'Wireframe' tab of
the 'Properties' dialog. Each option, at any level, has these properties:
· 'Name': Set the text of the menu option
· 'Expanded': Indicate if the option will display its sub options (if any); expanded
items are always highlighted, regardless of the setting of 'Highlighted'
· 'Highlighted': Draw the item with a different colored background
Hyperlink and Header elements are both also defined on the 'Wireframe' tab, and
have a number of style properties that you set using simple drop-down lists:
· Color
· Font Size
· Font Family
· Font Style
· Text Align
· Text Decoration

(c) Sparx Systems 2018 Page 108 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Behavioral Models

Enterprise Architect’s powerful system engineering capability can be used to generate code for software, system and
hardware description languages directly from behavioral models, such as StateMachine, Sequence and Activity diagrams.
The supported languages include C(OO), C++, C#, Java, VB.Net, VHDL, Verilog and SystemC.
Software code can be generated from StateMachine, Sequence and Activity diagrams, and hardware description
languages from StateMachine diagrams.

Generate code from behavioral diagrams using the EAExample project

Step Action

1 Open the EAExample.eap file by selecting the 'Start > Help > Help > Open the Example Model' ribbon
option.

2 From the Project Browser, select any of these Packages:


Software Language Examples:
· Example Model > Software Engineering > Java Model With Behaviors
Generate the Account and Order classes
· Example Model > Systems Engineering > Implementation Model > Software > C#
Generate the DataProcessor Class
· Example Model > Systems Engineering > SysML Example > Implementation Model > Software >
C++
Generate the IO Class
· Example Model > Systems Engineering > SysML Example > Implementation Model > Software >
Java
Generate the IO Class
· Example Model > Systems Engineering > SysML Example > Implementation Model > Software >
VBNet
Generate the IO Class
Hardware Language Examples:
· Example Model > Systems Engineering > SysML Example: Portable Audio Player > Implementation
Model > Hardware > SystemC
Generate the PlayBack Class
· Example Model > Systems Engineering > SysML Example: Portable Audio Player > Implementation
Model > Hardware > VHDL
Generate the PlayBack Class
· Example Model > Systems Engineering > SysML Example: Portable Audio Player > Implementation
Model > Hardware > Verilog
Generate the PlayBack Class

(c) Sparx Systems 2018 Page 109 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

3 When completed, press Ctrl+E to open the generated source code.


You should see methods generated in the code.

Notes

· Software code generation from behavioral models is available in the Unified and Ultimate editions of Enterprise
Architect
· Hardware code generation from StateMachine models is available in the Unified and Ultimate editions of Enterprise
Architect
· For C(OO), on the 'C Specifications' page of the 'Preferences' dialog set the 'Object Oriented Support' option to True
· To be able to generate code from behavioral models, all behavioral constructs should be contained within a Class; if
the behavioral constructs refer to external elements outside the current Package, you must add an Import connector
from the current Package to the Package containing the external elements
· Code synchronization is not supported for behavioral code

(c) Sparx Systems 2018 Page 110 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Generation - StateMachines


A StateMachine illustrates how an object (represented by a Class) can change state, each change of state being a
transition initiated by a trigger arising from an event, often under conditions or constraints defined as guards. As you
model how the object changes state, you can generate and build (compile) code from it in the appropriate language and
execute the code, visualizing the execution via the Model Simulator.
It is also possible, in Enterprise Architect, to combine the StateMachines of separate but related objects to see how they
interact (via Broadcast Events), and to quickly create and generate code from variants of the model. For example, you
might model the behavior of:
· The rear off-side wheel of a vehicle in rear-wheel drive and front-wheel drive modes (one StateMachine)
· The steering wheel and all four drive wheels of a vehicle in 4-wheel drive mode (five StateMachines)
· The wheels of an off-road vehicle and of a sports car (two Artifacts, instances of a combination of StateMachines)
Of critical importance in generating and testing code for all of these options is the Executable StateMachine Artifact
element. This acts as the container and code generation unit for your StateMachine models.

Prerequisites

· Select 'Start > View > Preferences > Objects' and select the 'Port and Part type visible by default' checkbox
· Select 'Configure > Model > Options > Source Code Engineering' and, for the appropriate coding language (Java, C,
C# or ANSI C++), set the 'Use the new StateMachine Template' option to 'True'
· If working in C++, select 'Configure > Model > Options > Source Code Engineering > C++' and set the 'C++
Version' option to 'ANSI'
This code generation method does not apply to the Legacy StateMachine code generation templates developed prior to
Enterprise Architect Release 11.0.

Access

Drag an 'Executable StateMachine Artifact' from the 'Artifacts' page of the Diagram Toolbox, onto your diagram. The
'Artifacts' page of the Diagram Toolbox can be accessed using any of the methods outlined in this table.

Ribbon Design > Diagram > Toolbox > Artifacts

Keyboard Shortcuts Alt+5 > Artifacts

Other You can display or hide the Diagram Toolbox by clicking on the or icons at
the left-hand end of the Caption Bar at the top of the Diagram View.

Prepare your StateMachine diagram(s)

Step Action

1 For each StateMachine you want to model, create a Class diagram.

2 From the 'Class Elements' page of the Diagram Toolbox, drag the 'Class' icon onto your diagram and give

(c) Sparx Systems 2018 Page 111 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

the element an appropriate name.

3 Right-click on the Class element and select the 'New Child Diagram | StateMachine' context menu option.
Give the StateMachine diagram an appropriate name.

4 Create the StateMachine model to reflect the appropriate transitions between States.

Set up the Executable StateMachine Artifact

Step Action

1 Create a new Class diagram to contain the modeled StateMachine(s) from which you intend to generate
code.

2 From the 'Artifacts' page of the Diagram Toolbox, drag the 'Executable StateMachine' icon onto the
diagram to create the Artifact element. Name the element and drag its borders out to enlarge it.

3 From the Project Browser, drag the (first) Class element containing a StateMachine diagram onto the
Artifact element on the diagram.
The '<element name>: Paste As' dialog displays, with the 'Paste as' field defaulted to 'Property'.
(If the dialog does not display, press Ctrl as you drag the Class element from the Project Browser.)

4 Click on the OK button. The Class element is pasted inside the Artifact as a Part.

5 Repeat steps 3 and 4 for any other Classes with StateMachines that you want to combine and generate
code for. These might be:
· Repeat 'drops' of the same Class and StateMachine, modeling parallel objects
· Different Classes and StateMachines, modeling separate interacting objects

6 Right-click on the Artifact element and select the 'Properties' option, and in the 'Language' field click on
the drop-down arrow and set the code language to the same language as is defined for the Class elements.
You can now drag this Executable StateMachine Artifact element from the Project Browser onto the
diagram any number of times, and modify the Parts to model variations of the system or process, or the
same system or process with different programming languages.

Generate Code From Artifact

Step Action

1 Right-click on the Executable StateMachine Artifact element and select the 'Simulate > Executable >
StateMachines > Generate' ribbon option.
The 'Executable StateMachine Code Generation' dialog displays.

2 In the 'Project output directory' field, type or browse for the directory path under which to create the
output files.

(c) Sparx Systems 2018 Page 112 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

During code generation, all existing files in this directory are deleted.

3 Select the Target System. If you are running on WIndows select the 'Local' option. If you are working on
Linux choose the 'Remote' option. The choice affects the scripts generated to support the Simulation.

4 In the 'Location of <compiler> installation directory' field, type or browse for the path of the compiler
installation directory, to be automatically mapped to the local path (displayed to the left of the field). For
each programming language, the paths might resemble these examples:
· Java
JAVA_HOME C:\Program Files (x86)\Java\jdk1.7.0_17
· C/C++
VC_HOME C:\Program Files (x86)\Microsoft Visual Studio 9.0
· C#
CS_HOME C:\Windows\Microsoft.NET\Framework\V3.5

5 Click on the Generate button. The code files are created appropriate to the programming language.
The System Output window displays with an 'Executable StateMachine Output' tab, showing the progress
and status of the generation.
During code generation, an automatic validation function is executed to check for diagram or model errors
against the UML constraints. Any errors are identified by error messages on the 'Executable StateMachine
Output' tab.
Double-click on an error message to display the modeling structure in which the error occurs, and correct
the mistake before re-generating the code.

6 When the code generates without error, click on the Artifact element and select the 'Simulate > Executable
> StateMachines > Build' ribbon option to compile the code.
The System Output window displays with a 'Build' tab, showing the progress and status of the
compilation. Notice that the compilation includes configuration of the simulation operation.

Code Generation Macros

You can also use two macros in the code generation for StateMachines.

Macro Name Description

SEND_EVENT Send an event to a receiver (the Part). For example:


%SEND_EVENT("event1", "Part1")%

BROADCAST_EVENT Broadcast an event to all receivers. For example:


%BROADCAST_EVENT("event2")%

Execute/Simulate Code From Artifact

Step Action

1 Select the ribbon option 'Simulate > Dynamic Simulation > Simulator > Apply Simulator Layout' to
display the Simulation window and the Simulation Events window together

(c) Sparx Systems 2018 Page 113 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Dock the two windows in a convenient area of the screen.

2 On the diagram or Project Browser, click on the Artifact element and select the 'Simulate > Executable >
StateMachines > Run' ribbon option.
The first StateMachine diagram in the series displays with the simulation of the process already started. In
the Simulation window, the processing steps are indicated in this format:

[03516677] Part1[Class1].Initial_367_TO_State4_142 Effect


[03516683] Part1[Class1].StateMachine_State4 ENTRY
[03516684] Part1[Class1].StateMachine_State4 DO
[03518375] Blocked

3 Click on the appropriate Simulation window toolbar buttons to step through the simulation as you prefer.
When the simulation finishes at the Exit or Terminate element, click on the Stop button in the Simulation
window toolbar.

4 Where the trace shows Blocked, the simulation has reached a point where a Trigger event has to occur
before processing can continue. On the Simulation Events window, in the 'Waiting Triggers' column,
double-click on the appropriate Trigger.
When the Trigger is fired, the simulation continues to the next pause point, Trigger or exit.

Notes

· If you are making small changes to an existing StateMachine model, you can combine the code generation, build and
run operations by selecting the 'Simulate > Executable > StateMachines > Generate, build and run' ribbon option
· You can also generate code in JavaScript

(c) Sparx Systems 2018 Page 114 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Legacy StateMachine Templates


Code generation operates using a set of generation templates. From Release 11.0 of Enterprise Architect, a different set
of templates are available as the default for software code generation from a StateMachine diagram into Java, C, ANSI
C++ or C# code. You can still use the original templates, as described here, for models developed in earlier releases of
Enterprise Architect, if you do not want to upgrade them for the new template facilities.

Switch Between Legacy and Release 11 templates

Access

Display the 'Manage Project Options' dialog, then show the 'Language Specifications' page for your chosen language,
using one of the methods outlined in this table. If necessary, expand the 'StateMachine Engineering (for current model)'
grouping and set the 'Use the new StateMachine Template' option to True (to use the later templates) or False (to use the
Legacy templates).

Ribbon Configure > Model > Options > Source Code Engineering > [language name]

Legacy Template Transformations

A StateMachine in a Class internally generates a number of constructs in software languages to provide effective
execution of the States' behaviors (do, entry and exit) and also to code the appropriate transition's effect when necessary.

Model Objects Code Objects

Enumerations · StateType - consists of an enumeration for each of the States contained within
the StateMachine
· TransitionType – consists of an enumeration for each transition that has a valid
effect associated with it; for example,
ProcessOrder_Delivered_to_ProcessOrder_Closed
· CommandType – consists of an enumeration for each of the behavior types that
a State can contain (Do, Entry, Exit)

Attributes · currState:StateType - a variable to hold the current State's information


· nextState:StateType - a variable to hold the next State's information, set by
each State's transitions accordingly
· currTransition:TransitionType - a variable to hold the current transition
information; this is set if the transition has a valid effect associated with it
· transcend:Boolean - a flag used to advise if a transition is involved in
transcending between different StateMachines (or Submachine states)
· xx_history:StateType - a history variable for each StateMachine/Submachine
State, to hold information about the last State from which the transition took
place

Operations · StatesProc - a States procedure, containing a map between a State's


enumeration and its operation; it de-references the current State's information

(c) Sparx Systems 2018 Page 115 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

to invoke the respective State's function


· TransitionsProc - a Transitions procedure, containing a map between the
Transition's enumeration and its effect; it invokes the Transition's effect
· <<State>> - an operation for each of the States contained within the
StateMachine; this renders a State's behaviors based on the input
CommandType, and also executes its transitions
· initializeStateMachine - a function that initializes all the framework-related
attributes
· runStateMachine - a function that iterates through each State, and executes
their behaviors and transitions accordingly

Notes

· To be able to generate code from behavioral models, all behavioral constructs should be contained within a Class

(c) Sparx Systems 2018 Page 116 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Java Code Generated From Legacy StateMachine Template

private enum StateType: int


{
ProcessOrder_Delivered,
ProcessOrder_Packed,
ProcessOrder_Closed,
ProcessOrder_Dispatched,
ProcessOrder_New,
ST_NOSTATE
}
private enum TransitionType: int
{
ProcessOrder_Delivered_to_ProcessOrder_Closed,
TT_NOTRANSITION
}
private enum CommandType
{
Do,
Entry,
Exit
}
private StateType currState;
private StateType nextState;
private TransitionType currTransition;
private boolean transcend;
private StateType ProcessOrder_history;
private void processOrder_Delivered(CommandType command)

(c) Sparx Systems 2018 Page 117 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

{
switch(command)
{
case Do:
{
// Do Behaviors..
setStatus(Delivered);
// State's Transitions
if((status==Delivered))
{
nextState = StateType.ProcessOrder_Closed;
currTransition = TransitionType.ProcessOrder_Delivered_to_ProcessOrder_Closed;
}
break;
}
default:
{
break;
}
}
}
private void processOrder_Packed(CommandType command)
{
switch(command)
{
case Do:
{
// Do Behaviors..
setStatus(Packed);
// State's Transitions
nextState = StateType.ProcessOrder_Dispatched;
break;
}
default:
{
break;
}
}
}
private void processOrder_Closed(CommandType command)
{
switch(command)

(c) Sparx Systems 2018 Page 118 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

{
case Do:
{
// Do Behaviors..
// State's Transitions
break;
}
default:
{
break;
}
}
}
private void processOrder_Dispatched(CommandType command)
{
switch(command)
{
case Do:
{
// Do Behaviors..
setStatus(Dispatched);
// State's Transitions
nextState = StateType.ProcessOrder_Delivered;
break;
}
default:
{
break;
}
}
}
private void processOrder_New(CommandType command)
{
switch(command)
{
case Do:
{
// Do Behaviors..
setStatus(new);
// State's Transitions
nextState = StateType.ProcessOrder_Packed;
break;

(c) Sparx Systems 2018 Page 119 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

}
default:
{
break;
}
}
}
private void StatesProc(StateType currState, CommandType command)
{
switch(currState)
{
case ProcessOrder_Delivered:
{
processOrder_Delivered(command);
break;
}
case ProcessOrder_Packed:
{
processOrder_Packed(command);
break;
}
case ProcessOrder_Closed:
{
processOrder_Closed(command);
break;
}
case ProcessOrder_Dispatched:
{
processOrder_Dispatched(command);
break;
}
case ProcessOrder_New:
{
processOrder_New(command);
break;
}
default:
break;
}
}
private void TransitionsProc(TransitionType transition)
{

(c) Sparx Systems 2018 Page 120 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

switch(transition)
{
case ProcessOrder_Delivered_to_ProcessOrder_Closed:
{
setStatus(closed);
break;
}
default:
break;
}
}
private void initalizeStateMachine()
{
currState = StateType.ProcessOrder_New;
nextState = StateType.ST_NOSTATE;
currTransition = TransitionType.TT_NOTRANSITION;
}
private void runStateMachine()
{
while (true)
{
if (currState == StateType.ST_NOSTATE)
{
break;
}
currTransition = TransitionType.TT_NOTRANSITION;
StatesProc(currState, CommandType.Do);
// then check if there is any valid transition assigned after the do behavior
if (nextState == StateType.ST_NOSTATE)
{
break;
}
if (currTransition != TransitionType.TT_NOTRANSITION)
{
TransitionsProc(currTransition);
}
if (currState != nextState)
{
StatesProc(currState, CommandType.Exit);
StatesProc(nextState, CommandType.Entry);
currState = nextState;
}

(c) Sparx Systems 2018 Page 121 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

}
}

(c) Sparx Systems 2018 Page 122 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

StateMachine Modeling For HDLs


To efficiently generate Hardware Description Language (HDL) code from StateMachine models, apply the design
practices described in this topic. Hardware Description Languages include VHDL, Verilog and SystemC.
In an HDL StateMachine model, you might expect to:
· Designate Driving Triggers
· Establish Port–Trigger Mapping
· Add to Active State Logic

Operations

Operation Description

Designate Driving Triggers · A 'Change' Trigger is deemed to be an asynchronousTrigger if:


- There is a transition from the actual SubMachine State (which
encapsulates the actual logic) that it triggers, and
- The target State of that transition has a self transition triggered
by the same Trigger
· Asynchronous Triggers should be modeled according to this pattern:
- The Trigger should be of type Change (specification: True / False)
- The active State (SubMachine State) should have a transition
triggered by it
- The target State of the triggered transition should have a self
transition with the same Trigger
· A Trigger of type 'Time', which triggers the transitions to the active state
(SubMachine State), is deemed to be the Clock; the specification of this trigger
should conform to the target language:
- VHDL - rising_edge / falling_edge
- Verilog - posedge / negedge
- SystemC - positive / negative

Establish Port-Trigger After successfully modeling the different operating modes of the component, and
Mapping the Triggers associated with them, you must associate the Triggers with the
component's Ports.
A Dependency relationship from the Port to the associated Trigger is used to
signify that association.

Active State Logic Designating the driving Trigger and establishing the Port-Trigger mapping put in
place the preliminaries required for efficiently interpreting the hardware

(c) Sparx Systems 2018 Page 123 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

components.
The actual StateMachine logic is now modeled within the Active (SubMachine)
state.

Notes

· To be able to generate code from behavioral models, all behavioral constructs should be contained within a Class
· The current code generation engine supports only one clock Trigger for a component

(c) Sparx Systems 2018 Page 124 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Generation - Interaction Diagrams


During code generation from Interaction (Sequence) diagrams in a Class, Enterprise Architect applies its system
engineering graph optimizer to transform the Class constructs into programmatic paradigms. Messages and Fragments
are identified as two of the several action types based on their functionality, and Enterprise Architect uses the code
generation templates to render their behavior accordingly.

Actions

Action Description

Action Call A Message that invokes an operation.

Action Create A Message with Lifecycle = New.

Action Destroy A Message with Lifecycle = Delete.

Action Loop A Combined Fragment with Type = Alt.

Action If A Combined Fragment with Type = loop.

Assign To A Call Message with a valid target attribute set using the 'Assign To' field is
rendered in the code as the target attribute of a Call Action.

Notes

· To be able to generate code from behavioral models, all behavioral constructs should be contained within a Class
· For an Interaction (Sequence) diagram, the behavioral code generation engine expects the Sequence diagram and all
its associated messages and interaction fragments to be encapsulated within an interaction element

(c) Sparx Systems 2018 Page 125 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Generation - Activity Diagrams


Code generation from Activity diagrams in a Class requires a validation phase, during which Enterprise Architect uses
the system engineering graph optimizer to analyze the diagram and render it into various constructs from which code can
be generated. Enterprise Architect also transforms the constructs into one of the various action types (if appropriate),
similar to the Interaction diagram constructs.

Actions

Action Description

Call Actions (Invocation Used to invoke operations or behaviors in an Activity diagram; the two main
Actions) variants of Call Actions supported in behavioral code generation are:
· CallOperation Action - used to invoke operations, which can be within the
same Class or in other Classes within the same Package; if referencing
operations from other Classes within the same Package, you must have a target
to which the request is passed
· CallBehavior Action - used to invoke another Activity in an activity flow; the
referenced Activity is expected to be within the same Class

Arguments
Call Actions can specify argument values corresponding to the parameters in the
associated behavior or behavioral feature.
You can add the arguments manually or create them automatically using the
Synchronize button of the 'Arguments' dialog.

CreateObjectAction Used to denote an object creation in the activity flow; you can set the result Pin of
the CreateObjectAction as the object to be created, using the 'Assign Action Pins'
dialog.
The Classifier of the CreateObjectAction signifies the Classifier for which an
instance is to be created.

DestroyObjectAction Used to denote an object deletion in the activity flow; you can set the target Pin of
the DestroyObjectAction as the object to be destroyed, using the 'Assign Action
Pins' dialog.

Loops Enterprise Architect's system engineering graph optimizer is also capable of


analyzing and identifying loops; an identified loop is internally rendered as an
Action Loop, which is translated by the EASL code generation macros to generate
the required code.
You can have a single loop, nested loops, and multiple levels of nested loops.

Conditional Statements To model a conditional statement, you use Decision/Merge nodes.


Alternatively, you can imply Decisions/Merges internally; the graph optimizer
expects an associated Merge node for each Decision node, to facilitate efficient
tracking of various branches and analysis of the code constructs within them.

Notes

(c) Sparx Systems 2018 Page 126 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· To be able to generate code from behavioral models, all behavioral constructs should be contained within a Class

(c) Sparx Systems 2018 Page 127 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Win32 UI Technology

Using the MDG Win32 UI Technology, you can design user interface screens that render as Win32® controls. The user
interface produced can be used in any resource definition script. Resource definition scripts, or RC files, are a Microsoft
technology that - as for other code - can be compiled and the assets used by native desktop applications. User interface
screens or dialogs can be created from scratch or reverse engineered. User interface models can also be forward
engineered using the synchronize code function (F7). Interface modeling takes place on diagrams in the exact same
fashion as you would work with any technology in Enterprise Architect. An interesting aspect of User Interface design in
Enterprise Architect is that components can take an active role in the simulation of StateMachines and Activities,
enabling a simulation to interact with users, much like a real program!

Access

Ribbon Design > Diagram > Insert > Type > User Interface Win32

Context Menu Right-click on Package | Add Diagram > Type | User Interface Win32

Other Project Browser caption bar menu | New Diagram | User Interface Win32

Support

The MDG Win32® User Interface Technology is available in the Enterprise Architect Professional, Corporate and Suite
editions

Enabling Win32 User Interface Technology

(c) Sparx Systems 2018 Page 128 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The Win32® UI Technology in Enterprise Architect is enabled or disabled using the 'MDG Technologies' dialog (select
the 'Specialize > Technologies > Manage' ribbon option).

Default technology

You can set the MDG Win32® UI Technology as the active default technology to access the Toolbox pages directly.

(c) Sparx Systems 2018 Page 129 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Modeling UI Dialogs
The Win32 User Interface MDG Technology provides the tools to help you design a user interface that closely emulates
the visual style and available options for Windows dialogs.

Win32 Dialog

These user interface components are supported, each matching the equivalent-named RC resource.

Component Details

win32Dialog The equivalent of the RC format DIALOG and DIALOGEX resources.

win32StaticText The equivalent of the RC format LTEXT, RTEXT, CTEXT resources.

win32Edit The equivalent of the RC format EDITTEXT resource.

win32Button The equivalent of the RC format BUTTON, DEFPUSHBUTTON and other


resources.

win32CheckBox The equivalent of the RC format CHECKBOX resource.

win32ScrollBarH The equivalent of the RC format SCROLLBAR resource with SBS_HORZ style

win32ScrollBarV The equivalent of the RC format SCROLLBAR resource with SBS_VERT style.

win32GroupBox The equivalent of the RC format GROUPBOX resource.

(c) Sparx Systems 2018 Page 130 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

win32ComboBox The equivalent of the RC format COMBOBOX resource.


Note: When you initially drag the 'Combo Box' icon - of type 'Drop Down' or 'Drop
Down List' - onto a diagram, the middle 'tracking handle' on each side of the
element is white, indicating that you can only adjust the width of the element. To
adjust the height of the element as well as the width, click on the drop-down arrow
part of the image; the middle 'tracking handle' on the bottom edge is now white,
indicating that you can drag the base down to set the virtual height (the height of
the element when it is expanded to show all possible values in the drop-down list).

win32ListBox The equivalent of the RC format LISTBOX resource.

win32RadioButton The equivalent of the RC format RADIOBUTTON resource.

win32TabPane The equivalent of the RC format TABPANE resource.

win32Picture The equivalent of the RC format STATIC resource with SS_BITMAP style.
The control can render an image when applied from your model. An image can be
applied by selecting it first and pressing Ctrl+Shift+W to display the Image
Manager. Afterwards, you might need to change the value of the resource ID in the
appropriate Tagged Value.

win32CustomControl The equivalent of the RC format CONTROL resource.

(c) Sparx Systems 2018 Page 131 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Single Dialog from RC File


You can quickly import a single dialog by name.

Access

In the Project Browser, click on the target Package.

Ribbon Code > Import > File > Import Resource Script

(c) Sparx Systems 2018 Page 132 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import All Dialogs from RC File


All dialogs in a single RC file can be imported into your model. This image was captured one minute into the import, at
which time over 200 large dialog definitions had been imported.

Access

Ribbon Code > Import > File > Import Resource Script

(c) Sparx Systems 2018 Page 133 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Export Dialog to RC File


Once a screen design is modified or a new one created, you might want to get it back to the RC file you use to build your
application, so that you can see how it looks with real data. Begin by selecting the Win32Dialog element in the Project
Browser, then use the ribbon to perform the synchronization.

Access

Click on the win32Dialog element.

Ribbon Code > Source Code > Synchronize > Synchronize Selected Elements

Keyboard Shortcuts F7

(c) Sparx Systems 2018 Page 134 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Design a New Dialog


Creating a new Win32 dialog is easy and mostly visual. You will probably need a workspace that shows:
· The new diagram (select the 'Design > Diagram > Insert > User Interface - Win32 > User Interface - Win32' ribbon
path)
· The Win32 User Interface Toolbox (select the 'Design > Diagram > Tooolbox' ribbon option) and
· The Tagged Values window (Ctrl+Shift+6)

The UI Toolbox

All of the common RC elements can be found on the UI toolbox

(c) Sparx Systems 2018 Page 135 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The Tagged Values Window

This window is where all the properties of a control can be viewed and edited.

Using the Picture Control

(c) Sparx Systems 2018 Page 136 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Images from your model (see Image Manager) can be applied by selecting the control on the dialog and pressing
Ctrl+Shift+W. You might have to enter the value of the resource ID in the appropriate Tagged Value.

Note

· You can copy and paste dialog Packages

(c) Sparx Systems 2018 Page 137 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

GoF Patterns
A Design Pattern is a template for solving commonly recurring design problems; it consists of a series of elements and
connectors that can be reused in a new context. The advantage of using Patterns is that they have been tested and refined
in a number of contexts and so are typically robust solutions to common problems. Enterprise Architect provides the
Gang of Four Patterns as an MDG Technology that can be loaded into the current repository.
The Gang of Four (Gof) Patterns are a group of twenty three Design Patterns originally published in a seminal book
entitled Design Patterns: Elements of Reusable Object-Oriented Software; the term 'Gang of Four' refers to the four
authors. Enterprise Architect displays these Patterns in its powerful Pattern engine, helping you to visualize the elements
of the Pattern and adjust the Pattern to the context of your software design problem.

GoF Patterns in Enterprise Architect

Features Description

GoF Pattern Facilities The GoF Patterns are provided in the form of:
· GoF Behavioral Patterns, GoF Creational Patterns and GoF Structural Patterns
pages in the Toolbox
· Gang of Four Pattern entries in the Toolbox Shortcut Menu
GoF Pattern Toolbox Pages

You can access the 'GoF Pattern' pages of the Toolbox by clicking on to
display the 'Find Toolbox Item' dialog and specifying 'GoF Patterns'; these icons are
available:

(c) Sparx Systems 2018 Page 138 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

When you drag one of the Pattern elements onto a new diagram, the 'Add Pattern
GoF <pattern group><pattern type>' dialog displays; if necessary, modify the action
and/or default for the component elements, then click on the OK button to create a
diagram based on the Pattern.

(c) Sparx Systems 2018 Page 139 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Configuration Settings

You can set the default code options such as the editors for each of the programming languages available for Enterprise
Architect and special options for how source code is generated or reverse engineered. These options are defined
according to whether they apply to:
· All users of the current model, set on the 'Manage Project Options' dialog, or
· All models that you access (other users can define their own settings that apply to the same models), set on the
'Preferences' dialog
You can also:
· For each programming language used in the model, for all users working on the model, define Collection Classes for
generating code from Association connectors where the target role has a multiplicity setting greater than 1
· Define a local path for yourself, using the 'Local Path' dialog; these settings apply to all Enterprise Architect models
that you access
· Define language macros within the model, which are useful in reverse engineering and can be exported from and
imported to the model

(c) Sparx Systems 2018 Page 140 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Source Code Engineering Options


The 'Source Code Engineering' options apply to the languages in which you generate code from Enterprise Architect.
They are divided into Model-specific options and User-specific options, as explained here.

Model-Specific Options

These options are defined on the 'Manage Project Options' dialog.

Access

Ribbon Configure > Model > Options > Source Code Engineering

Types of Option

Option Type Detail

Source Code Generation You can define a number of settings for generating code in the model, such as the
Options default language to generate code in and the Unicode character set for code
generation.

Options - Object Lifetimes You can configure various options concerning Object Lifetimes.

Code Language Options For each of the code languages that Enterprise Architect supports, you can define
the model-specific options and set any Collection Classes required.

User-Specific Options

These options are defined on the 'Preferences' dialog.

Access

On the 'Preferences' dialog, click on 'Source Code Engineering' in the left-hand list.

Ribbon Start > View > Preferences

Keyboard Shortcuts Ctrl+F9

(c) Sparx Systems 2018 Page 141 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Types of Option

Option Type Detail

Source Code Generation You can define a number of settings for generating code in any model that you
Options access under the same user ID.

Code Editors These are options for accessing and configuring the source code editor.

Attributes/Operations Use these options for configuring attributes and operations.

Code Language Options For each of the code languages that Enterprise Architect supports, you can define
the user-specific options that apply to any model that you access under your user
ID.

(c) Sparx Systems 2018 Page 142 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Generation Options


When you generate code for your model, you can set certain options. These include:
· The default language
· Whether to generate methods for implemented interfaces
· The Unicode options for code generation

Access

Ribbon Configure > Model > Options > Source Code Engineering

Configure code generation options

Option Action

Always synchronize with Select the radio button to synchronize imported code with an existing file.
existing file
(recommended)

Replace (overwrite) Select the radio button to overwrite the existing source file with imported code.
existing source file

Component Types Click on this button to open the 'Import component types' dialog, to set up the
importation of component types.

Default Language for Code Click on the drop-down arrow and select the default language for code generation.
Generation

DDL Name Templates


Click on the button to define the template names for Primary Key, Unique
Constraint, Foreign Key and Foreign Key Index Name templates.

Default name for Type in a default name to be generated from imported attributes.
associated attrib

Generate methods for Select the checkbox to indicate that methods are generated for implemented
implemented interfaces interfaces.

Code page for source Click on the drop-down arrow and select the appropriate Unicode character
editing embedding format to apply.

Notes

· It is worthwhile to configure these settings, as they serve as the defaults for all Classes in the model; you can

(c) Sparx Systems 2018 Page 143 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

override most of these on a per-Class basis using the custom settings (from the 'Code Generation' dialog)

(c) Sparx Systems 2018 Page 144 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Component Types


Using the 'Import Component Types' dialog you can configure what elements you would like to be created for files of
any extension found while importing a source code directory.

Access

Ribbon Configure > Model > Options > Source Code Engineering: Component Types

Define Import Component Types

Option Action

Extension Type in the extension name for a component type.

Type Click on the drop-down arrow and select the component type.

Stereotype Type in any stereotype name that further identifies a component of this type.

Component List Lists the currently-defined component types.

Save Click on this button to saves the component definition and add it to the component
list.

New Click on this button to clear the dialog fields so that you can define a new
component type.

Delete Click on this button to delete the selected component type from the component list.

Notes

· You can transport these import component types between models, using the 'Configure > Model > Transfer > Export
Reference Data' and 'Import Reference Data' ribbon options

(c) Sparx Systems 2018 Page 145 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Source Code Options


You can set a wide range of options for generating code in the models you work with. These include:
· How to format the generated code
· How to respond to certain events during code generation
· Whether to generate a diagram from the code

Access

On the 'Preferences' dialog, select the 'Source Code Engineering' option

Ribbon Start > View > Preferences

Keyboard Shortcuts Ctrl+F9

Configure code generation options

Field Action

Wrap long comment lines Type in the number of characters to allow in a comment line before wrapping the
at text to the next line.

Auto Layout Diagram on Click on the drop-down arrow and select if and when a diagram is automatically
Import generated on code import.

Output files use both CR & Select the checkbox to include carriage returns and line feeds; set this option
LF according to what operating system is currently in use, as code might not render
correctly.

Prompt when Select the checkbox to display a prompt when synchronization occurs.
synchronizing (reversing)

Remove hard breaks from Select the checkbox to remove hard breaks from commented sections on
comments on import importation.

Auto generate role names Select the checkbox to generate role names when creating code.
when creating code

Do not generate members Select the checkbox to prevent generation of members if the Association direction
where association direction is unspecified.
is 'Unspecified'

Create dependencies for Select the checkbox to generate dependencies for operation returns and parameter
operation returns and types.
parameter types

Comments: Generate Select the checkbox to generate comments.

(c) Sparx Systems 2018 Page 146 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Comments: Reverse Select the checkbox to generate reverse comments.

Remove prefixes when Type in the prefixes, separated by semi-colons, used in your variable naming
generating Get/Set conventions, to be removed in the variables' corresponding get/set functions.
properties

Treat as suffixes Select the checkbox to use the prefixes defined in the 'Remove prefixes when
generating Get/Set properties' field as suffixes.

Capitalized Attribute Name Select the checkbox to capitalize attribute names for properties.
for Properties

Use 'Is' for Boolean Select the checkbox to use the Is keyword for the Boolean property Get().
property Get()

Notes

· It is worthwhile to configure these settings, as they serve as the defaults for all Classes in the model; you can
override most of these on a per-Class basis using the custom settings (from the 'Code Generation' dialog)

(c) Sparx Systems 2018 Page 147 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Options - Code Editors


You access the source code editor options via the 'DDL' page of the 'Preferences' dialog. On this page you can configure
options for Enterprise Architect's internal editor, as well as the default editor for DDL scripts. You can configure external
editors for code languages on each language options page.

Access

On the 'Preferences' dialog, select the 'Source Code Engineering > Code Editors' option.

Ribbon Start > View > Preferences

Keyboard Shortcuts Ctrl+F9

Options

Option Action

DDL Editor Defaults to blank, indicating that the Enterprise Architect code editor is the DDL
editor in use.

You can select a different default editor if necessary; click on the button to
browse for and select the required DDL editor. The editor name then displays in the
'DDL Editor' field.

Default Database Click on the drop-down arrow and select the default database to be used.

MySQL Storage Click on the drop-down arrow and select the MySQL storage engine to be used.

Use inbuilt editor if no Select the checkbox to use the inbuilt editor for code in any language if no external
external editor set editor is defined for that language in the user-specific options.

Show Line Numbers Select the checkbox to display line numbers in the editor.

Show Structure Tree Select the checkbox to show a tree with the results of parsing the open file (if the
file is parsed successfully).

Automatically Reverse If you select this checkbox, pressing Ctrl+S to save in the source code editor
Engineer on File Save automatically reverse engineers the code in the same way as the Save Source and
Re-Synchronize Class button does.

Don't parse files larger than Click on the drop-down arrow and select the upper limit on file size for parsing.
Setting this option prevents performance decrease due to parsing very large files.

Syntax Highlighting
Options Click on the button to display the 'Editor Language Properties' dialog, in
which you can set both global and language-specific editor language properties.

Configure Enterprise

(c) Sparx Systems 2018 Page 148 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Architect File Associations


Click on the button to display the 'Set Associations for a Program' dialog, and
select the file extensions for files that you want to open through the Enterprise
Architect Document Handler.

(c) Sparx Systems 2018 Page 149 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Editor Language Properties


Using the 'Editor Language Properties' dialog, you can specify syntax highlighting properties for any of the programming
languages that Enterprise Architect supports at installation.

Access

In the 'Preferences' dialog, select the 'Source Code Engineering | Code Editors' option and click on the button next
to 'Syntax Highlighting Options'.

Ribbon Start > View > Preferences > select 'Source Code Engineering | Code Editors'
option > click on the button next to 'Syntax Highlighting Options'

Other
In the Code Editor window, click on the toolbar icon | Syntax Highlighting
Options

Options

Panel Description

Language Panel The panel on the left of the dialog lists the languages for which you can set
properties.
At the top of the list are three non-language options:
· (Dark Theme) - assigns a dark background to the property fields and to the
code panel in the code editor screen (you can apply a different color to specific
properties)
· (Light Theme) - assigns a pale background to the property fields and to the
code panel in the code editor screen (you can apply a different color to specific
properties)
You can also set the background themes on the 'Application Look' dialog
· (Global) provides properties that you can set for all programming languages;
however, you can reset a global property to a different value for a particular
language, in the properties specifically for that language
Resetting a global property for one language does not affect that property's
value for the other languages
Click on the required language in the list, to display the properties for that
language:
· Properties shown in bold indicate that this is the highest level at which this
property can be defined (for most language options other than 'Global', this is
effectively the only point at which the property is defined)
· Properties shown in normal font are generally the global properties that you
can reset just for the current language

Properties Panel Scroll through the property categories and individual properties for the language.
You can collapse and expand categories as necessary, using the expansion box next
to the category name ( ).

(c) Sparx Systems 2018 Page 150 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

When you click on a property name, an explanation of that property displays in the
panel at the bottom right of the dialog.
To define a property, click on the value field following the property name;
depending on the type of property, either the field is enabled for direct editing or a
drop-down arrow or button displays (as described for the Tagged Values
window) so that you can select the values to define the property.
Select or type in the required values.
Use the Toolbar icons to:
· Save your changes to the properties
· Reset all properties fields to the default settings shipped with Enterprise
Architect
· Reset the current style field to the default setting (not enabled for non-style
fields)

Assign Keys to Macros In the 'Macros' category of the properties, you can assign (Ctrl+Alt+<n>) keystroke
combinations to coding macros that you have created yourself in the 'Source Code
Viewer'.
When you click on the Browse button in a selected 'Macro' field, the 'Open Macro'
dialog displays; this dialog lists the existing macros and, if a key combination has
been assigned to a macro, what that key combination is.
Click on the name of the macro and on the Open button to assign the selected keys
to the macro.

Notes

· You cannot currently set properties for any additional languages you include through an MDG Technology
· You can resize this dialog, if required

(c) Sparx Systems 2018 Page 151 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Options - Object Lifetimes


You can use these options to configure various Object Lifetime settings such as:
· Defining constructor details when generating code
· Specifying whether to create a copy constructor
· Defining Destructor details

Access

Ribbon Configure > Model > Options > Source Code Engineering > Object Lifetimes

Options

Option Action

Constructor If necessary, select the checkboxes to specify that a constructor is generated and
(for C++) that the constructor is in-line.
Click on the drop-down arrow and select the appropriate visibility of the default
constructor - Private, Protected or Public.

Copy Constructor If necessary, select the checkboxes to specify that a copy constructor is generated
and (for C++) that the copy constructor is in-line.
Click on the drop-down arrow and select the appropriate visibility of the default
copy constructor - Private, Protected or Public.

Destructor If necessary, select the checkboxes to specify that a destructor is generated and (for
C++) that the destructor is in-line and/or virtual.
Click on the drop-down arrow and select the appropriate visibility of the default
destructor - Private, Protected or Public.

(c) Sparx Systems 2018 Page 152 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Options - Attribute/Operations
Your use of attributes and operations can be configured in a number of ways. You can set options to:
· Delete model attributes not included in the code during reverse synchronization
· Delete model methods not included in the code during reverse synchronization
· Delete code from features contained in the model during forward synchronization
· Delete model associations and aggregations that correspond to attributes not included in the code during reverse
synchronization
· Define whether or not the bodies of methods are included and saved in the model when reverse engineering
· Create features in quick succession, clearing the operation Properties window when you click on 'Save' so that you
can enter another feature name
You configure these options on the 'Attribute/Operations' page of the 'Preferences' dialog.

Access

On the 'Preferences' dialog, select the 'Source Code Engineering > Attribute/Operations' option.

Ribbon Start > View > Preferences

Keyboard Shortcuts Ctrl+F9

Options

Field Action

On reverse synch, delete Select the checkbox to indicate that on reverse synchronization, attributes in the
model attributes not in model that are not included within code are automatically removed from the model.
code

On reverse synch, delete Select the checkbox to indicate that on reverse synchronization, associations in the
model associations not in model that are not included within code are automatically removed from the model.
code

On reverse synch, delete Select the checkbox to indicate that on reverse synchronization, methods in the
model methods not in code model that are not included within code are automatically removed from the model.

Include method bodies in Select the checkbox to indicate that on reverse engineering code, method bodies in
model when reverse the code are included within your model.
engineering

After Save, re-select edited Select the checkbox to indicate that after saving an attribute or operation, the
item properties definition continues to display the details of the selected feature.
If deselected, indicates that the fields of the properties definition will clear so that
you can enter another attribute or operation name and details immediately.

On forward synch, prompt Select the checkbox to indicate that, during forward synchronization, the

(c) Sparx Systems 2018 Page 153 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

to delete code features not 'Synchronize Element <package name>.<element name>' dialog displays, so that
in model you can either ignore, reassign or delete features in the code that are not in the
model.

(c) Sparx Systems 2018 Page 154 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Modeling Conventions

The synchronization between UML models and programming code is achieved using a set of modeling conventions
(mappings) between UML constructs and programming code syntax. The Software Engineer is advised to become
familiar with these conventions in order to work with the code generation process for the programming languages they
intend to target. There are a range of constructs used, including elements, features, connectors, connector ends,
stereotypes and Tagged Values. The newcomer will require a little time to become familiar with these conventions but
after a short time they will be translating between programming code and UML constructs without effort.

Supported Languages

Language

Action Script

Ada 2012 (Unified and Ultimate editions)

C#

C++

Delphi

Java

PHP

Python

SystemC (Unified and Ultimate editions)

Verilog (Unified and Ultimate editions)

VHDL (Unified and Ultimate editions)

Visual Basic

Visual Basic .NET

(c) Sparx Systems 2018 Page 155 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes

Enterprise Architect incorporates a number of visibility indicators or scope values for its supported languages; these
include, for:
· All languages - Public (+), Protected (#) and Private (-)
· Java - Package (~)
· Delphi - Published (^)
· C# - Internal (~), Protected Internal (^)
· ActionScript - Internal (~)
· VB.NET - Friend (~), Protected Friend (^)
· PHP - Package (~)
· Python - Package (~)
· C - Package (~)
· C++ - Package (~)

(c) Sparx Systems 2018 Page 156 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

ActionScript Conventions
Enterprise Architect supports round trip engineering of ActionScript 2 and 3, where these conventions are used.

Stereotypes

Stereotype Applies To

literal Operation
Corresponds To: A literal method referred to by a variable.

property get Operation


Corresponds To: A 'read' property.

property set Operation


Corresponds To: A 'write' property.

Tagged Values

Tag Applies To

attribute_name Operation with stereotype property get or property set


Corresponds To: The name of the variable behind this property.

dynamic Class or Interface


Corresponds To: The 'dynamic' keyword.

final ActionScript 3: Operation


Corresponds To: The 'final' keyword.

intrinsic ActionScript 2: Class


Corresponds To: The 'intrinsic' keyword.

namespace ActionScript 3: Class, Interface, Attribute, Operation


Corresponds To: The namespace of the current element.

override ActionScript 3: Operation


Corresponds To: The 'override' keyword.

prototype ActionScript 3: Attribute


Corresponds To: The 'prototype' keyword.

rest ActionScript 3: Parameter


Corresponds To: The rest parameter (...)

(c) Sparx Systems 2018 Page 157 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Common Conventions

· Package qualifiers (ActionScript 2) and Packages (ActionScript 3) are generated when the current Package is not a
namespace root
· An unspecified type is modeled as 'var' or an empty 'Type' field

ActionScript 3 Conventions

· The Is Leaf property of a Class corresponds to the sealed keyword


· If a namespace tag is specified it overrides the Scope that is specified

(c) Sparx Systems 2018 Page 158 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Ada 2012 Conventions


Enterprise Architect supports round trip engineering of Ada 2012, where these conventions are used.

Stereotypes

Stereotype Applies To

adaPackage Class
Corresponds To: A Package specification in Ada 2012 without a tagged record.

adaProcedure Class
Corresponds To: A procedure specification in Ada 2012.

delegate Operation
Corresponds To: Access to a subprogram.

enumeration Inner Class


Corresponds To: An enumerated type.

struct Inner Class


Corresponds To: A record definition.

typedef Inner Class


Corresponds To: A type definition, subtype definition, access type definition,
renaming.

Tagged Values

Tag Applies To

Aspect Inner Class with stereotype typedef


Operation
Corresponds to: Aspect specification (Precondition and Postcondition of
Subprogram type 'invariant', subtype 'predicate').

InstantiatedUnitType Inner Class with stereotype typedef


Corresponds To: The instantiated unit's type (Package / Procedure / Function).

IsAccess Parameter
Corresponds To: Determination of whether the parameter is an access variable.

IsAliased Function parameter


Corresponds to: Aliased function parameter.

(c) Sparx Systems 2018 Page 159 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Discriminant Inner Class with stereotype typedef


Corresponds To: The type's discriminant.

PartType Inner Class with stereotype typedef


Corresponds To: The part type ('renames' or 'new').

Type Inner Class with stereotype typedef


Corresponds To: If 'Value' = 'SubType', set 'subtype'
If 'Value' = 'Access', set 'access type'.

Other Conventions

· Appropriate type of source files: Ada specification file, .ads


· Ada 2012 imports Packages defined as either <<adaPackage>> Class or Class, based on the settings in the Ada 2012
options
· A Package in the Ada specification file is imported as a Class if it contains a Tagged Record, the name of which is
governed by the options 'Use Class Name for Tagged Record' and 'Alternate Tagged Record Name'; all attributes
defined in that Tagged Record are absorbed as the Class's attributes
· A procedure / function in an Ada specification file is considered as the Class's member function if its first parameter
satisfies the conditions specified in the options 'Ref Param Style', 'Ignore Reference parameter name' and 'Ref
parameter name'
· The option 'Define Reference for Tagged Record', if enabled, creates a reference type for the Class, the name of
which is determined by the option 'Reference Type Name'; for example:
HelloWorld.ads
package HelloWorld is
type HelloWorld is tagged record
Att1: Natural;
Att3: Integer;
end record;

-- Public Functions
function MyPublicFunction (P: HelloWorld) return String;
procedure MyPublicFunction (P1: in out HelloWorld; AFlag: Boolean);
private
-- Private Functions
function MyPrivateFunction (P: HelloWorld) return String;
procedure MyPrivateFunction (P1: in out HelloWorld; AFlag: Boolean);
end HelloWorld;

(c) Sparx Systems 2018 Page 160 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes

· Ada 2012 support is available in the Unified and Ultimate editions of Enterprise Architect

(c) Sparx Systems 2018 Page 161 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C Conventions
Enterprise Architect supports round trip engineering of C, where these conventions are used:

Stereotype

Stereotype Applies To

enumeration Inner Class


Corresponds To: An enumerated type.

struct Inner Class


Corresponds To: A 'struct' type.

Attribute A keyword struct in variable definition.

typedef Inner Class


Corresponds To: A 'typedef' statement, where the parent is the original type name.

union Inner Class


Corresponds To: A union type.

Attribute A keyword union in variable definition.

Tagged Values

Tag Applies To

anonymous Class also containing the Tagged Value typedef


Corresponds To: The name of this Class being defined only by the typedef
statement.

bitfield Attribute
Corresponds To: The size, in bits, allowed for storage of this attribute.

bodyLocation Operation
Corresponds To: The location the method body is generated to; expected values are
header, classDec or classBody.

typedef Class with stereotype other than 'typedef'


Corresponds To: This Class being defined in a 'typedef' statement.

typeSynonyms Class
Corresponds To: The 'typedef' name and/or fields of this type.

(c) Sparx Systems 2018 Page 162 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C Code Generation for UML Model

UML C Code

A Class A pair of C files (.h + .c)


Notes: File name is the same as Class name

Operation (public & Function declaration in .h file and definition in .c file


protected) Notes:

Operation (private) Function definition in .c file only


Notes:

Operation (static) Function definition in .c file only


Notes: Static functions will only appear in the .c file regardless of their scope.

Attribute (public & Variable definition in .h file


protected) Notes:

Attribute (private) Variable definition in .c file


Notes:

Inner Class (without (N/A)


stereotype) Notes: This inner Class would be ignored

Capture #define value to be generated in C code

For example, #define PI 3.14.

Step Process

1 Add an attribute to the Class, with Name = PI and Initial Value = 3.14.

2 In the properties panel of the 'Attributes' page, update the 'Static' and 'Const' fields.

3 On the 'Tagged Values' tab of the 'Attributes' page, add a tag called 'define' with the value True.

Notes

· Separate conventions apply to Object Oriented programming in C

(c) Sparx Systems 2018 Page 163 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Object Oriented Programming In C


In Enterprise Architect, you apply a number of conventions for Object-Oriented programming in C.
To configure the system to support Object-Oriented programming using C, you must set the 'Object Oriented Support'
option to True on the 'C Specifications' page of the 'Preferences' dialog.

Stereotypes

Stereotype Applies To

enumeration Class
Corresponds To: An enumerated type.

struct Class
Corresponds To: A 'struct' type.

Attribute A keyword struct in variable definition.

typedef Class
Corresponds To: A 'typedef' statement, where the parent is the original type name.

union Class
Corresponds To: A union type.

Attribute A keyword union in variable definition.

Tagged Values

Tag Applies To

anonymous Class with stereotype of 'enumeration', 'struct' or 'union'


Corresponds To: The name of this Class being defined only by the typedef
statement.

bodyLocation Operation
Corresponds To: The location the method body is generated to; expected values are
'header', 'classDec' or 'classBody'.

define Attribute
Corresponds To: '#define' statement.

typedef Class with stereotype of 'enumeration', 'struct' or 'union'


Corresponds To: This Class being defined in a 'typedef' statement.

(c) Sparx Systems 2018 Page 164 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Object-Oriented C Code Generation for UML Model

The basic idea of implementing a UML Class in C code is to group the data variable (UML attributes) into a structure
type; this structure is defined in a .h file so that it can be shared by other Classes and by the client that referred to it.
An operation in a UML Class is implemented in C code as a function; the name of the function must be a fully qualified
name that consists of the operation name, as well as the Class name to indicate that the operation is for that Class.
A delimiter (specified in the 'Namespace Delimiter' option on the 'C Specifications' page) is used to join the Class name
and function (operation) name.
The function in C code must also have a reference parameter to the Class object - you can modify the 'Reference as
Operation Parameter', 'Reference Parameter Style' and 'Reference Parameter Name' options on the 'C Specifications' page
to support this reference parameter.

Limitations of Object-Oriented Programming in C

· No scope mapping for an attribute: an attribute in a UML Class is mapped to a structure variable in C code, and its
scope (private, protected or public) is ignored
· Currently an inner Class is ignored: if a UML Class is the inner Class of another UML Class, it is ignored when
generating C code
· Initial value is ignored: the initial value of an attribute in a UML Class is ignored in generated C code

(c) Sparx Systems 2018 Page 165 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C# Conventions
Enterprise Architect supports the round trip engineering of C#, where these conventions are used.

Stereotypes

Stereotype Applies To

enumeration Class
Corresponds To: An enumerated type.

event Operation
Corresponds To: An event.

extension Operation
Corresponds To: A Class extension method, represented in code by a 'this'
parameter in the signature.

indexer Operation
Corresponds To: A property acting as an index for this Class.

partial Operation
Corresponds To: The 'partial' keyword on an operation.

property Operation
Corresponds To: A property possibly containing both read and write code.

struct Class
Corresponds To: A 'struct' type.

Tagged Values

Tag Applies To

argumentName Operation with stereotype extension


Corresponds To: The name given to this parameter.

attribute_name Operation with stereotype property or event


Corresponds To: The name of the variable behind this property or event.

className Operation with stereotype extension


Corresponds To: The Class that this method is being added to.

const Attribute

(c) Sparx Systems 2018 Page 166 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Corresponds To: The const keyword.

definition Operation with stereotype partial


Corresponds To: Whether this is the declaration of the method, or the definition.

delegate Operation
Corresponds To: The 'delegate' keyword.

enumType Operation with stereotype property


Corresponds To: The datatype that the property is represented as.

expressionBody Operation, Operation with stereotype property or indexer


Corresponds To: 'True' if the 'Initial Code' is from an expression body function
member.

extern Operation
Corresponds To: The 'extern' keyword.

fixed Attribute
Corresponds To: The 'fixed' keyword.

generic Operation
Corresponds To: The generic parameters for this operation.

genericConstraints Templated Class or Interface, Operation with tag 'generic'


Corresponds To: The constraints on the generic parameters of this type or
operation.

Implements Operation
Corresponds To: The name of the method this implements, including the interface
name.

ImplementsExplicit Operation
Corresponds To: The presence of the source interface name in this method
declaration.

initializer Operation
Corresponds To: A constructor initialization list.

new Class, Interface, Operation


Corresponds To: The 'new' keyword.

override Operation
Corresponds To: The 'override' keyword.

params Parameter
Corresponds To: A parameter list using the 'params' keyword.

partial Class, Interface


Corresponds To: The 'partial' keyword.

(c) Sparx Systems 2018 Page 167 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

propertyInitializer Operation with stereotype property


Corresponds To: A property initializer.

readonly Operation with stereotype property


Corresponds To: This property only defining 'read' code.

sealed Operation
Corresponds To: The 'sealed' keyword.

static Class
Corresponds To: The 'static' keyword.

unsafe Class, Interface, Operation


Corresponds To: The 'unsafe' keyword.

virtual Operation
Corresponds To: The 'virtual' keyword.

writeonly Operation with stereotype property


Corresponds To: This property only defining 'write' code.

Other Conventions

· Namespaces are generated for each Package below a namespace root


· The Const property of an attribute corresponds to the readonly keyword, while the tag const corresponds to the const
keyword
· The value of inout for the Kind property of a parameter corresponds to the ref keyword
· The value of out for the Kind property of a parameter corresponds to the out keyword
· Partial Classes can be modeled as two separate Classes with the partial tag
· The Is Leaf property of a Class corresponds to the sealed keyword

(c) Sparx Systems 2018 Page 168 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C++ Conventions
Enterprise Architect supports round trip engineering of C++, including the Managed C++ and C++/CLI extensions,
where these conventions are used.

Stereotypes

Stereotype Applies To

enumeration Class
Corresponds To: An enumerated type.

friend Operation
Corresponds To: The 'friend' keyword.

property get Operation


Corresponds To: A 'read' property.

property set Operation


Corresponds To: A 'write' property.

struct Class
Corresponds To: A 'struct' type.

typedef Class
Corresponds To: A 'typedef' statement, where the parent is the original type name.

alias Class
Corresponds to an 'Alias' declaration, where the parent is the original type name.

union Class
Corresponds To: A union type.

Tagged Values

Tag Applies To

afx_msg Operation
Corresponds To: The afx_msg keyword.

anonymous Class also containing the Tagged Value typedef


Corresponds To: The name of this Class being only defined by the typedef
statement.

(c) Sparx Systems 2018 Page 169 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

attribute_name Operation with stereotype property get or property set


Corresponds To: The name of the variable behind this property.

bitfield Attribute
Corresponds To: The size, in bits, allowed for storage of this attribute.

bodyLocation Operation
Corresponds To: The location the method body is generated to; expected values are
header, classDec or classBody.

callback Operation
Corresponds To: A reference to the CALLBACK macro.

explicit Operation
Corresponds To: The 'explicit' keyword.

initializer Operation
Corresponds To: A constructor initialization list.

inline Operation
Corresponds To: The inline keyword and inline generation of the method body.

mutable Attribute
Corresponds To: The 'mutable' keyword.

scoped Class with stereotype enumeration


Corresponds To: Either the 'class' or 'struct' keyword.

throws Operation
Corresponds To: The exceptions that are thrown by this method.

typedef Class with stereotype other than 'typedef'


Corresponds To: This Class being defined in a 'typedef' statement.

typeSynonyms Class
Corresponds To: The 'typedef' name and/or fields of this type.

volatile Operation
Corresponds To: The 'volatile' keyword.

Other Conventions

· Namespaces are generated for each Package below a namespace root


· By Reference attributes correspond to a pointer to the type specified
· The Transient property of an attribute corresponds to the volatile keyword
· The Abstract property of an attribute corresponds to the virtual keyword

(c) Sparx Systems 2018 Page 170 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· The Const property of an operation corresponds to the const keyword, specifying a constant return type
· The Is Query property of an operation corresponds to the const keyword, specifying the method doesn't modify any
fields
· The Pure property of an operation corresponds to a pure virtual method using the "= 0" syntax
· The Fixed property of a parameter corresponds to the const keyword

(c) Sparx Systems 2018 Page 171 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Managed C++ Conventions


These conventions are used for managed extensions to C++ prior to C++/CLI. In order to set the system to generate
managed C++ you must modify the C++ version in the C++ Options.

Stereotypes

Stereotype Applies To

property Operation
Corresponds To: The '__property' keyword.

property get Operation


Corresponds To: The '__property' keyword and a read property.

property set Operation


Corresponds To: The '_ _property' keyword and a 'write' property.

reference Class
Corresponds To: The '__gc' keyword.

value Class
Corresponds To: The '__value' keyword.

Tagged Values

Tag Applies To

managedType Class with stereotype reference, value or enumeration; Interface


Corresponds To: The keyword used in declaration of this type; expected values are
'class' or 'struct'.

Other Conventions

· The typedef and anonymous tags from native C++ are not supported
· The Pure property of an operation corresponds to the keyword __abstract

(c) Sparx Systems 2018 Page 172 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C++/CLI Conventions
These conventions are used for modeling C++/CLI extensions to C++. In order to set the system to generate managed
C++/CLI you must modify the C++ version in the C++ Options.

Stereotypes

Stereotype Applies To

event Operation
Description: Defines an event to provide access to the event handler for this Class.

property Operation, Attribute


Description: This is a property possibly containing both read and write code.

reference Class
Description: Corresponds to the 'ref class' or 'ref struct' keyword.

value Class
Description: Corresponds to the 'value class' or 'value struct' keyword.

Tagged Values

Tag Applies To

attribute_name Operation with stereotype property or event


Description: The name of the variable behind this property or event.

generic Operation
Description: Defines the generic parameters for this Operation.

genericConstraints Templated Class or Interface, Operation with tag generic


Description: Defines the constraints on the generic parameters for this Operation.

initonly Attribute
Description: Corresponds to the 'initonly' keyword.

literal Attribute
Description: Corresponds to the literal keyword.

managedType Class with stereotype reference, value or enumeration; Interface


Description: Corresponds to either the 'class' or 'struct' keyword.

(c) Sparx Systems 2018 Page 173 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Other Conventions

· The typedef and anonymous tags are not used


· The property get/property set stereotypes are not used
· The Pure property of an operation corresponds to the keyword abstract

(c) Sparx Systems 2018 Page 174 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Delphi Conventions
Enterprise Architect supports round trip engineering of Delphi, where these conventions are used:

Stereotypes

Stereotype Applies To

constructor Operation
Corresponds To: A constructor.

destructor Operation
Corresponds To: A destructor.

dispinterface Class, Interface


Corresponds To: A dispatch interface.

enumeration Class
Corresponds To: An enumerated type.

metaclass Class
Corresponds To: A metaclass type.

object Class
Corresponds To: An object type.

operator Operation
Corresponds To: An operator.

property get Operation


Corresponds To: A 'read' property.

property set Operation


Corresponds To: A 'write' property.

struct Class
Corresponds To: A record type.

Tagged Values

Tag Applies To

attribute_name Operation with stereotype property get or property set


Corresponds To: The name of the variable behind this property.

(c) Sparx Systems 2018 Page 175 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

overload Operation
Corresponds To: The 'overload' keyword.

override Operation
Corresponds To: The 'override' keyword.

packed Class
Corresponds To: The 'packed' keyword.

property Class
Corresponds To: A property; see Delphi Properties for more information.

reintroduce Operation
Corresponds To: The 'reintroduce' keyword.

Other Conventions

· The Static property of an attribute or operation corresponds to the 'class' keyword


· The Fixed property of a parameter corresponds to the 'const' keyword
· The value of inout for the Kind property of a parameter corresponds to the 'Var' keyword
· The value of out for the Kind property of a parameter corresponds to the 'Ou't keyword

(c) Sparx Systems 2018 Page 176 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Java Conventions
Enterprise Architect supports round trip engineering of Java - including AspectJ extensions - where these conventions
are used.

Stereotypes

Stereotype Applies To

annotation Interface
Corresponds To: An annotation type.

default Operation
Corresponds To: The 'default' keyword.

enum Attributes within a Class stereotyped enumeration


Corresponds To: An enumerated option, distinguished from other attributes that
have no stereotype.

enumeration Class
Corresponds To: An enumerated type.

operator Operation
Corresponds To: An operator.

property get Operation


Corresponds To: A 'read' property.

property set Operation


Corresponds To: A 'write' property.

static Class or Interface


Corresponds To: The 'static' keyword.

Tagged Values

Tag Applies To

annotations Anything
Corresponds To: The annotations on the current code feature.

arguments Attribute with stereotype enum


Corresponds To: The arguments that apply to this enumerated value.

(c) Sparx Systems 2018 Page 177 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

attribute_name Operation with stereotype property get or property set


Corresponds To: The name of the variable behind this property.

dynamic Class or Interface


Corresponds To: The 'dynamic' keyword.

generic Operation
Corresponds To: The generic parameters to this operation.

parameterList Parameter
Corresponds To: A parameter list with the ... syntax.

throws Operation
Corresponds To: The exceptions that are thrown by this method.

transient Attribute
Corresponds To: The 'transient' keyword.

Other Conventions

· Package statements are generated when the current Package is not a namespace root
· The Const property of an attribute or operation corresponds to the final keyword
· The Transient property of an attribute corresponds to the volatile keyword
· The Fixed property of a parameter corresponds to the final keyword

(c) Sparx Systems 2018 Page 178 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

AspectJ Conventions
These are the conventions used for supporting AspectJ extensions to Java.

Stereotypes

Stereotype Applies To

advice Operation
Corresponds To: A piece of advice in an AspectJ aspect.

aspect Class
Corresponds To: An AspectJ aspect.

pointcut Operation
Corresponds To: A 'pointcut' in an AspectJ aspect.

Tagged Values

Tag Applies To

className Attribute or operation within a Class stereotyped aspect


Corresponds To: The Classes this AspectJ intertype member belongs to.

Other Conventions

· The specifications of a pointcut are included in the 'Behavior' field of the method

(c) Sparx Systems 2018 Page 179 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

PHP Conventions
Enterprise Architect supports the round trip engineering of PHP 4 and 5, where these conventions are used.

Stereotypes

Stereotype Applies To

trait Class
Corresponds To: A 'trait'.

property get Operation


Corresponds To: A 'read' property.

property set Operation


Corresponds To: A 'write' property.

Tagged Values

Tag Applies To

attribute_name Operation with stereotype property get or property set


Corresponds To: The name of the variable behind this property.

final Operations in PHP 5


Corresponds To: The 'final' keyword.

Common Conventions

· An unspecified type is modeled as var


· Methods returning a reference are generated by setting the Return Type to var*
· Reference parameters are generated from parameters with the parameter Kind set to inout or out

PHP 5 Conventions

· The final Class modifier corresponds to the Is Leaf property


· The abstract Class modifier corresponds to the Abstract property
· Parameter type hinting is supported by setting the Type of a parameter
· The value of inout or out for the Kind property of a parameter corresponds to a reference parameter

(c) Sparx Systems 2018 Page 180 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 181 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Python Conventions
Enterprise Architect supports the round trip engineering of Python, where these conventions are used.

Tagged Values

Tag Applies To

Decorators Class, Operation


Corresponds To: The decorators applied to this element in the source.

Other Conventions

· Model members with Private Scope correspond to code members with two leading underscores
· Attributes are only generated when the Initial value is not empty
· All types are reverse engineered as var

(c) Sparx Systems 2018 Page 182 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

SystemC Conventions
Enterprise Architect supports round-trip engineering of SystemC, where these conventions are used.

Stereotypes

Stereotype Applies To

delegate Method
Corresponds To: A delegate.

enumeration Inner Class


Corresponds To: An enum type.

friend Method
Corresponds To: A friend method.

property Method
Corresponds To: A property definition.

sc_ctor Method
Corresponds To: A SystemC constructor.

sc_module Class
Corresponds To: A SystemC module.

sc_port Attribute
Corresponds To: A port.

sc_signal Attribute
Corresponds To: A signal.

struct Inner Class


Corresponds To: A struct or union.

Tagged Values

Tag Applies To

kind Attribute (Port)


Corresponds To: Port kind (clocked, fifo, master, slave, resolved, vector).

mode Attribute (Port)


Corresponds To: Port mode (in, out, inout).

(c) Sparx Systems 2018 Page 183 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

overrides Method
Corresponds To: The Inheritance list of a method declaration.

throw Method
Corresponds To: The exception specification of a method.

Other Conventions

· SystemC also inherits most of the stereotypes and Tagged Values of C++

SystemC Toolbox Pages

To model a SystemC design, drag these icons onto a diagram from the 'SystemC Constructs' page of the Diagram
Toolbox.

Page Icon

SystemC Module
Action: Defines a SystemC Module.
An sc_module -stereotyped Class element.

SystemC Features Port


Action: Defines a SystemC Port.
An sc_port- stereotyped attribute.

Access

Ribbon
Design > Diagram > Toolbox : > Specify 'SystemC Constructs' in the 'Find
Toolbox Item' dialogs

Keyboard Shortcuts
Alt+5 : > Specify 'SystemC Constructs' in the 'Find Toolbox Item' dialog

Other You can display or hide the Diagram Toolbox by clicking on the or icons at
the left-hand end of the Caption Bar at the top of the Diagram View.

(c) Sparx Systems 2018 Page 184 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

VB.NET Conventions
Enterprise Architect supports round-trip engineering of Visual Basic.NET, where these conventions are used. Earlier
versions of Visual Basic are supported as a different language.

Stereotypes

Stereotype Applies To

event Operation
Corresponds To: An event declaration.

import Operation
Corresponds To: An operation to be imported from another library.

module Class
Corresponds To: A module.

operator Operation
Corresponds To: An operator overload definition.

partial Operation
Corresponds To: The 'partial' keyword on an operation.

property Operation
Corresponds To: A property possibly containing both read and write code.

Tagged Values

Tag Applies To

Alias Operation with stereotype import


Corresponds To: The alias for this imported operation.

attribute_name Operation with stereotype property


Corresponds To: The name of the variable behind this property.

Charset Operation with stereotype import


Corresponds To: The character set clause for this import - one of the values 'Ansi',
'Unicode' or 'Auto'.

delegate Operation
Corresponds To: The 'delegate' keyword.

(c) Sparx Systems 2018 Page 185 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

enumTag Operation with stereotype property


Corresponds To: The datatype that this property is represented as.

Handles Operation
Corresponds To: The 'handles' clause on this operation.

Implements Operation
Corresponds To: The 'implements' clause on this operation.

Lib Operation with stereotype import


Corresponds To: The library this import comes from.

MustOverride Operation
Corresponds To: The 'MustOverride' keyword.

Narrowing Operation with stereotype operator


Corresponds To: The 'Narrowing' keyword.

NotOverrideable Operation
Corresponds To: The 'NotOverrideable' keyword.

Overloads Operation
Corresponds To: The 'overloads' keyword.

Overrides Operation
Corresponds To: The 'overrides' keyword.

parameterArray Parameter
Corresponds To: A parameter list using the 'ParamArray' keyword.

partial Class, Interface


Corresponds To: The 'partial' keyword.

readonly Operation with stereotype property


Corresponds To: This property only defining 'read' code.

shadows Class, Interface, Operation


Corresponds To: The 'Shadows' keyword.

Shared Attribute
Corresponds To: The 'Shared' keyword.

Widening Operation with stereotype operator


Corresponds To: The 'Widening' keyword.

writeonly Operation with stereotype property


Corresponds To: This property only defining 'write' code.

(c) Sparx Systems 2018 Page 186 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Other Conventions

· Namespaces are generated for each Package below a namespace root


· The Is Leaf property of a Class corresponds to the NotInheritable keyword
· The Abstract property of a Class corresponds to the MustInherit keyword
· The Static property of an attribute or operation corresponds to the Shared keyword
· The Abstract property of an operation corresponds to the MustOverride keyword
· The value of in for the Kind property of a parameter corresponds to the ByVal keyword
· The value of inout or out for the Kind property of a parameter corresponds to the ByRef keyword

(c) Sparx Systems 2018 Page 187 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Verilog Conventions
Enterprise Architect supports round-trip engineering of Verilog, where these conventions are used.

Stereotypes

Stereotype Applies To

asynchronous Method
Corresponds To: A concurrent process.

enumeration Inner Class


Corresponds To: An enum type.

initializer Method
Corresponds To: An initializer process.

module Class
Corresponds To: A module.

part Attribute
Corresponds To: A component instantiation.

port Attribute
Corresponds To: A port.

synchronous Method
Corresponds To: A sequential process.

Tagged Values

Tag Applies To

kind Attribute (signal)


Corresponds To: The signal kind (such as register, bus).

mode Attribute (port)


Corresponds To: The port mode (in, out, inout).

Portmap Attribute (part)


Corresponds To: The generic / port map of the component instantiated.

sensitivity Method
Corresponds To: The sensitivity list of a sequential process.

(c) Sparx Systems 2018 Page 188 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

type Attribute
Corresponds To: The range or type value of an attribute.

Verilog Toolbox Pages

Access: 'Design > Diagram > Toolbox : 'Hamburger' icon > HDL | Verilog Constructs'
Drag these icons onto a diagram to model a Verilog design.

Item Action

Module Defines a Verilog Module. A module-stereotyped Class element.

Enumeration Defines an Enumerated Type. An enumeration element.

Port Defines a Verilog Port. A port-stereotyped attribute.

Part Defines a Verilog component instantiation. A part-stereotyped attribute.

Attribute Defines an attribute.

Procedure Defines a Verilog process:


· Concurrent - An asynchronous-stereotyped method
· Sequential - A synchronous-stereotyped method
· Initializer - An initializer-stereotyped method

(c) Sparx Systems 2018 Page 189 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

VHDL Conventions
Enterprise Architect supports round-trip engineering of VHDL, where these conventions are used.

Stereotypes

Stereotype Applies To

architecture Class
Corresponds To: An architecture.

asynchronous Method
Corresponds To: An asynchronous process.

configuration Method
Corresponds To: A configuration.

enumeration Inner Class


Corresponds To: An enumerated type.

entity Interface
Corresponds To: An entity.

part Attribute
Corresponds To: A component instantiation.

port Attribute
Corresponds To: A port.

signal Attribute
Corresponds To: A signal declaration.

struct Inner Class


Corresponds To: A record definition.

synchronous Method
Corresponds To: A synchronous process.

typedef Inner Class


Corresponds To: A type or subtype definition.

Tagged Values

Tag Applies To

(c) Sparx Systems 2018 Page 190 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

isGeneric Attribute (port)


Corresponds To: The 'port' declaration in a generic interface.

isSubType Inner Class (typedef)


Corresponds To: A subtype definition.

kind Attribute (signal)


Corresponds To: The signal kind (such as 'register', 'bus').

mode Attribute (port)


Corresponds To: The port mode ('in', 'out', 'inout', 'buffer', 'linkage').

portmap Attribute (part)


Corresponds To: The generic / port map of the component instantiated.

sensitivity Method (synchronous)


Corresponds To: The 'sensitivity' list of a synchronous process.

type Inner Class (typedef)


Corresponds To: The 'type' indication of a 'type' declaration.

typeNameSpace Attribute (part)


Corresponds To: The 'type' namespace of the instantiated component.

VHDL Toolbox Pages

Access

To model a VHDL design, drag icons from the VHDL toolbox pages and drop them on your diagram.

Ribbon
Design > Diagram > Toolbox : > Specify 'VHDL Constructs' in the 'Find
Toolbox Item' dialog

Keyboard Shortcuts
Alt+5 : > Specify 'VHDL Constructs' in the 'Find Toolbox Item' dialog

Other You can display or hide the Diagram Toolbox by clicking on the or icons at
the left-hand end of the Caption Bar at the top of the Diagram View.

VHDL Toolbox Page

(c) Sparx Systems 2018 Page 191 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Item Action

Architecture Defines an architecture to be associated with a VHDL entity.


An architecture-stereotyped Class element.

Entity Defines a VHDL entity to contain the Port definitions.


An entity-stereotyped interface element.

Enumeration Defines an Enumerated Type.


An Enumeration element.

Struct Defines a VHDL record.


A struct-stereotyped Class element.

Typedef Defines a VHDL type or subtype.


A typedef-stereotyped Class element.

VHDL Features Toolbox Page

Item Action

Part Defines a VHDL component instantiation.


A part-stereotyped attribute.

Port Defines a VHDL Port.


A port-stereotyped attribute.

Signal Defines a VHDL signal.


A signal-stereotyped attribute.

Procedure Defines a VHDL process:


· Concurrent - An asynchronous-stereotyped method
· Sequential - A synchronous-stereotyped method
· Configuration - An configuration-stereotyped method

(c) Sparx Systems 2018 Page 192 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Visual Basic Conventions


Enterprise Architect supports the round trip engineering of Visual Basic 5 and 6, where these conventions are used.
Visual Basic .NET is supported as a different language.

Stereotypes

Stereotype Applies To

global Attribute
Corresponds To: The 'Global' keyword.

import Operation
Corresponds To: An operation to be imported from another library.

property get Operation


Corresponds To: A property 'get'.

property set Operation


Corresponds To: A property 'set'.

property let Operation


Corresponds To: A property 'let'.

with events Attribute


Corresponds To: The 'WithEvents' keyword.

Tagged Values

Tag Applies To

Alias Operation with stereotype import


Corresponds To: The alias for this imported operation.

attribute_name Operation with stereotype property get, property set or property let
Corresponds To: The name of the variable behind this property.

Lib Operation with stereotype import


Corresponds To: The library this import comes from.

New Attribute
Corresponds To: The 'new' keyword.

(c) Sparx Systems 2018 Page 193 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Other Conventions

· The value of in for the Kind property of a parameter corresponds to the ByVal keyword
· The value of inout or out for the Kind property of a parameter corresponds to the ByRef keyword

(c) Sparx Systems 2018 Page 194 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Language Options
You can set up various options for how Enterprise Architect handles a particular language when generating and
reverse-engineering code. These options are either specific to:
· Your user ID, for all models or
· The model in which they are defined, for all users

Access

Ribbon Start > View > Preferences > Source Code Engineering > <language name>
Configure > Model > Options > Source Code Engineering > <language name>

Keyboard Shortcuts Ctrl+F9 ('Preferences' dialog)

Languages Supported

Language

Action Script

Ada 2012 (in the Unified and Ultimate editions of Enterprise Architect)

ArcGIS

ANSI C

C#

C++

Delphi

Java

PHP

Python

SystemC

Verilog (Unified and Ultimate editions)

VHDL (Unified and Ultimate editions)

Visual Basic

(c) Sparx Systems 2018 Page 195 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Visual Basic .NET

(c) Sparx Systems 2018 Page 196 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

ActionScript Options - User


If you intend to generate ActionScript code from your model, you can configure the code generation options using the
'ActionScript Specifications' page of the 'Preferences' dialog to:
· Specify the default source directory
· Specify the editor for ActionScript code

Access

Ribbon Start > View > Preferences > Source Code Engineering > ActionScript

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support ActionScript code generation.
Select this checkbox to disable ActionScript code support.

Options for the current user


In the 'Default Source Directory' and 'Editor' fields, click on the button and
browse for the source directory and external file editor that you will use.

Notes

· These options apply to all models that you access

(c) Sparx Systems 2018 Page 197 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

ActionScript Options - Model


If you intend to generate ActionScript code from your model, you can configure the model-specific code generation
options using the 'ActionScript Specifications' page of the 'Manage Project Options' dialog to:
· Specify default ActionScript version to generate (AS2.0 or AS3.0)
· Specify default file extensions
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > ActionScript

Options

Option Action

Options for the current Type in the default ActionScript version and default file extension to apply when
model generating ActionScript source code.

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 198 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Ada 2012 Options - User


If you intend to generate Ada 2012 code from your model, you can configure the code generation options using the 'Ada'
page of the 'Preferences' dialog to:
· Inform the reverse engineering process whether the name of the Tagged Record is the same as the Package name
· Advise the engine of the alternate Tagged Record name to locate
· Specify whether the engine should create a reference type for the Tagged Record (if one is not defined)
· Supply the name of the reference type to be created (default is Ref)
· Specify the reference parameter of a Reference / Access type
· Tell the engine to ignore the name of the reference parameter
· Indicate the name of the reference parameter to locate

Access

Ribbon Start > View > Preferences > Source Code Engineering > Ada

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support Ada 2012 code generation.
Select this checkbox to disable Ada 2012 code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

Notes

· Ada 2012 support is available in the Unified and Ultimate editions of Enterprise Architect

(c) Sparx Systems 2018 Page 199 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Ada 2012 Options - Model


If you intend to generate Ada 2012 code from your model, you can configure the model-specific code generation options
using the 'Ada' page of the 'Manage Project Options' dialog to:
· Specify the default file extension and
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > Ada

Options

Option Action

Options for the current Type in the default file extension to apply when generating Ada source code.
model

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models
· Ada 2012 support is available in the Unified and Ultimate editions of Enterprise Architect

(c) Sparx Systems 2018 Page 200 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

ArcGIS Options - User


If you intend to generate ArcGIS code from your model, you can configure the code generation options using the
'ArcGIS' page of the 'Preferences' dialog to:
· Specify default source directory
· Specify the editor for ArcGIS code
ArcGIS must be enabled in the 'MDG Technologies' dialog ('Specialize > Technologies > Manage') in order for the
'ArcGIS' page to be available.

Access

Ribbon Start > View > Preferences > Source Code Engineering > ArcGIS

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support ArcGIS code generation.
Select this checkbox to disable ArcGIS code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 201 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

ArcGIS Options - Model


If you intend to generate ArcGIS code from your model, you can configure the model-specific code generation options
using the 'ArcGIS' page of the 'Manage Project Options' dialog to:
· Specify default file extensions
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > ArcGIS

Options

Option Action

Options for the current Type in the default file extension to apply when generating ArcGIS source code.
model

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 202 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C Options - User
If you intend to generate C code from your model, you can configure the code generation options using the 'C
Specifications' page of the 'Preferences' dialog.

Access

Ribbon Start > View > Preferences > Source Code Engineering > C

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support C code generation.


Select this option to disable C code support.

Options for the current user In the value fields, specify the options that apply under your own user ID in all
models that you access:
· The default attribute type to create (fixed as int)
· Whether a #define constant is imported as an attribute in imported C code (if
'Object Oriented programming' is set to True on the 'C Specifications' page of
the 'Manage Project Options' dialog)
· Whether to generate comments for C methods to the declaration, and to reverse
engineer comments from the declaration
· Whether to generate comments for C methods to the implementation, and to
reverse engineer comments from the implementation
· Whether to update comments in regenerating code from the model
· Whether to update the implementation file in re-generating code from the
model

· The default source code directory location (click on the button)


· The default file extensions to read when importing a directory of C code

· The Code Editor to use (click on the button)


· The search path for the implementation file relative to the header file path

(c) Sparx Systems 2018 Page 203 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C Options - Model
If you intend to generate C code from your model, you can configure the model-specific code generation options using
the 'C Specifications' page of the 'Manage Project Options' dialog to:
· Specify default file extensions (header and source)
· Define support for Object Oriented programming
· Set the StateMachine engineering options
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > C

Options

Option Action

Options for the current In the value fields, specify these options:
model · The default header and source file extensions for the code files
· Support for Object Oriented programming; if this is True, then set:
- The Namespace delimiter character
- Whether the first parameter of an operation is a Class reference
- The parameter reference style in generated C code
- The reference parameter name in generated code
- The default Constructor name in generated code
- The default Destructor name in generated code

StateMachine Engineering In the value fields, use the drop-down arrows to set the options to True or False;
these options apply to generating code from StateMachine models in the current
model only:
· 'Use the new StateMachine Template' - set to True to use the code generation
templates from Enterprise Architect Release 11 and later, set to False to apply
the EASL Legacy templates
· Generate Trace Code - set to True to generate Trace code, False to omit it

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 204 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 205 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C# Options - User
If you intend to generate C# code from your model, you can configure the code generation options using the 'C#
Specifications' page of the 'Preferences' dialog

Access

Ribbon Start > View > Preferences > Source Code Engineering > C#

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support C# code generation.


Select this checkbox to disable C# code support.

Options for the current user In the value fields, specify the options that apply under your own user ID in all
models that you access:
· The default attribute type to create
· Whether Namespaces should be generated when generating C# Classes
· Whether to remove new lines (hard carriage returns) from the summary tag
when importing XML.NET style comments
· Whether to generate a Finalizer method when generating code for a C# Class
· Whether to generate a Dispose method when generating code for a C# Class

· The default source code directory location (click on the button)

· The Code Editor to use (click on the button)

(c) Sparx Systems 2018 Page 206 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C# Options - Model
If you intend to generate C# code from your model, you can configure the model-specific code generation options using
the 'C# Specifications' page of the 'Manage Project Options' dialog to:
· Specify the default file extension
· Indicate additional Collection Classes - to define custom Collection Classes, which can be simple substitutions (such
as CArray<#TYPE#>) or a mix of other strings and substitutions (such as
Cmap<CString,LPCTSTR,#TYPE#*,#TYPE#*>); these Collection Classes are defined by default:
- List<#TYPE#>;Stack<#TYPE#>;Queue<#TYPE#>;
· Set the StateMachine Engineering options
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > C#

Options

Option Action

Options for the current Type in the default file extension to apply when generating C# source code, and a
model list of any additional Collection Classes you want to define.

StateMachine Engineering In the value fields, use the drop-down arrows to set the options to True or False;
these options apply to generating code from StateMachine models in the current
model only:
· 'Use the new StateMachine Template' - set to True to use the code generation
templates from Enterprise Architect Release 11 and later, set to False to apply
the EASL Legacy templates
· 'Generate Trace Code' - set to True to generate Trace code, False to omit it

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 207 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C++ Options - User


If you intend to generate C++ code from your model, you can configure the code generation options using the 'C++
Specifications' page of the 'Preferences' dialog.

Access

Ribbon Start > View > Preferences > Source Code Engineering > C++

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support C++ code generation.
Select this option to disable C++ code support.

Options for the current user In the value fields, specify the options that apply under your own user ID in all
models that you access:
· The default attribute type to create
· Whether Namespaces should be generated when generating C++ Classes
· What style to apply when generating and processing comments for C++
· Whether to generate comments for C++ methods to the declaration, or reverse
engineer comments from the declaration
· Whether to generate comments for C++ methods to the implementation, or
reverse engineer comments from the implementation
· Whether to update comments in re-generating code from the model
· Whether to update the implementation file in re-generating code from the
model

· The default source code directory location (click on the button)


· The default file extensions to read when importing a directory of C++ code

· The Code Editor to use (click on the button)


· The search path for the implementation file relative to the header file path

(c) Sparx Systems 2018 Page 208 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

C++ Options - Model


If you intend to generate C++ code from your model, you can configure the model-specific code generation options using
the 'C++ Specifications' page of the 'Manage Project Options' dialog to:
· Indicate the version of C++ to generate; this controls the set of templates used and how properties are created
· Specify the default reference type used when a type is specified by reference
· Specify the default file extensions
· Specify default Get/Set prefixes
· Specify the Collection Class definitions for Association connectors
· Define additional Collection Classes - to define custom Collection Classes, which can be simple substitutions (such
as CArray<#TYPE#>) or a mix of other strings and substitutions (such as
Cmap<CString,LPCTSTR,#TYPE#*,#TYPE#*>); these Collection Classes are defined by default:
- CArray<#TYPE#>;CMap<CString,LPCTSTR,#TYPE#*,#TYPE#*>;
· Set the StateMachine Engineering options

Access

Ribbon Configure > Model > Options > Source Code Engineering > C++

Options

Option Action

Options for the current In the value fields, specify the options that affect all users of the current model:
model · The version of C++ you are using (which determines which templates to use
when generating code)
· The default reference type to use when creating properties for C++ attributes
by reference
· The default header and source file extensions for the code files
· The default 'Get' prefix
· The default 'Set' prefix
· The additional Collection Classes

StateMachine Engineering In the value fields, use the drop-down arrows to set the options to True or False;
Options these options apply to generating code from StateMachine models in the current
model only:
· 'Use the new StateMachine Template' - set to True to use the code generation
templates from Enterprise Architect Release 11 and later, set to False to apply
the EASL Legacy templates
· 'Generate Trace Code' - set to True to generate Trace code, False to omit it

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

(c) Sparx Systems 2018 Page 209 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 210 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Delphi Options - User


If you intend to generate Delphi code from your model, you can configure the code generation options using the 'Delphi
Specifications' page of the 'Preferences' dialog to:
· Set the default attribute type
· Indicate a default source directory
· Set the default code editor to use to edit Delphi source code

Access

Ribbon Start > View > Preferences > Source Code Engineering > Delphi

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support Delphi code generation.
Select this option to disable Delphi code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 211 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Delphi Options - Model


If you intend to generate Delphi code from your model, you can configure the model-specific code generation options
using the 'Delphi Specifications' page of the 'Manage Project Options' dialog to:
· Specify default file extensions (header and source)
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > Delphi

Options

Option Action

Options for the current Type in the default file extension to apply when generating Delphi source code.
model

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 212 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Delphi Properties
Enterprise Architect has comprehensive support for Delphi properties. These are implemented as Tagged Values, with a
specialized property editor to help create and modify Class properties. By using the 'Feature Visibility' element context
menu option, you can display the 'tags' compartment that contains the properties. Imported Delphi Classes with
properties have this feature automatically made visible for your convenience.

Manually activate the property editor

· In the selected Class set the code generation language to 'Delphi'


· Right-click on the Class and select 'Delphi Properties' to open the editor
Using the Delphi Properties editor, you can build properties quickly and simply; from here you can:
· Change the name and scope (only Public and Published are currently supported)
· Change the property type (the drop-down list includes all defined Classes in the project)
· Set the Read and Write information (the drop-down lists have all the attributes and operations from the current
Class; you can also enter free text)
· Set 'Stored' to True or False
· Set the Implements information
· Set the default value, if one exists

Notes

· When you use the 'Create Property' dialog from the 'Attribute' screen, the system generates a pair of Get and Set
functions together with the required property definition as Tagged Values; you can manually edit these Tagged
Values if required
· Public properties are displayed with a '+' symbol prefix and published with a '^'
· When creating a property in the 'Create Property Implementation' dialog (accessed through the 'Attributes' dialog),
you can set the scope to 'Published' if the property type is Delphi
· Only 'Public' and 'Published' are supported
· If you change the name of a property and forward engineer, a new property is added, but you must manually delete
the old one from the source file

(c) Sparx Systems 2018 Page 213 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Java Options - User


If you intend to generate Java code from your model, you can configure the code generation options using the 'Java
Specifications' page of the 'Preferences' dialog.

Access

Ribbon Start > View > Preferences > Source Code Engineering > Java

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support Java code generation.
Select this checkbox to disable Java code support.

Options for the current user In the value fields, specify the options that apply under your own user ID in all
models that you access; the:
· Default attribute type to create (select from the drop-down list)

· Default source code directory location (click on the button)

· Code Editor to use (click on the button)

(c) Sparx Systems 2018 Page 214 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Java Options - Model


If you intend to generate Java code from your model, you can configure the model-specific code generation options using
the 'Java Specifications' page of the 'Manage Project Options' dialog to:
· Specify the default file extension
· Specify a default 'Get' prefix
· Specify a default 'Set' prefix
· Set the StateMachine Engineering options
· Specify the Collection Class definitions for Association connectors
· Define additional Collection Classes - to define custom Collection Classes, which can be simple substitutions (such
as CArray<#TYPE#>) or a mix of other strings and substitutions (such as
Cmap<CString,LPCTSTR,#TYPE#*,#TYPE#*>); these Collection Classes are defined by default:
- HashSet<#TYPE#>;Map<String,#TYPE#>;

Access

Ribbon Configure > Model > Options > Source Code Engineering > Java

Options

Option Action

Options for the current In the value fields, specify the options that affect all users of the current model; the:
model · Default file extension for the code files
· The default Get and Set prefixes
· The default and additional Collection Classes

StateMachine Engineering In the value fields, use the drop-down arrows to set the options to True or False;
these options apply to generating code from StateMachine models in the current
model only:
· 'Use the new StateMachine Template' - set to True to use the code generation
templates from Enterprise Architect Release 11 and later, set to False to apply
the EASL Legacy templates
· 'Generate Trace Code' - set to True to generate Trace code, False to omit it

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 215 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 216 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

PHP Options - User


If you intend to generate PHP code from your model, you can configure the code generation options using the 'PHP
Specifications' page of the 'Preferences' dialog to:
· Define a semi-colon separated list of extensions to look at when doing a directory code import for PHP
· Set a default directory for opening and saving PHP source code
· Specify the default editor to use when editing PHP code

Access

Ribbon Start > View > Preferences > Source Code Engineering > PHP

Keyboard Shortcuts Ctrl+F9 | Source Code Engineering | PHP

Options

Option Action

Disable Language Leave this checkbox unselected to support PHP code generation.
Select this option to disable PHP code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 217 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

PHP Options - Model


If you intend to generate PHP code from your model, you can configure the model-specific code generation options
using the 'PHP Specifications' page of the 'Manage Project Options' dialog to:
· Specify the default PHP version to generate
· Define the default file extension
· Specify a default 'Get' prefix
· Specify a default 'Set' prefix

Access

Ribbon Configure > Model > Options > Source Code Engineering > PHP

Options

Option Action

Options for the current Type in the default PHP version, the default file extension to apply when generating
model PHP source code, and the default 'Get' and 'Set' prefixes.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 218 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Python Options - User


If you intend to generate Python code from your model, you can configure the code generation options using the 'Python
Specifications' page of the 'Preferences' dialog to:
· Specify the default source directory to be used
· Specify the default editor used to write and edit Python code

Access

Ribbon Start > View > Preferences > Source Code Engineering > Python

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support Python code generation.
Select this option to disable Python code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 219 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Python Options - Model


If you intend to generate Python code from your model, you can configure the model-specific code generation options
using the 'Python Specifications' page of the 'Manage Project Options' dialog to:
· Specify the default file extension

Access

Ribbon Configure > Model > Options > Source Code Engineering > Python

Options

Option Action

Options for the current Type in the default file extension to apply when generating Python source code.
model

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 220 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

SystemC Options - User


If you intend to generate SystemC code from your model, you can configure the code generation options using the
'SystemC' page of the 'Preferences' dialog to:
· Specify a default source directory
· Specify an editor for changing code

Access

Ribbon Start > View > Preferences > Source Code Engineering > SystemC

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support SystemC code generation.
Select this option to disable SystemC code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 221 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

SystemC Options - Model


If you intend to generate SystemC code from your model, you can configure the model-specific code generation options
using the 'SystemC' page of the 'Manage Project Options' dialog to:
· Specify the default file extension
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > SystemC

Options

Option Action

Options for the current Type in the default file extension to apply when generating SystemC source code.
model

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 222 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

VB.NET Options - User


If you intend to generate VB.NET code from your model, you can configure the code generation options using the
'VB.NET Specifications' page of the 'Preferences' dialog to:
· Specify the default attribute type
· Indicate whether to generate namespaces
· Specify a default source directory
· Specify an editor for changing code

Access

Ribbon Start > View > Preferences > Source Code Engineering > VB.Net

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support VB.NET code generation.
Select this option to disable VB.NET code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 223 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

VB.NET Options - Model


If you intend to generate VB.NET code from your model, you can configure the model-specific code generation options
using the 'VB.Net Specifications' page of the 'Manage Project Options' dialog to:
· Specify the default file extension
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > VB.Net

Options

Option Action

Options for the current Type in the default file extension to apply when generating VB.Net source code.
model

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 224 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Verilog Options - User


If you intend to generate Verilog code from your model, you can configure the code generation options using the
'Verilog' page of the 'Preferences' dialog to:
· Specify a default source directory
· Specify an editor for changing code

Access

Ribbon Start > View > Preferences > Source Code Engineering > Verilog

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support Verilog code generation.
Select this option to disable Verilog code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 225 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Verilog Options - Model


If you intend to generate Verilog code from your model, you can configure the model-specific code generation options
using the 'Verilog' page of the 'Manage Project Options' dialog to:
· Specify the default file extension
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > Verilog

Options

Option Action

Options for the current Type in the default file extension to apply when generating Verilog source code.
model

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 226 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

VHDL Options - User


If you intend to generate VHDL code from your model, you can configure the code generation options using the 'VHDL'
page of the 'Preferences' dialog to:
· Specify a default source directory
· Specify an editor for changing code

Access

Ribbon Start > View > Preferences > Source Code Engineering > VHDL

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support VHDL code generation.
Select this option to disable VHDL code support.

Options for the current user Specifies the options used for the current user; these options apply to all models
that are accessed by the user.

(c) Sparx Systems 2018 Page 227 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

VHDL Options - Model


If you intend to generate VHDL code from your model, you can configure the model-specific code generation options
using the 'VHDL' page of the 'Manage Project Options' dialog to:
· Specify the default file extension
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > VHDL

Options

Option Action

Options for the current Type in the default file extension to apply when generating VHDL source code.
model

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 228 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Visual Basic Options - User


If you intend to generate Visual Basic code from your model, you can configure the code generation options using the
'VB Specifications' page of the 'Preferences' dialog to:
· Specify the default attribute type
· Define the default source directory
· Define the file extensions to search for code files to import
· Define the default editor to use for editing source code

Access

Ribbon Start > View > Preferences > Source Code Engineering > Visual Basic

Keyboard Shortcuts Ctrl+F9

Options

Option Action

Disable Language Leave this checkbox unselected to support Visual Basic code generation.
Select this option to disable Visual Basic code support.

Options for the current user Specifies the options used for the current use; these options apply to all models that
are accessed by the user.

(c) Sparx Systems 2018 Page 229 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Visual Basic Options - Model


If you intend to generate Visual Basic code from your model, you can configure the model-specific code generation
options using the 'VB Specifications' page of the 'Manage Project Options' dialog to:
· Specify the default Visual Basic version to generate
· Indicate the default file extension when reading/writing
· Indicate the MTS transaction mode for MTS objects
· Specify if a Class uses Multi use (True or False)
· Specify if a Class uses the Persistable property
· Indicate data binding and data source behaviors
· Set the global namespace
· Set the Exposed attribute
· Indicate if the Creatable attribute is True or False
· Specify the Collection Class definitions for Association connectors

Access

Ribbon Configure > Model > Options > Source Code Engineering > Visual Basic

Options

Option Action

Options for the current Type in the default file extension to apply when generating Visual Basic source
model code, and click on the drop-down arrow in each of the other fields and select the
appropriate value.

Collection Classes Click on this button to open the 'Collection Classes for Association Roles' dialog,
through which you specify the Collection Class definitions for Association
connectors.

Notes

· These options affect all users of the current model; however, they do not apply to other models

(c) Sparx Systems 2018 Page 230 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

MDG Technology Language Options


If you have loaded an MDG Technology that specifies a code module into your Sparx Systems > EA > MDG
Technologies folder, the language is included in the 'Source Code Engineering' list on the 'Preferences' dialog. The
language is only listed on the 'Preferences' dialog if an MDG Technology file actually uses it in your model.

Access

Ribbon Start > View > Preferences > Source Code Engineering > MDG

Keyboard Shortcuts Ctrl+F9

Options

Field Action

Default Extension Default extension for generated source files; shown if the option is in the
technology.
This is saved per project.

Import File Extensions Default folder to import source files from; shown if the technology supports
namespaces.
This is saved once for all projects.

Generate Namespaces Indicates if namespaces are generated or not.

Default Source Directory The default directory to save generated source files.
This is always shown.

Editor Indicates the editor that is used to edit source files.

Att Type Indicates the default attribute type.

Notes

· These options are set in the technology inside the <CodeOptions> tag of a code module, as shown:
<CodeOption name="DefaultExtension">.rb</CodeOption>

(c) Sparx Systems 2018 Page 231 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Reset Options
Enterprise Architect stores some of the options for a Class when it is first created. Some are global; for example,
$LinkClass is stored when you first create the Class, so in existing Classes the global change in the 'Preferences' dialog
will not automatically be picked up. You must modify the options for the existing Class.

Modify options for a single Class

Step Action

1 Click on the Class to change, and select the 'Code > Code Engineering > Generate > Generate Single
Element' ribbon option.
The 'Generate Code' dialog displays.

2 Click on the Advanced button.


The 'Object Options' dialog displays.

3 Click on the 'Attributes/Operations' option.

4 Change the options, and click on the Close button to apply the changes.

Modify options for all Classes within a Package

Step Action

1 Click on the Package in the Project Browser, and select the 'Code > Configure > Options > Reset Source
Language' ribbon option.
The 'Manage Code Generation' dialog displays.

2 In the 'Where language is:' field, click on the drop-down arrow and select the language that you want to
change from.

3 In the 'Convert to:' field, click on the drop-down arrow and select the language that you want to change to.

4 Select the checkbox against each option to apply to the changed Class elements in the Package:
· Clear Filenames of the files to generate code to
· Reset Default options on each Class
· Process Child Packages under the selected Package

5 Click on the OK button to apply the changes.

(c) Sparx Systems 2018 Page 232 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Set Collection Classes


Using Enterprise Architect, you can define Collection Classes for generating code from Association connectors where
the target role has a multiplicity setting greater than 1.

Tasks

Task Detail

Defining Collection On the 'Source Code Engineering' section of the 'Manage Project Options' dialog
Classes (select the 'Configure > Model > Options > Source Code Engineering' ribbon
option), on each language page click on the Collection Classes button.
The 'Collection Classes for Association Roles' dialog displays. On this dialog, you
can define:
· The default Collection Class for 1..* roles
· The ordered Collection Class to use for 1..* roles
· The qualified Collection Class to use for 1..* roles

Defining Collection Class-specific Collection Classes can be defined by clicking the Collection Classes
Classes for a specific Class button in the Class 'Properties' dialog of the element.

Code Generation When Enterprise Architect generates code for a connector that has a multiplicity
Precedence role >1:
1. If the Qualifier is set, use the qualified collection:
- for the Class if set
- else use the code language qualified collection
2. If the 'Order' option is set, use the ordered collection:
- for the Class if set
- else use the code language ordered collection
3. Else use the default collection:
- for the Class if set
- else use the code language default collection

Using Markers You can include the marker #TYPE# in the collection name; Enterprise Architect
replaces this with the name of the Class being collected at source generation time
(for example, Vector<#TYPE#> would become Vector<foo>).
Conversely, when reverse engineering, an Association connector is also created if a
matching entry (for example, foo if foo is found in the model) is defined as a
Collection Class.

Additional Collection Additional Collection Classes can be defined within the model-specific language
Classes options pages for C#, C++ and Java.

Member Type On the 'Role(s)' tab of the Association 'Properties' dialog (accessible from the
right-click context menu of any Association) there is a 'Member Type' field for each
of the Source and Target Roles.
If you set this, the value you enter overrides all the listed options.

(c) Sparx Systems 2018 Page 233 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 234 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Example Use of Collection Classes


Consider this source code:

class Class1
{
public:
Class1();
virtual ~Class1();
CMap<CString,LPCTSTR,Class3*,Class3*> att;
Vector<Class2> *att1;
TemplatedClass<class1,class2> *att2;
CList<Class4> *att3;
};
class Class2
{
public:
Class2();
virtual ~Class2();
};
class Class3
{
public:
Class3();
virtual ~Class3();
};
class Class4
{
public:
Class4();
virtual ~Class4();
};
template<class TParam1, class TParam2>
class TemplatedClass
{
public:
TemplatedClass() {
}
virtual ~TemplatedClass() {
}
};

(c) Sparx Systems 2018 Page 235 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

If this code is imported into the system with default import options, this diagram is generated:

If, however, you enter the value 'CList<#Type#>' in the 'Additional Collection Classes' field in the model-specific
language options page (C#, Java, C++), an Association connector is also created to Class 4:

(c) Sparx Systems 2018 Page 236 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 237 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Local Paths
When a team of developers are working on the same Enterprise Architect model, each developer might store their
version of the source code in their local file system, but not always at the same location as their fellow developers. To
manage this scenario in Enterprise Architect, you can define local paths for each user, on the 'Local Paths' dialog.
You can use local paths in generating code and reverse engineering, and in Version Control, developing XML schemas
and generating document and web reports.
Local paths might take a little time to set up, but if you want to work collaboratively on source and model concurrently,
the effort is well worth while.
For example, if:
· Developer A stores her .java files in a C:\Java\Source directory, while developer B stores his in D:\Source, and
· Both developers want to generate and reverse engineer into the same Enterprise Architect model located on a shared
(or replicated) network drive
Developer A might define a local path of:
JAVA_SOURCE = "C:\Java\Source"
All Classes generated and stored in the Enterprise Architect project are stored as:
%JAVA_SOURCE%\<xxx.java>
Developer B defines a local path as:
JAVA_SOURCE ="D:\Source"
Now, Enterprise Architect stores all java files in these directories as:
%JAVA_SOURCE%\<filename>
On each developer's machine, the filename is expanded to the correct local version.

Access

Ribbon Code > Configure > Options > Configure Local Paths

(c) Sparx Systems 2018 Page 238 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Local Paths Dialog


Using the 'Local Paths' dialog, you can set up local paths for a single user on a particular machine. For a description of
the use of local paths, see the Local Paths topic.

Access

Ribbon Code > Configure > Options > Configure Local Paths

Options

Option Action

Path Type in or browser for the path of the local directory in the file system (for
example, d:\java\source).

ID Type in the shared ID that is substituted for the Local Path (for example,
JAVA_SRC).

Type Click on the drop-down arrow and select the type of path to apply to (for example,
Java).

Relative Paths Lists the paths currently defined for the model, defaulting to most recent at the top.
If you want to change the sequence of paths in the list, click on a path and use the
buttons to move the path up or down one position in the list.

Apply Path Click on a path in the 'Relative Paths' list and click on this button to update any
existing full path names in the model to the shared relative path name. For example:
d:\java\source\main.java might become %JAVA_SRC%\main.java

Expand Path Click on a path in the 'Relative Paths' list and click on this button to remove the
relative path and substitute the full path name (the opposite effect of the Apply Path
button).

New Click on this button to clear the data fields so that you can define another local
path.

Save When you have defined a local path, click on this button to save it and add it to the
'Relative Paths' list.

Delete Click on a path in the 'Relative Paths' list and click on this button to remove the
path from the list altogether.

Close Click on this button to close the dialog, saving any changes to the list.

(c) Sparx Systems 2018 Page 239 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes

· You can also set up a hyperlink (for an Enterprise Architect command) on a diagram to access the 'Local Paths'
dialog, to switch, update or expand your current local path
· If the act of expanding or applying a path for a linked file will create a duplicate record, the process will skip that
record and display a message at the end of the process

(c) Sparx Systems 2018 Page 240 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Language Macros
When reverse engineering a language such as C++, you might find preprocessor directives scattered throughout the code.
This can make code management easier, but can hamper parsing of the underlying C++ language.
To help remedy this, you can include any number of macro definitions, which are ignored during the parsing phase of the
reverse engineering. It is still preferable, if you have the facility, to preprocess the code using the appropriate compiler
first; this way, complex macro definitions and defines are expanded out and can be readily parsed. If you don't have this
facility, then this option provides a convenient substitute.

Access

Ribbon Configure > Reference Data > Settings > Preprocessor Macros or
Code > Configure > Options > Define Preprocessor Macros

Define a macro

Step Action

1 Select the 'Preprocessor Macros' menu option.


The 'Language Macros' dialog displays.

2 Click on the Add New button.

3 Enter details for your macro.

4 Click on the OK button.

Macros Embedded Within Declarations

Macros are sometimes used within the declaration of Classes and operations, as in these examples:
class __declspec Foo
{
int __declspec Bar(int p);
};
If declspec is defined as a C++ macro, as outlined, the imported Class and operation contain a Tagged Value called
DeclMacro1 with value __declspec (subsequent macros would be defined as DeclMacro2, DeclMacro3 and so on).
During forward engineering, these Tagged Values are used to regenerate the macros in code.

Define Complex Macros

(c) Sparx Systems 2018 Page 241 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

It is sometimes useful to define rules for complex macros that can span multiple lines; Enterprise Architect ignores the
entire code section defined by the rule.
Such macros can be defined in Enterprise Architect as in these two examples; both types can be combined in one
definition.
Block Macros
BEGIN_INTERFACE_PART ^ END_INTERFACE_PART
The ^ symbol represents the body of the macro - this enables skipping from one macro to another; the spaces surrounding
the ^ symbol are required.

Function Macros
RTTI_EMULATION()
Enterprise Architect skips over the token including everything inside the parentheses.

Notes

· You can transport these language macro (or preprocessor macro) definitions between models, using the 'Configure >
Model > Transfer > Export Reference Data' and 'Import Reference Data' options; the macros are exported as a Macro
List

(c) Sparx Systems 2018 Page 242 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

ICONIX
The ICONIX process is a proprietary software development methodology based on UML. The process is Use Case
driven and uses UML based diagrams to define four milestones. The main feature of the process is a concept called
robustness modeling, based on the early work of Ivar Jacobson, which helps bridge the gap between analysis and design.
This text is derived from the ICONIX entry in the online Wikipedia:
'The ICONIX Process is a minimalist, streamlined approach to Use Case driven UML modeling that uses a core subset of
UML diagrams and techniques to provide thorough coverage of object-oriented analysis and design. Its main activity is
robustness analysis, a method for bridging the gap between analysis and design. Robustness analysis reduces the
ambiguity in use case descriptions, by ensuring that they are written in the context of an accompanying domain model.
This process makes the use cases much easier to design, test and estimate.'
The ICONIX Process was developed by Doug Rosenberg; for more information on ICONIX, refer to ICONIX Software
Engineering Inc.

Aspects

Aspect Detail

ICONIX in Enterprise Enterprise Architect enables you to develop models under ICONIX quickly and
Architect simply, through use of an MDG Technology integrated with the Enterprise
Architect installer.
The ICONIX facilities are provided in the form of:
· A set of ICONIX pages in the Toolbox
· ICONIX element and relationship entries in the Toolbox Shortcut Menu and
Quick Linker

To further help you develop and manage a project under ICONIX, Enterprise
Architect also provides a white paper on the ICONIX Roadmap.
In addition, Enterprise Architect has an alternative visual layout specific to
ICONIX.

ICONIX Toolbox Pages Within the Toolbox, Enterprise Architect provides ICONIX versions of the pages
for UML Analysis, Use Case, Class, Interaction (Sequence), Activity and Custom
diagrams (which often form the basis for Robustness diagrams).
Compared to the standard Toolbox pages, these have slightly different element and
relationship sets; you can access them by either:
· Specifying the ICONIX Diagram Type in the 'Dind Toolbox Item' dialog for a
specific Toolbox page
· Selecting the 'ICONIX' option in the drop-down field of the Default Tools
toolbar, which adds all six pages to the Toolbox; the first page and the
'Common' page are expanded, and the others are closed up

(c) Sparx Systems 2018 Page 243 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

ICONIX Layout The ICONIX layout re-organizes the Enterprise Architect work area, opening the:
· Toolbox on the right hand side of the screen (follow the earlier instructions to
display the 'ICONIX' pages)
· Project Browser window in the top left of the screen, and
· Notes, Properties and Tagged Values windows nested on the bottom left of the
screen
To apply this layout, select the 'Basic - Reversed' option in the drop-down list in the
Workspace Layout toolbar.

(c) Sparx Systems 2018 Page 244 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Developing Programming Languages


You can make use of a range of established programming languages in Enterprise Architect, but if these are not suitable
to your needs you can develop your own. You would then apply it to your models through an MDG Technology that you
might develop just for this purpose, or for broader purposes. After developing the language, you could also write MDA
Transformation templates to convert a Platform Independent Model or a model in another language into a model for your
new language, or vice-versa.

Access

Ribbon Code > Configure > Options > Edit Code Templates

Keyboard Shortcuts Ctrl+Shift+P

Develop a Programming Language

Step Description

1 In the Code Template Editor, click on the New Language button and, on the 'Programming Languages
Datatypes' dialog, click on the Add Product button.
Enter your new programming language name and define the datatypes for it. You cannot access the new
language in the Code Template Editor until at least one datatype has been added to the language.

2 After you have defined all the datatypes you need, click on the Close button, select the language in the
'Language' field of the Code Template Editor, and start to edit or create the code templates for the new
language.
The code templates define how the system should perform:
· Forward code engineering of your models in the new language
· Behavioral Code generation (if this is appropriate)

3 If you prefer, you can also define source code options for your new language. These are additional
settings for the language that are not provided by the data types or code templates, and that help define
how the system handles that language when generating and reverse-engineering code.
The code options are made available to your models only through an MDG Technology.

4 Defining a grammar for your language is an optional step that provides two primary benefits:
· Reverse engineering of existing code into your model
· Synchronization during code generation so that changes made to the file since it was last generated
are not lost.
To access the grammar editor select the 'Code > Schema > Grammars' ribbon option.

5 If you intend MDA transformations to be made to (or from) your new programming language, you can
also edit and create transformation templates for it. The process of creating transformation templates is
very similar to that for creating code templates.

6 Having created the datatypes, code templates, code options, grammar and transformation templates for

(c) Sparx Systems 2018 Page 245 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

your new language, you can incorporate and distribute them in an MDG Technology.

(c) Sparx Systems 2018 Page 246 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Template Framework


When you use Enterprise Architect to generate code from a model, or transform the model, the system refers to the Code
Template Framework (CTF) for the parameters that define how it should:
· Forward engineer a UML model
· Generate Behavioral Code
· Perform a Model Driven Architecture (MDA) Transformation
· Generate DDL in database modeling
A range of standard templates is available for the direct generation of code and for transformation; if you do not want to
use the standard CTF configurations, you can customize them to meet your needs.

CTF Templates

Template Type Detail

Code Templates When you forward engineer a Class model, the code templates define how the
skeletal code is to be generated for a given programming language. The templates
for a language are automatically associated with the language.
The templates are written as plain text with a syntax that shares some aspects of
both mark-up languages and scripting languages.

Model Transformation Model Transformation Templates provide a fully configurable method of defining
Templates how Model Driven Architecture (MDA) Transformations convert model elements
and model fragments from one domain to another.
This process is two-tiered. It creates an intermediary language (which can be
viewed for debugging) which is then processed to create the objects.

Behavioral Code Enterprise Architect supports user-definable code generation of the UML
Generation Templates Behavioral models.
This applies the standard Code Template Framework but includes specific
Enterprise Architect Simulation Library (EASL) code generation macros.

DDL Templates DDL Templates are very similar to Code generation templates, but they have been
extended to support DDL generation with their own set of base templates, macros,
function macros and template options.

(c) Sparx Systems 2018 Page 247 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Template Customization


Enterprise Architect helps you to generate source code from UML models for a wide range of programming languages.
Standard templates (mappings) are provided out-of-the-box but you can customize the way that code is generated by
using the powerful and flexible Code Template Framework (CTF). This sophisticated framework allows you to
customize every detail of the way code is generated, including the facility to create new templates for languages not
supported in the base product. For example, JavaScript is not one of the supported languages but a series of templates
can be written quickly to generate JavaScript from UML models. In these cases existing templates act as a useful starting
point and reference for new languages.
The code template framework also provides the mechanism for generation of behavioral models and is used for the
transformation templates.

Features

Feature Detail

Default Templates Default Code Templates are built into Enterprise Architect for forward engineering
supported languages.

Code Template Editor A Code Template Editor is provided for creating and maintaining user-defined
Code Templates.

Customizing Code Descriptions of the template syntax and the macros and functions you can use to
Templates control the effects of the templates.

Synchronize Code A subset of the default Code Templates to synchronize code.

(c) Sparx Systems 2018 Page 248 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code and Transform Templates


Code templates and transform (Model Transformation) templates define how the system should generate or transform
code in one or other of the programming languages that Enterprise Architect supports. Each language has a wide range of
base templates, each of which defines how a particular code structure is generated. You can use these base templates as
they are, or you can customize and add to the templates to better support your use of the standard languages, or of other
languages that you might define to the system. You review, update and create templates through the Code Template
editor or Transformation Template editor.
The order in which the base templates are listed in the two editors relates to the hierarchical order of the objects and their
parts that are to be processed. Calls are made from certain base templates to others, and you can add further calls to both
base templates and to your own custom templates. By default, the File template is the starting point of a code generation
process through the templates; a File consists of Classes that can contain Attributes and Operations.

Access

Ribbon Code > Configure > Options > Edit Code Templates
Design > Tools > Transform > Transform Templates

Keyboard Shortcuts Ctrl+Shift+P (Code Generation Templates)


Ctrl+Alt+H (MDA Transformation Templates)

Application of Templates

Action Detail

Calling Templates Within any template, you can call other templates using %TemplateName%. The
enclosing percent (%) signs indicate a macro.
You would use this for a single call to the ClassBody template, %ClassBody%, as
shown:
% list = "TemplateName" @separator= "\n" @indent= " " %
The %list macro performs an iterative pass on all the objects in the scope of the
current template and calls the TemplateName for each of them:
% list = "ClassBody" @separator= "\n" @indent= " " %
After generation or transformation, each macro is substituted to produce the
generated output; for a language such as C++, the result of processing this template
might be:
/**
* This is an example Class note generated using code templates
* @author Sparx Systems
*/
class ClassA: public ClassB
{
...
}

(c) Sparx Systems 2018 Page 249 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Execution of Code Each template might act only on a particular element type; for example, the
Templates ClassNotes template only acts on UML Class and Interface elements.
The element from which code is currently being generated is said to be in scope; if
the element in scope is stereotyped, the system searches for a template that has been
defined for that stereotype. If a specialized template is found, it is executed;
otherwise the default implementation of the base template is used.
Templates are processed sequentially, line by line, replacing each macro with its
underlying text value from the model.

Transfer Templates If you edit a base Code Generation or Transformation template, or create a
Between Projects customized template, you can copy them from one project to another as Reference
Data.

(c) Sparx Systems 2018 Page 250 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Base Templates
The Code Template Framework consists of a number of base templates. Each base template transforms particular aspects
of the UML to corresponding parts of object-oriented languages.
The base templates form a hierarchy, which varies slightly across different programming languages. In a typical template
hierarchy relevant to a language like C# or Java (which do not have header files) the templates can be modeled as
Classes, but usually are just plain text. This hierarchy would be slightly more complicated for languages such as C++ and
Delphi, which have separate implementation templates.
Each of the base templates must be specialized to be of use in code engineering; in particular, each template is
specialized for the supported languages (or 'products'). For example, there is a ClassBody template defined for C++,
another for C#, another for Java, and so on; by specializing the templates, you can tailor the code generated for the
corresponding UML entity.
Once the base templates are specialized for a given language, they can be further specialized based on:
· A Class's stereotype, or
· A feature's stereotype (where the feature can be an operation or attribute)
This type of specialization enables, for example, a C# operation that is stereotyped as «property» to have a different
Operation Body template from an ordinary operation; the Operation Body template can then be specialized further, based
on the Class stereotype.

Base templates used in the CTF

Template Description

Attribute A top-level template to generate member variables from UML attributes.

Attribute Declaration Used by the Attribute template to generate a member variable declaration.

Attribute Notes Used by the Attribute template to generate member variable notes.

Class A top-level template for generating Classes from UML Classes.

Class Base Used by the Class template to generate a base Class name in the inheritance list of a
derived Class, where the base Class doesn't exist in the model.

Class Body Used by the Class template to generate the body of a Class.

Class Declaration Used by the Class template to generate the declaration of a Class.

Class Interface Used by the Class template to generate an interface name in the inheritance list of a
derived Class, where the interface doesn't exist in the model.

Class Notes Used by the Class template to generate the Class notes.

File A top-level template for generating the source file.


For languages such as C++, this corresponds to the header file.

Import Section Used in the File template to generate external dependencies.

Linked Attribute A top-level template for generating attributes derived from UML Associations.

(c) Sparx Systems 2018 Page 251 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Linked Attribute Notes Used by the Linked Attribute template to generate the attribute notes.

Linked Attribute Used by the Linked Attribute template to generate the attribute declaration.
Declaration

Linked Class Base Used by the Class template to generate a base Class name in the inheritance list of a
derived Class, for a Class element in the model that is a parent of the current Class.

Linked Class Interface Used by the Class template to generate an Interface name in the inheritance list of a
derived Class, for an Interface element in the model that is a parent of the current
Class.

Namespace A top-level template for generating namespaces from UML Packages (although not
all languages have namespaces, this template can be used to generate an equivalent
construct, such as Packages in Java).

Namespace Body Used by the Namespace template to generate the body of a namespace.

Namespace Declaration Used by the Namespace template to generate the namespace declaration.

Operation A top-level template for generating operations from a UML Class's operations.

Operation Body Used by the Operation template to generate the body of a UML operation.

Operation Declaration Used by the Operation template to generate the operation declaration.

Operation Notes Used by the Operation template to generate documentation for an operation.

Parameter Used by the Operation Declaration template to generate parameters.

Templates for generating code for languages with separate interface and
implementation sections

Template Description

Class Impl A top-level template for generating the implementation of a Class.

Class Body Impl Used by the Class Impl template to generate the implementation of Class members.

File Impl A top-level template for generating the implementation file.

File Notes Impl Used by the File Impl template to generate notes in the source file.

Import Section Impl Used by the File Impl template to generate external dependencies.

Operation Impl A top-level template for generating operations from a UML Class's operations.

Operation Body Impl Used by the Operation template to generate the body of a UML operation.

(c) Sparx Systems 2018 Page 252 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Operation Declaration Impl Used by the Operation template to generate the operation declaration.

Operation Notes Impl Used by the Operation template to generate documentation for an operation.

(c) Sparx Systems 2018 Page 253 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Export Code Generation and Transformation Templates


It is possible to export Code Generation and Transformation templates from your model to a .xml file. You can then
import that file - and hence the templates - into other models, as reference data. You can export customized templates,
which includes those that you or other users have created and updated, and base (standard) templates that have been
tailored. You do not need to export base templates that have not been changed, as these are available in every installation
of Enterprise Architect.

Access

Ribbon Configure > Model > Transfer > Export Reference Data

Export a Code Generation template or Transformation template

Step Action

1 On the 'Export Reference Data' dialog, in the 'Name' list, select the templates to export.
The list includes any standard Code Generation or Transformation templates that have been changed, and
any customized templates that you have created or changed.
You can select one or more templates to be exported to a single XML file, by pressing Ctrl or Shift as you
click on the template names.

2 Click on the Export button.

3 When prompted to do so, enter a valid file name with a .xml extension.

4 Click on the Save button and on the OK button.


This exports the template(s) to the file; you can use any text or XML viewer to examine the file.

(c) Sparx Systems 2018 Page 254 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Import Code Generation and Transformation Templates


If you have exported Code Generation and/or Transformation templates from an Enterprise Architect model, you can
import them into other Enterprise Architect models as reference data.

Access

Ribbon Configure > Model > Transfer > Import Reference Data

Import Code Generation and/or Transformation Templates

Step Action

1 On the 'Import Reference Data' dialog, click on the Select File button and browse to the .xml file
containing the required Code Generation or Transformation templates.

2 Select the name of one or more template datasets and click on the Import button.

(c) Sparx Systems 2018 Page 255 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Synchronize Code
Enterprise Architect uses code templates during the forward synchronization of these programming languages:
· ActionScript
· C
· C++
· C#
· Delphi
· Java
· PHP
· Python
· VB
· VB.Net
Three types of change can occur in the source when it is synchronized with the UML model:
· Existing sections are synchronized: for example, the return type in an operation declaration is updated
· New sections are added to existing features: for example, Notes are added to a Class declaration where there were
previously none
· New features and elements are added: for example, a new operation is added to a Class
Each of these changes has a different effect on the CTF and must be handled differently by Enterprise Architect, as
described in these topics:
· Synchronize Existing Sections
· Add New Sections to Existing Features
· Add New Features and Elements

Code sections that can be synchronized

Only a subset of the CTF base templates is used during synchronization. This subset corresponds to the distinct sections
that Enterprise Architect recognizes in the source code.

Code Template Code Section

Class Notes Comments preceding the Class declaration.

Class Declaration Up to and including the Class parents.

Attribute Notes Comments preceding an Attribute declaration.

Attribute Declaration Up to and including the terminating character.

Operation Notes Comments preceding an operation declaration.

Operation Notes Impl As for Operation Notes.

Operation Declaration Up to and including the terminating character.

Operation Declaration Impl Up to and including the terminating character.

(c) Sparx Systems 2018 Page 256 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Operation Body Everything between and including the braces.

Operation Body Impl As for Operation Body.

(c) Sparx Systems 2018 Page 257 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Synchronize Existing Sections


When an existing section in the source code differs from the result generated by the corresponding template, that section
is replaced.
Consider, for example, this C++ Class declaration:
(asm) class A: public B
Now assume that you add an inheritance relationship from Class A to Class C; the entire Class declaration would be
replaced with something resembling this:
(asm) class A: public B, public C

(c) Sparx Systems 2018 Page 258 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Add New Sections


These sections can be added to existing features in the source code, as new sections:
· Class Notes
· Attribute Notes
· Operation Notes
· Operation Notes Impl
· Operation Body
· Operation Body Impl
Assume that, in this example, Class A had no note when you originally generated the code:
(asm) class A: public B, public C
If you now specify a note in the model for Class A, Enterprise Architect attempts to add the new note from the model
during synchronization, by executing the Class Notes template.
To make room for the new section to be inserted, you can specify how much white space to append to the section via
synchronization macros.

(c) Sparx Systems 2018 Page 259 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Add New Features and Elements


These features and elements can be added to the source code during synchronization:
· Attributes
· Inner Classes
· Operations
They are added by executing the relevant templates for each new element or feature in the model.
Enterprise Architect attempts to preserve the appropriate indenting of new features in the code, by finding the indents
specified in list macros of the Class; for languages that make use of namespaces, the 'synchNamespaceBodyIndent'
macro is available.
Classes defined within a (non-global) namespace are indented according to the value set for this macro, during
synchronization.
The value is ignored:
· For Classes defined within a Package set up as a root namespace, or
· If the 'Generate Namespaces' option is set to False in the appropriate language page (C#, C++ or VB.Net) on the
'Preferences' dialog ('Start > View > Preferences > Source Code Engineering > <language>')

(c) Sparx Systems 2018 Page 260 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The Code Template Editor


The Code Template Editor provides the facilities of the Common Code Editor, including Intelli-sense for the various
macros. For more information on Intelli-sense and the Common Code Editor, see the Editing Source Code topic.

Access

Ribbon Code > Configure > Options > Edit Code Templates

Keyboard Shortcuts Ctrl+Shift+P

Options

Option Action

Language Select the programming language.

New Language Display the 'Programming Languages Datatypes' dialog, which enables you to
include programming languages other than those supported for Enterprise
Architect, for which to create or edit code templates.

Template Display the contents of the active template, and open the editor for modifying
templates.

Templates List the base code templates; the active template is highlighted.
The 'Modified' field indicates whether you have changed the default template for
the current language.

Stereotype Overrides List the stereotyped templates, for the active base template.
The 'Modified' field indicates whether you have modified a default stereotyped
template.

Add New Custom Invoke a dialog for creating a custom stereotyped template.
Template

Add New Stereotyped Invoke a dialog for adding a stereotyped template, for the currently selected base
Override template.

Get Default Template Update the editor display with the default version of the active template.

Save Overwrite the active templates with the contents of the editor.

Delete If you have overridden the active template, the override is deleted and replaced by
the corresponding default code template.

(c) Sparx Systems 2018 Page 261 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes

· User-modified and user-defined Code Templates can be imported and exported as reference data (see the Sharing
Reference Data topic); the templates defined for each language are indicated in the 'Export Reference Data' dialog
by the language name with the suffix _Code_Templates - if no templates exist for a language, there is no entry for
the language in the dialog

(c) Sparx Systems 2018 Page 262 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Template Syntax


Code Templates are written using Enterprise Architect's Code Template Editor. The Code Template Editor supports
syntax highlighting of the Code Template Framework language.

Syntax Elements

Elements Detail

Basic Constructs Templates can contain:


· Literal Text
· Variables
· Macros
· Calls to other templates

Comments If you want to add comments to the templates, use the command:
$COMMENT="text"
where "text" is the text of the comment; this must be enclosed in quotes.
The command is case-sensitive, and must be typed in upper case.

(c) Sparx Systems 2018 Page 263 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Literal Text
All text within a given template that is not part of a macro or a variable definition/reference, is considered literal text.
With the exception of blank lines, which are ignored, literal text is directly substituted from the template into the
generated code.
Consider this excerpt from the Java Class Declaration template:
$bases = "Base"
class % className % $bases
On the final line, the word 'class ', including the subsequent space, would be treated as literal text and thus for a Class
named 'foo' would return the output:
class fooBase
A blank line following the variable $bases would have no effect on the output.

Inserting System Characters:

The %, $, " and \ characters have special meaning in the template syntax and cannot always be used as literal text. If
these characters must be generated from within the templates, they can be safely reproduced using these direct
substitution macros:

Macro Action

%dl% Produce a literal $ character.

%pc% Produce a literal % character.

%qt% Produce a literal " character.

%sl% Produce a literal \ character

Notes

String conjunction operators (“+”, “+=”) are not required but can be used

(c) Sparx Systems 2018 Page 264 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Variables
Template variables provide a convenient way of storing and retrieving data within a template. This section explains how
variables are defined and referenced.

Variable Definitions

Variable definitions take the basic form:


$<name> = <value>
where <name> can be any alpha-numeric sequence and <value> is derived from a macro or another variable.
A simple example definition would be:
$foo = %className%
Variables can be defined using values from:
· Substitution, function or list macros
· String literals, enclosed within double quotation marks
· Variable references

Definition Rules

These rules apply to variable definitions:


· Variables have global scope within the template in which they are defined and are not accessible to other templates
· Each variable must be defined at the start of a line, without any intervening white space
· Variables are denoted by prefixing the name with $, as in $foo
· Variables do not have to be declared, prior to being defined
· Variables must be defined using either the assignment operator (=), or the addition-assignment operator (+=)
· Multiple terms can be combined in a single definition using the addition operator (+)

Examples

Using a substitution macro:


$foo = %opTag:"bar"%
Using a literal string:
$foo = "bar"
Using another variable:
$foo = $bar
Using a list macro:
$ops = %list="Operation" @separator="\n\n" @indent="\t"%
Using the addition-assignment operator (+=):
$body += %list="Operation" @separator="\n\n" @indent="\t"%
That definition is equivalent to:
$body = $body + %list="Operation" @separator="\n\n" @indent="\t"%

(c) Sparx Systems 2018 Page 265 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Using multiple terms:


$templateArgs = %list="ClassParameter" @separator=", "%
$template ="template<" + $templateArgs + ">"

Variable References

Variable values can be retrieved by using a reference of the form:


$<name>
where <name> can be a previously defined variable.
Variable references can be used:
· As part of a macro, such as the argument to a function macro
· As a term in a variable definition
· As a direct substitution of the variable value into the output
It is legal to reference a variable before it is defined. In this case, the variable is assumed to contain an empty string
value: ""

Variable References - Example 1

Using variables as part of a macro. This is an excerpt from the default C++ ClassNotes template.
$wrapLen = %genOptWrapComment%
$style = %genOptCPPCommentStyle% (Define variables to store the style and wrap length options)
%if $style == "XML.NET"% (Reference to $style as part of a condition)
%XML_COMMENT($wrapLen)%
%else%
%CSTYLE_COMMENT($wrapLen)% (Reference to $wrapLen as an argument to function macro)
%endIf%

Variable References - Example 2

Using variable references as part of a variable definition.


$foo = "foo" (Define our variables)
$bar = "bar"
$foobar = $foo + $bar ($foobar now contains the value foobar)

Variable References - Example 3

Substituting variable values into the output.


$bases=%classInherits% (Store the result of the ClassInherits template in $bases)
Class %className%$bases (Now output the value of $bases after the Class name)

(c) Sparx Systems 2018 Page 266 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Macros
Macros provide access to element fields within the UML model and are also used to structure the generated output. All
macros are enclosed within percent (%) signs in the form of:
%<macroname>%
In general, macros (including the % delimiters) are substituted for literal text in the output. For example, consider this
item from the Class Declaration template:
... class %className% ...
The field substitution macro, %className%, would result in the current Class name being substituted in the output. So if
the Class being generated was named Foo, the output would be:
... class Foo ...
The CTF contains a number of types of macros:
· Template Substitution Macros
· Field Substitution Macros
· Substitution Examples
· Attribute Field Substitution Macros
· Class Field Substitution Macros
· Code Generation Option Field Substitution Macros
· Connector Field Substitution Macros
· Constraint Field Substitution Macros
· Effort Field Substitution Macros
· File Field Substitution Macros
· File Import Field Substitution Macros
· Link Field Substitution Macros
· Linked File Field Substitution Macros
· Metric Field Substitution Macros
· Operation Field Substitution Macros
· Package Field Substitution Macros
· Parameter Field Substitution Macros
· Problem Field Substitution Macros
· Requirement Field Substitution Macros
· Resource Field Substitution Macros
· Risk Field Substitution Macros
· Scenario Field Substitution Macros
· Tagged Value Substitution Macros
· Template Parameter Substitution Macros
· Test Field Substitution Macros
· Function Macros
· Control Macros
· List Macro
· Branching Macros
· Synchronization Macros

(c) Sparx Systems 2018 Page 267 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· The Processing Instruction (PI) Macro


· EASL Code Generation Macros

(c) Sparx Systems 2018 Page 268 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Template Substitution Macros


Template substitution macros correspond to Base templates, and result in the execution of the named template. By
convention, template macros are named according to Pascal casing.
Structure: %<TemplateName>%
where <TemplateName> can be one of the templates listed in this topic.
When a template is referenced from within another template, it is generated with respect to the elements currently in
scope. The specific template is selected based on the stereotypes of the elements in scope.
As noted previously, there is an implicit hierarchy among the various templates. Some care should be taken in order to
preserve a sensible hierarchy of template references. For example, it does not make sense to use the %ClassInherits%
macro within any of the attribute or operation templates. Conversely, the Operation and Attribute templates are designed
for use within the ClassBody template.

Template substitution macros in the CTF

· Attribute
· AttributeDeclaration
· AttributeDeclarationImpl
· AttributeNotes
· Class
· ClassBase
· ClassBody
· ClassBodyImpl
· ClassDeclaration
· ClassDeclarationImpl
· ClassImpl
· ClassInherits
· ClassInterface
· ClassNotes
· ClassParameter
· File
· FileImpl
· ImportSection
· ImportSectionImpl
· InnerClass
· InnerClassImpl
· LinkedAttribute
· LinkedAttributeDeclaration
· LinkedAttributeNotes
· LinkedClassBase
· LinkedClassInterface
· Namespace
· NamespaceBody

(c) Sparx Systems 2018 Page 269 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· NamespaceDeclaration
· NamespaceImpl
· Operation
· OperationBody
· OperationBodyImpl
· OperationDeclaration
· OperationDeclarationImpl
· OperationImpl
· OperationNotes
· Parameter

(c) Sparx Systems 2018 Page 270 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Field Substitution Macros


The field substitution macros provide access to data in your model. In particular, they are used to access data fields from:
· Packages
· Classes
· Attributes
· Operations, and
· Parameters
Field substitution macros are named according to Camel casing. By convention, the macro is prefixed with an
abbreviated form of the corresponding model element. For example, attribute-related macros begin with att, as in the
%attName% macro, to access the name of the attribute in scope.
Macros that represent checkboxes return a value of T if the box is selected. Otherwise the value is empty.
This table lists a small number of project field substitution macros. Type-specific macros are listed in the subtopics of
this Field Substitution Macros section.

Project Macros

Macro Name Description

eaDateTime The current time with format: DD-MMM-YYYY HH:MM:SS AM/PM.

eaGUID A unique GUID for this generation.

eaVersion Program Version (located in the 'About Enterprise Architect' dialog by selecting
'Start > Help > Help > About EA').

(c) Sparx Systems 2018 Page 271 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Substitution Examples
Field substitution macros can be used in one of two ways:
· Direct Substitution or
· Conditional Substitution

Direct Substitution

This form directly substitutes the corresponding value of the element in scope into the output.
Structure: %<macroName>%
Where <macroName> can be any of the macros listed in the Field Substitution Macros tables.

Examples

· %className%
· %opName%
· %attName%

Conditional Substitution

This form of the macro enables alternative substitutions to be made depending on the macro's value.
Structure: %<macroName> (== "<text>") ? <subTrue> (: <subFalse>) %
Where:
· () denotes that values between the parentheses are optional
· <text> is a string representing a possible value for the macro
· <subTrue> and <subFalse> can be a combination of quoted strings and the keyword value; where the value is used,
it is replaced with the macro's value in the output

Examples

· %classAbstract=="T" ? "pure" :""%


· %opStereotype=="operator" ? "operator" :""%
· %paramDefault != "" ? " = " value : ""%
These three examples output nothing if the condition fails. In this case the False condition can be omitted, resulting in
this usage:
· %classAbstract=="T" ? "pure"%
· %opStereotype=="operator" ? "operator"%
· %paramDefault != "" ? " = "value%
The third example of both blocks shows a comparison checking for a non-empty value or existence. This test can also be
omitted.
· %paramDefault ? " = " value : ""%

(c) Sparx Systems 2018 Page 272 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· %paramDefault ? " = " value%


All of these examples containing paramDefault are equivalent. If the parameter in scope had a default value of 10, the
output from each of them would normally be:
= 10

Notes

· In a conditional substitution macro, any white space following <macroName> is ignored; if white space is required
in the output, it should be included within the quoted substitution strings

(c) Sparx Systems 2018 Page 273 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Attribute Field Substitution Macros


This table lists each of the attribute field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Attribute Macros

Macro Name Description

attAlias 'Attributes' dialog: Alias.

attAllowDuplicates 'Attributes Detail' dialog: 'Allow Duplicates' checkbox.

attClassifierGUID The unique GUID for the classifier of the current attribute.

attCollection 'Attributes Detail' dialog: 'Attribute is a Collection' checkbox.

attConst 'Attributes' dialog: 'Const' checkbox.

attContainerType 'Attributes Detail' dialog: Container Type.

attContainment 'Attributes' dialog: Containment.

attDerived 'Attributes' dialog: 'Derived' checkbox.

attGUID The unique GUID for the current attribute.

attInitial 'Attributes' dialog: Initial.

attIsEnumLiteral 'Attributes' dialog: 'Is Literal' checkbox.

attIsID 'Attributes Detail' dialog: 'isID' checkbox.

attLength 'Column' dialog: Length.

attLowerBound 'Attributes Detail' dialog: Lower Bound.

attName 'Attributes' dialog: Name.

attNotes 'Attributes' dialog: Notes.

attOrderedMultiplicity 'Attributes Detail' dialog: 'Ordered Multiplicity' checkbox.

attProperty 'Attributes' dialog: 'Property' checkbox.

attQualType The attribute type qualified by the namespace path (if generating namespaces) and
the classifier path (dot delimited). If the attribute classifier has not been set, is
equivalent to the attType macro.

(c) Sparx Systems 2018 Page 274 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

attScope 'Attributes' dialog: Scope.

attStatic 'Attributes' dialog: 'Static' checkbox.

attStereotype 'Attributes' dialog: Stereotype.

attType 'Attributes' dialog: Type.

attUpperBound 'Attributes Detail' dialog: Upper Bound.

attVolatile 'Attributes Detail' dialog: 'Transient' checkbox.

(c) Sparx Systems 2018 Page 275 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Class Field Substitution Macros


This table provides a list of methods for accessing each available Class property in the Code Generation and
Transformation templates.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Class Macros

Macro Name Description

elemType The element type: Interface or Class.

classAbstract Class 'Properties' dialog: 'Abstract' checkbox ('Details' tab).

classAlias Class 'Properties' dialog: 'Alias' field.

classArguments Class 'Detail' dialog: C++ Templates: Arguments.

classAuthor Class 'Properties' dialog: 'Author' field.

classBaseName 'Type Hierarchy' dialog: Class Name (for use where no connector exists between
child and base Classes).

classBaseScope The scope of the inheritance as reverse engineered. (For use where no connector
exists between child and base Classes.)

classBaseVirtual The virtual property of the inheritance as reverse engineered. (For use where no
connector exists between child and base Classes.)

classComplexity Class 'Properties' dialog: 'Complexity' field.

classCreated The date and time the Class was created.

classGUID The unique GUID for the current Class.

classHasConstructor Looks at the list of methods in the current object and, depending on the conventions
of the current language, returns T if one is a default constructor. Typically used
with the genOptGenConstructor macro.

classHasCopyConstructor Looks at the list of methods in the current object and, depending on the conventions
of the current language, returns T if one is a copy constructor. Typically used with
the genOptGenCopyConstructor macro.

classHasDestructor Looks at the list of methods in the current object and, depending on the conventions
of the current language, returns T if one is a destructor. Typically used with the
genOptGenDestructor macro.

classHasParent True, if the Class in scope has one or more base Classes.

(c) Sparx Systems 2018 Page 276 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

classHasStereotype True, if the Class in scope has a stereotype that matches a stereotype name (which
you can optionally specify as fully qualified). It therefore checks all stereotypes that
a Class has and returns 'T' if any of them is the specified stereotype or a
specialization of it. For example:
· %classHasStereotype:"block"% will return 'T' for any block-stereotyped Class
from any SysML version, including associationBlock
· %classHasStereotype:"SysML1.4::block"% will specifically match the SysML
1.4 versions
Compare this with classStereotype, later.

classImports 'Code Gen' dialog: Imports.

classIsActive Class 'Advanced' dialog: 'Is Active' checkbox.

classIsAssociationClass True, if the Association is an AssociationClass connector.

classIsInstantiated True, if the Class is an instantiated template Class.

classIsLeaf Class 'Advanced' dialog: 'Is Leaf' checkbox.

classIsRoot Class 'Advanced' dialog: 'Is Root' checkbox.

classIsSpecification Class 'Advanced' dialog: 'Is Specification' checkbox.

classKeywords Class 'Properties' dialog: 'Keywords' field.

classLanguage Class 'Properties' dialog: 'Language' field.

classMacros A space separated list of macros defined for the Class.

classModified The date and time the Class was last modified.

classMultiplicity Class 'Advanced' dialog: Multiplicity.

className Class 'Properties' dialog: 'Name' field.

classNotes Class 'Properties' dialog: 'Note' field.

classParamDefault Class 'Detail' dialog.

classParamName Class 'Detail' dialog.

classParamType Class 'Detail' dialog.

classPersistence Class 'Properties' dialog: 'Persistence' field ('Details' tab)

classPhase Class 'Properties' dialog: 'Phase' field.

classQualName The Class name prefixed by its outer Classes. Class names are separated by double
colons (::).

classScope Class 'Properties' dialog: 'Scope' field.

(c) Sparx Systems 2018 Page 277 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

classStereotype Class 'Properties' dialog: 'Stereotype' field. Retrieves the name of the first
stereotype applied to the Class. When used in a comparison, it checks whether that
first stereotype exactly matches a string.
For example: %classStereotype=="enumeration" ? "enum" : "class"%
Compare this with classHasStereotype, earlier.

classStatus Class 'Properties' dialog: 'Status' field.

classVersion Class 'Properties' dialog: 'Version' field.

(c) Sparx Systems 2018 Page 278 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Generation Option Field Substitution Macros


Code generation option field substitution macros operate on the source code generation options defined in the 'Source
Code Engineering' pages of either the:
· 'Preferences' dialog ('Start > View > Preferences> Source Code Engineering') for user-specific options, or
· 'Manage Project Options' dialog ('Configure > Model > Options') for model-specific options
For more information on the division of the options, see the Source Code Engineering Options topic.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty. This table lists each of the code generation option field substitution
macros.

Code Generation Option Macros

Macro Name Description

genOptActionScriptVersio ActionScript Specifications page: Default Version.


n

genOptCDefaultAttributeT C Specifications page: Default Attribute Type.


ype

genOptCGenMethodNotesI C Specifications page: Method Notes In Implementation.


nBody

genOptCGenMethodNotesI C Specifications page: Method Notes In Header.


nHeader

genOptCSynchNotes C Specifications page: Synchronize Notes in Generation.

genOptCSynchCFile C Specifications page: Synchronise Implementation file in Generation.

genOptCDefaultSourceDir C Specifications page: Default Source Directory.


ectory

genOptCNamespaceDelimi C Specifications page: Namespace Delimiter.


ter

genOptCOperationRefPara C Specifications page: Reference as Operation Parameter.


m

genOptCOperationRefPara C Specifications page: Reference Parameter Style.


mStyle

genOptCOperationRefPara C Specifications page: Reference Parameter Name.


mName

genOptCConstructorName C Specifications page: Default Constructor Name.

genOptCDestructorName C Specifications page: Default Destructor Name.

(c) Sparx Systems 2018 Page 279 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

genOptCPPCommentStyle C++ Specifications page: Comment Style.

genOptCPPDefaultAttribut C++ Specifications page: Default Attribute Type.


eType

genOptCPPDefaultReferen C++ Specifications page: Default Reference Type.


ceType

genOptCPPDefaultSource C++ Specifications page: Default Source Directory.


Directory

genOptCPPGenMethodNot C++ Specifications page: 'Method Notes In Header' checkbox.


esInHeader

genOptCPPGenMethodNot C++ Specifications page: Method Notes In Body checkbox.


esInBody

genOptCPPGetPrefix C++ Specifications page: Get Prefix.

genOptCPPHeaderExtensio C++ Specifications page: Header Extension.


n

genOptCPPSetPrefix C++ Specifications page: Set Prefix.

genOptCPPSourceExtensio C++ Specifications page: Source Extension.


n

genOptCPPSynchNotes C++ Specifications page: Synchronize Notes.

genOptCPPSynchCPPFile C++ Specifications page: Synchronize CPP File.

genOptCSDefaultAttribute C# Specifications page: Default Attribute Type.


Type

genOptCSSourceExtension C# Specifications page: Default file extension.

genOptCSGenDispose C# Specifications page: Generate Dispose.

genOptCSGenFinalizer C# Specifications page: Generate Finalizer.

genOptCSGenNamespace C# Specifications page: Generate Namespace.

genOptCSDefaultSourceDi C# Specifications page: Default Source Directory.


rectory

genOptDefaultAssocAttNa Source Code Engineering page: Default name for associated attribute.
me

genOptDefaultConstructor Object Lifetimes page: Default Constructor Visibility.


Scope

genOptDefaultCopyConstr Object Lifetimes page: Default Copy Constructor Visibility.


uctorScope

(c) Sparx Systems 2018 Page 280 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

genOptDefaultDatabase Code Editors page: Default Database.

genOptDefaultDestructorS Object Lifetimes page: Default Destructor Constructor Visibility.


cope

genOptGenCapitalisedProp 'Source Code Engineering' page: 'Capitalize Attribute Names for Properties'
erties checkbox.

genOptGenComments 'Source Code Engineering' page: 'Comments - Generate' checkbox.

genOptGenConstructor Object Lifetimes page: 'Generate Constructor' checkbox.

genOptGenConstructorInli Object Lifetimes page: 'Constructor Inline' checkbox.


ne

genOptGenCopyConstruct Object Lifetimes page: 'Generate Copy Constructor' checkbox.


or

genOptGenCopyConstruct Object Lifetimes page: 'Copy Constructor Inline' checkbox.


orInline

genOptGenDestructor Object Lifetimes page: 'Generate Destructor' checkbox.

genOptGenDestructorInlin Object Lifetimes page: 'Destructor Inline' checkbox.


e

genOptGenDestructorVirtu Object Lifetimes page: 'Virtual Destructor' checkbox.


al

genOptGenImplementedInt 'Code Generation' page: 'Generate methods for implemented interfaces' checkbox.
erfaceOps

genOptGenPrefixBoolProp 'Source Code Engineering' page: 'Use 'Is' for Boolean property Get()' checkbox.
erties

genOptGenRoleNames 'Source Code Engineering' page: 'Autogenerate role names when creating code'
checkbox.

genOptGenUnspecAssocDi 'Source Code Engineering' page: 'Do not generate members where Association
r direction is unspecified' checkbox.

genOptJavaDefaultAttribut Java Specifications page: Default attribute type.


eType

genOptJavaGetPrefix Java Specifications page: Get Prefix.

genOptJavaDefaultSource Java Specifications page: Default Source Directory.


Directory

genOptJavaSetPrefix Java Specifications page: Set Prefix.

genOptJavaSourceExtensio Java Specifications page: Source code extension.

(c) Sparx Systems 2018 Page 281 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

genOptPHPDefaultSource PHP Specifications page: Default Source Directory.


Directory

genOptPHPGetPrefix PHP Specifications page: Get Prefix.

genOptPHPSetPrefix PHP Specifications page: Set Prefix.

genOptPHPSourceExtensio PHP Specifications page: Default file extension.


n

genOptPHPVersion PHP Specifications page: PHP Version.

genOptPropertyPrefix 'Source Code Engineering' page: Remove prefixes when generating Get/Set
properties.

genOptVBMultiUse VB Specifications page: 'Multiuse' checkbox.

genOptVBPersistable VB Specifications page: 'Persistable' checkbox.

genOptVBDataBindingBeh VB Specifications page: 'Data binding behavior' checkbox.


avior

genOptVBDataSourceBeha VB Specifications page: 'Data source behavior' checkbox.


vior

genOptVBGlobal VB Specifications page: 'Global namespace' checkbox.

genOptVBCreatable VB Specifications page: 'Creatable' checkbox.

genOptVBExposed VB Specifications page: 'Exposed' checkbox.

genOptVBMTS VB Specifications page: MTS Transaction Mode.

genOptVBNetGenNamesp VB.Net Specifications page: Generate Namespace.


ace

genOptVBVersion VB Specifications page: Default Version.

genOptWrapComment 'Source Code Engineering' page: Wrap length for comment lines.

(c) Sparx Systems 2018 Page 282 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Connector Field Substitution Macros


This table lists each of the connector field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Connector Macros

Macro Name Description

connectorAlias Connector 'Properties' dialog: 'Alias' field.

connectorAssociationClass The GUID of the connector's Association Class element.


ElemGUID

connectorAssociationClass The name of the connector's Association Class element.


ElemName

connectorDestAccess Connector 'Properties' dialog, 'Target Role' tab: Access.

connectorDestAggregation Connector 'Properties' dialog, 'Target Role' tab: Aggregation.

connectorDestAlias Connector 'Properties' dialog, 'Target Role' tab: Alias.

connectorDestAllowDuplic Connector 'Properties' dialog, 'Target Role' tab: 'Allow Duplicates' checkbox.
ates

connectorDestChangeable Connector 'Properties' dialog, 'Target Role' tab: Changeable.

connectorDestConstraint Connector 'Properties' dialog, 'Target Role' tab: Constraint(s).

connectorDestContainment Connector 'Properties' dialog, 'Target Role' tab: Containment.

connectorDestDerived Connector 'Properties' dialog, 'Target Role' tab: 'Derived' checkbox.

connectorDestDerivedUnio Connector 'Properties' dialog, 'Target Role' tab: 'DerivedUnion' checkbox.


n

connectorDestElem* A set of macros that access a property of the element at the target end of a
connector. The * (asterisk) is a wildcard that corresponds to any Class substitution
macro in the Class macro list. For example:
· connectorDestElemAlias (classAlias)
· connectorDestElemAuthor (classAuthor)

connectorDestElemType The element type of the connector destination element. (Separate from the
connectorDestElem* macros because there is no classType substitution macro.)

connectorDestFeature* A set of macros that access a property of the feature at the target end of a connector.
The * (asterisk) is a wildcard that corresponds to any attribute or operation
substitution macro in the Attribute macro or Operation macro list, depending on the

(c) Sparx Systems 2018 Page 283 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

connectorDestFeatureType.
For example:
· connectorDestFeatureReturnClassifierGUID - an operation's return classifier
GUID
· connectorDestFeatureContainment - an attribute's containment

connectorDestFeatureType The type of the connector destination feature.


· connectorDestFeatureType="Attribute" or "Operation"

connectorDestMemberTyp Connector 'Properties' dialog, 'Target Role' tab: Member Type.


e

connectorDestMultiplicity Connector 'Properties' dialog, 'Target Role' tab: Multiplicity.

connectorDestNavigability Connector 'Properties' dialog, 'Target Role' tab: Navigability.

connectorDestNotes Connector 'Properties' dialog, 'Target Role' tab: Role Notes.

connectorDestOrdered Connector 'Properties' dialog, 'Target Role' tab: 'Ordered' checkbox.

connectorDestOwned Connector 'Properties' dialog, 'Target Role' tab: 'Owned' checkbox.

connectorDestQualifier Connector 'Properties' dialog, 'Target Role' tab: Qualifier(s).

connectorDestRole Connector 'Properties' dialog, 'Target Role' tab: Role.

connectorDestScope Connector 'Properties' dialog, 'Target Role' tab: Target Scope.

connectorDestStereotype Connector 'Properties' dialog, 'Target Role' tab: Stereotype.

connectorDirection Connector Properties: Direction.

connectorEffect 'Transition Constraints' dialog: 'Effect' field.

connectorGuard 'Object Flow' and 'Transition Constraints' dialogs: 'Guard' field.

connectorGUID The unique GUID for the current connector.

connectorIsAssociationCla True, if the connector is an AssociationClass connector.


ss

connectorName Connector Properties: Name.

connectorNotes Connector Properties: Notes.

connectorSourceAccess Connector 'Properties' dialog, 'Source Role' tab: Access.

connectorSourceAggregati Connector 'Properties' dialog, 'Source Role' tab: Aggregation.


on

connectorSourceAlias Connector 'Properties' dialog, 'Source Role' tab: Alias.

(c) Sparx Systems 2018 Page 284 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

connectorSourceAllowDup Connector 'Properties' dialog, 'Source Role' tab: Allow Duplicates checkbox.
licates

connectorSourceChangeabl Connector 'Properties' dialog, 'Source Role' tab: Changeable.


e

connectorSourceConstraint Connector 'Properties' dialog, 'Source Role' tab: Constraint(s).

connectorSourceContainme Connector 'Properties' dialog, 'Source Role' tab: Containment.


nt

connectorSourceDerived Connector 'Properties' dialog, 'Source Role' tab: 'Derived' checkbox.

connectorSourceDerivedU Connector 'Properties' dialog, 'Source Role' tab: 'DerivedUnion' checkbox.


nion

connectorSourceElem* A set of macros that access a property of the element at the source end of a
connector. The * (asterisk) is a wildcard that corresponds to any Class substitution
macro in the Class macro list. For example:
· connectorSourceElemAlias (classAlias)
· connectorSourceElemAuthor (classAuthor)

connectorSourceElemType The element type of the connector source element. (Separate from the
connectorSourceElem* macros because there is no classType substitution macro.)

connectorSourceFeature* A set of macros that access a property of the feature at the source end of a
connector. The * (asterisk) is a wildcard that corresponds to any attribute or
operation substitution macro in the Attribute macro or Operation macro list,
depending on the connectorSourceFeatureType. For example:
· connectorSourceFeatureCode - Operation's Code
· connectorSourceFeatureInitial - Attribute's Initial

connectorSourceFeatureTy The type of the connector source feature.


pe · connectorSourceFeatureType="Attribute" or "Operation"

connectorSourceMemberT Connector 'Properties' dialog, 'Source Role' tab: Member Type.


ype

connectorSourceMultiplicit Connector 'Properties' dialog, 'Source Role' tab: Multiplicity.


y

connectorSourceNavigabili Connector 'Properties' dialog, 'Source Role' tab: Navigability.


ty

connectorSourceNotes Connector 'Properties' dialog, 'Source Role' tab: Role Notes.

connectorSourceOrdered Connector 'Properties' dialog, 'Source Role' tab: 'Ordered' checkbox.

connectorSourceOwned Connector 'Properties' dialog, 'Source Role' tab: 'Owned' checkbox.

connectorSourceQualifier Connector 'Properties' dialog, 'Source Role' tab: Qualifier(s).

(c) Sparx Systems 2018 Page 285 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

connectorSourceRole Connector 'Properties' dialog, 'Source Role' tab: Role.

connectorSourceScope Connector 'Properties' dialog, 'Source Role' tab: Target Scope.

connectorSourceStereotype Connector 'Properties' dialog, 'Source Role' tab: Stereotype.

connectorStereotype Connector 'Properties' dialog: 'Stereotype' field.

connectorTrigger 'Transition Constraints' dialog: 'Trigger' field.

connectorType The connector type; f or example, Association or Generalization.

connectorWeight 'Object Flow Constraints' dialog: 'Weight' field.

(c) Sparx Systems 2018 Page 286 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Constraint Field Substitution Macros


This table lists each of the 'Constraint' field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Constraint Macros

Macro Name Description

constraintName 'Class' dialog, 'Constraints' tab: Name.

constraintNotes 'Class' dialog, 'Constraints' tab: Notes.

constraintStatus 'Class' dialog, 'Constraints' tab: Status.

constraintType 'Class' dialog, 'Constraints' tab: Type.

constraintWeight 'Class' dialog, 'Constraints' tab: ordering (hand up/down) keys.

(c) Sparx Systems 2018 Page 287 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Effort Field Substitution Macros


This table lists each of the 'Effort' field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Effort Macros

Macro Name Description

effortName Effort window: Effort.

effortNotes Effort window: Notes (unlabelled).

effortTime Effort window: Time.

effortType Effort window: Type.

(c) Sparx Systems 2018 Page 288 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

File Field Substitution Macros


This table lists each of the file field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

File Macros

Macro Name Description

fileExtension The file type extension of the file being generated.

fileName The name of the file being generated.

fileNameImpl The filename of the implementation file for this generation, if applicable.

fileHeaders 'Code Gen' dialog: Headers.

fileImports 'Code Gen' dialog: Imports. For supported languages this also includes
dependencies derived from these types of relationship:
· Aggregation
· Association
· Attribute classifier
· Method return type
· Method parameter classifier
· Generalization
· Realization (to interface)
· Template Binding (C++)
· Dependency

filePath The full path of the file being generated.

filePathImpl The full path of the implementation file for this generation, if applicable.

(c) Sparx Systems 2018 Page 289 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

File Import Field Substitution Macros


This table lists each of the file import field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of T if
the box is selected. Otherwise the value is empty.

File Import Macros

Macro Name Description

importClassName The name of the Class being imported.

importFileName The filename of the Class being imported.

importFilePath The full path of the Class being imported.

importFromAggregation T if the Class has an Aggregation connector to a Class in this file, F otherwise.

importFromAssociation T if the Class has an Association connector to a Class in this file, F otherwise.

importFromAtt T if an attribute of a Class in the current file is of the type of this Class, F
otherwise.

importFromDependency T if the Class has a Dependency connector to a Class in this file, F otherwise.

importFromGeneralization T if the Class has a Generalization connector to a Class in this file, F otherwise.

importFromMeth T if a method return type of a Class in the current file is the type of this Class, F
otherwise.

importFromParam T if a method parameter of a Class in the current file is of the type of this Class;
otherwise F.

importFromPropertyType T if the Class has a property (Part/Port) typing to another Class, F otherwise.

importFromRealization T if the Class has a Realization connector to a Class in this file, F otherwise.

importFromTemplateBindi T if the Class has a TemplateBinding connector to a Class in this file, F otherwise.
ng

importInFile T if the Class is in the current file, F otherwise.

importPackagePath The Package path with a '.' separator of the Class being imported.

ImportRelativeFilePath The relative file path of the Class being imported from the file path of the file being
generated.

(c) Sparx Systems 2018 Page 290 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Link Field Substitution Macros


If you want to provide access to data concerning connectors in the model, particularly Associations and Generalizations,
you can use the 'Link field substitution' macros. The macro names are in Camel casing. Macros that represent
checkboxes return a value of 'T' if the box is selected; otherwise the value is empty.

Link Macros

Macro Name Description/Result

linkAttAccess Association 'Properties' dialog, Target Role: 'Access' field.

linkAttAggregation Association 'Properties' dialog, Source or Target Role: Aggregation.

linkAttCollectionClass The collection appropriate for the linked attribute in scope.

linkAttContainment Association 'Properties' dialog, Target Role: Containment.

linkAttName 'Association Properties' dialog: Target.

linkAttNotes Association 'Properties' dialog, Target Role: Role Notes.

linkAttOwnedByAssociatio True, if the 'Owned' checkbox on the 'Role(s)' page of the Association 'Properties'
n dialog is not selected.

linkAttOwnedByClass True, if the 'Owned' checkbox on the 'Role(s)' page of the Association 'Properties'
dialog is selected.

linkAttQualName The Association target qualified by the namespace path (if generating namespaces)
and the classifier path (dot delimited).

linkAttRole Association 'Properties' dialog, Target Role: Role.

linkAttRoleAlias 'Association Properties Target Role' dialog: Alias

linkAttStereotype Association 'Properties' dialog, Target Role: Stereotype.

linkAttTargetScope Association 'Properties' dialog, Target Role: Target Scope.

linkCard Link 'Properties' dialog, Target Role: Multiplicity.

linkGUID The unique GUID for the current connector.

linkIsAssociationClass True, if the Association is an AssociationClass connector.

linkIsBound Returns T if any TemplateBindings are specified on the connector.

linkParamSubs Returns a comma-separated list of the arguments specified.

linkParentName Generalization 'Properties' dialog: 'Target' field.

(c) Sparx Systems 2018 Page 291 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

linkParentQualName The Generalization target qualified by the namespace path (if generating
namespaces) and the classifier path (dot delimited).

linkStereotype The stereotype of the current connector.

linkVirtualInheritance Generalization 'Properties' dialog: 'Virtual Inheritance' field.

(c) Sparx Systems 2018 Page 292 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Linked File Field Substitution Macros


This table lists each of the 'Linked File' field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Linked File Macros

Macro Name Description

linkedFileLastWrite Class 'Properties' dialog: 'Files' tab, 'Last Write' field.

linkedFileNotes Class 'Properties' dialog: 'Files' tab, 'Notes' field.

linkedFilePath Class 'Properties' dialog: 'Files' tab, 'File Path' field.

linkedFileSize Class 'Properties' dialog: 'Files' tab, 'Size' field.

linkedFileType Class 'Properties' dialog: 'Files' tab, 'Type' field.

(c) Sparx Systems 2018 Page 293 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Metric Field Substitution Macros


This table lists each of the Metric field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Metric Macros

Macro Name Description

metricName Metrics screen: 'Metric' field.

metricNotes Metrics screen: (Notes) field.

metricType Metrics screen: 'Type' field.

metricWeight Metrics screen: 'Weight' field.

(c) Sparx Systems 2018 Page 294 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Operation Field Substitution Macros


The 'Operation field substitution' macros provide access to data concerning operations in the model. The macro names
are in Camel casing. Macros that represent checkboxes return a value of 'T' if the box is selected; otherwise the value is
empty.

Operation field substitution macros

Macro Name Description/Result

opAbstract 'Operation' dialog: 'Virtual' checkbox.

opAlias 'Operation' dialog: Alias.

opBehavior 'Operation Behavior' dialog: Behavior.

opCode 'Operation Behavior' dialog: Initial Code.

opConcurrency 'Operation' dialog: Concurrency.

opConst 'Operation' dialog: 'Const' checkbox.

opGUID The unique GUID for the current operation.

opHasSelfRefParam Scans the list of parameters in the current Operation, returning 'T' if one type is the
Class reference (this could be ClassA* or ClassA&, depending on the value of the
genOptCOperationRefParamStyle code generation option field substitution macro).

opImplMacros A space-separated list of macros defined in the implementation of this operation.

opIsQuery 'Operation' dialog: 'IsQuery' checkbox.

opMacros A space-separated list of macros defined in the declaration for this operation.

opName 'Operation' dialog: Name.

opNotes 'Operation' dialog: Notes.

opPure 'Operation' dialog: 'Pure' checkbox.

opReturnArray 'Operation' dialog: 'Return Array' checkbox.

opReturnClassifierGUID The unique GUID for the classifier of the current operation.

opReturnQualType The operation return type qualified by the namespace path (if generating
namespaces) and the classifier path (dot delimited). If the return type classifier has
not been set, it is equivalent to the opReturnType macro.

opReturnType 'Operation' dialog: Return Type.

(c) Sparx Systems 2018 Page 295 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

opScope 'Operation' dialog: Scope.

opStatic 'Operation' dialog: 'Static' checkbox.

opStereotype 'Operation' dialog: Stereotype.

opSynchronized 'Operation' dialog: 'Synchronized' checkbox.

(c) Sparx Systems 2018 Page 296 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Package Field Substitution Macros


This table lists the Package Field Substitution macros.
Field Substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Package Macros

Macro Name Description

packageAbstract Package dialog: Abstract.

packageAlias Package dialog: Alias.

packageAuthor Package dialog: Author.

packageComplexity Package dialog: Complexity.

packageGUID The unique GUID for the current Package.

packageKeywords Package dialog: Keywords.

packageLanguage Package dialog: Language.

packageName Package dialog: Name.

packagePath The string representing the hierarchy of Packages, for the Class in scope. Each
Package name is separated by a dot (.).

packagePhase Package dialog: Phase.

packageScope Package dialog: Scope.

packageStatus Package dialog: Status.

packageStereotype Package dialog: Stereotype.

packageVersion Package dialog: Version.

(c) Sparx Systems 2018 Page 297 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Parameter Field Substitution Macros


This table lists each of the Parameter field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Parameter Macros

Macro Name Description

paramClassifierGUID The unique GUID for the classifier of the current parameter.

paramDefault Operation 'Parameters' dialog: 'Default' field.

paramFixed Operation 'Parameters' dialog: 'Fixed' checkbox.

paramGUID The unique GUID for the current parameter.

paramIsEnum True, if the parameter uses the enum keyword (C++).

paramKind Operation 'Parameters' dialog: 'Kind' field.

paramName Operation 'Parameters' dialog: 'Name' field.

paramNotes Operation 'Parameters' dialog: 'Notes' field.

paramQualType The parameter type qualified by the namespace path (if generating namespaces) and
the classifier path (dot delimited). If the parameter classifier has not been set, is
equivalent to the paramType macro.

paramType Operation 'Parameters' dialog: 'Type' field.

(c) Sparx Systems 2018 Page 298 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Problem Field Substitution Macros


This table lists each of the Problem field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Problem Macros

Macro Name Description

problemCompletedBy 'Maintenance' dialog, 'Element Issues' tab: Completed by.

problemCompletedDate 'Maintenance' dialog, 'Element Issues' tab: Completed.

problemHistory 'Maintenance' dialog, 'Element Issues' tab: History.

problemName 'Maintenance' dialog, 'Element Issues' tab: Name.

problemNotes 'Maintenance' dialog, 'Element Issues' tab: Description.

problemPriority 'Maintenance' dialog, 'Element Issues' tab: Priority.

problemRaisedBy 'Maintenance' dialog, 'Element Issues' tab: Raised by.

problemRaisedDate 'Maintenance' dialog, 'Element Issues' tab: Raised.

problemStatus 'Maintenance' dialog, 'Element Issues' tab: Status.

problemVersion 'Maintenance' dialog, 'Element Issues' tab: Version.

(c) Sparx Systems 2018 Page 299 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Requirement Field Substitution Macros


This table lists each of the Requirement field substitution macros with a description of the result.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Requirement Macros

Macro Name Description

requirementDifficulty 'Properties' dialog: 'Require' tab: Difficulty.

requirementLastUpdated 'Properties' dialog: 'Require' tab: Last Update.

requirementName 'Properties' dialog: 'Require' tab: Short Description.

requirementNotes 'Properties' dialog: 'Require' tab: Notes.

requirementPriority 'Properties' dialog: 'Require' tab: Priority.

requirementStatus 'Properties' dialog: 'Require' tab: Status.

requirementType 'Properties' dialog: 'Require' tab: Type.

(c) Sparx Systems 2018 Page 300 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Resource Field Substitution Macros


This table lists each of the Resource field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Resource Macros

Macro Name Description

resourceAllocatedTime Resource Allocation window: Allocated Time.

resourceEndDate Resource Allocation window: End Date.

resourceExpectedTime Resource Allocation window: Expected Time.

resourceExpendedTime Resource Allocation window: Time Expended.

resourceHistory Resource Allocation window: History.

resourceName Resource Allocation window: Resource.

resourceNotes Resource Allocation window: Description.

resourcePercentCompleted Resource Allocation window: Completed(%).

resourceRole Resource Allocation window: Role.

resourceStartDate Resource Allocation window: Start Date.

(c) Sparx Systems 2018 Page 301 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Risk Field Substitution Macros


This table lists each of the Risk field substitution macros.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Risk Macros

Macro Name Description

riskName Risks window: Risk.

riskNotes Risks window: (Notes).

riskType Risks window: Type.

riskWeight Risks window: Weight.

(c) Sparx Systems 2018 Page 302 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Scenario Field Substitution Macros


This table lists each of the Scenario field substitution macros with a description of the result.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Scenario Macros

Macro Name Description

scenarioGUID The unique ID for a scenario. Identifies the scenario unambiguously within a
model.

scenarioName 'Properties' dialog, 'Scenario' tab: Scenario.

scenarioNotes 'Properties' dialog, 'Scenario' tab: (Notes).

scenarioType 'Properties' dialog, 'Scenario' tab: Type.

(c) Sparx Systems 2018 Page 303 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Tagged Value Substitution Macros


Tagged Value macros are a special form of field substitution macros, which provide access to element tags and the
corresponding Tagged Values. They can be used in one of two ways:
· Direct Substitution
· Conditional Substitution

Direct Substitution

This form of the macro directly substitutes the value of the named tag into the output.
Structure: %<macroName>:"<tagName>"%
<macroName> can be one of:
· attTag
· classTag
· connectorDestElemTag
· connectorDestTag
· connectorSourceElemTag
· connectorSourceTag
· connectorTag
· linkAttTag
· linkTag
· opTag
· packageTag
· paramTag
This corresponds to the tags for attributes, Classes, operations, Packages, parameters, connectors with both ends,
elements at both ends of connectors and connectors including the attribute end.
<tagName> is a string representing the specific tag name.

Example

%opTag:"attribute"%

Conditional Substitution

This form of the macro mimics the conditional substitution defined for field substitution macros.
Structure: %<macroName>:"<tagName>" (== "<test>") ? <subTrue> (: <subFalse>) %
Note:
· <macroName> and <tagName> are as defined here
· (<text>) denotes that <text> is optional
· <test> is a string representing a possible value for the macro
· <subTrue> and <subFalse> can be a combination of quoted strings and the keyword value; where the value is used,
it gets replaced with the macro's value in the output

(c) Sparx Systems 2018 Page 304 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Examples

%opTag:"opInline" ? "inline" : ""%


%opTag:"opInline" ? "inline"%
%classTag:"unsafe" == "true" ? "unsafe" : ""%
%classTag:"unsafe" == "true" ? "unsafe"%
Tagged Value macros use the same naming convention as field substitution macros.

(c) Sparx Systems 2018 Page 305 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Template Parameter Substitution Macros


If you want to provide access in a transformation template to data concerning the transformation of a Template Binding
connector's binding parameter substitution in the model, you can use the Template Parameter substitution macros. The
macro names are in Camel casing. Macros that represent checkboxes return a value of 'T' if the box is selected; otherwise
the value is empty.

Template Parameter substitution macros

Macro Name Description

parameterSubstitutionForm 'Template Binding Properties' dialog, 'Binding Parameter' tab, 'Parameter


al Substitution(s)' panel: Formal Template Parameter name.

parameterSubstitutionActu 'Template Binding Properties' dialog, 'Binding Parameter' tab, 'Parameter


al Substitution(s)' panel: Actual parameter name/expression.

parameterSubstitutionActu 'Template Binding Properties' dialog, 'Binding Parameter' tab, 'Parameter


alClassifier Substitution(s)' panel: Actual parameter classifier.

(c) Sparx Systems 2018 Page 306 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Test Field Substitution Macros


This table lists each of the Test field substitution macros with a description of the result.
Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if
the box is selected. Otherwise the value is empty.

Test Macros

Macro Name Description

testAcceptanceCriteria Testing window: Acceptance Criteria.

testCheckedBy Testing window: Checked By.

testDateRun Testing window: Last Run.

testClass Testing window: Test Class (the type of test defined: Unit, Integration, System,
Acceptance, Inspection, Scenario)

testInput Testing window: Input.

testName Testing window: Test.

testNotes Testing window: Description.

testResults Testing window: Results.

testRunBy Testing window: Run By. (Values are derived from the Project Author definitions
in the 'People' dialog - 'Configure > Reference Data > Project Types > People >
Project Authors'.)

testStatus Testing window: Status.

testType Testing window: Type.

(c) Sparx Systems 2018 Page 307 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Function Macros
Function macros are a convenient way of manipulating and formatting various element data items. Each function macro
returns a result string. There are two primary ways to use the results of function macros:
· Direct substitution of the returned string into the output, such as: %TO_LOWER(attName)%
· Storing the returned string as part of a variable definition such as: $name = %TO_LOWER(attName)%
Function macros can take parameters, which can be passed to the macros as:
· String literals, enclosed within double quotation marks
· Direct substitution macros without the enclosing percent signs
· Variable references
· Numeric literals
Multiple parameters are passed using a comma-separated list.
Function macros are named according to the All-Caps style, as in:
%CONVERT_SCOPE(opScope)%
The available function macros are described here. Parameters are denoted by square brackets, as in:
FUNCTION_NAME([param]).

CONVERT_SCOPE([umlScope])

For use with supported languages, to convert [umlScope] to the appropriate scope keyword for the language being
generated. This table shows the conversion of [umlScope] with respect to the given language.

Language Conversions

C++ Package ==> public


Public ==> public
Private ==> private
Protected ==> protected

C# Package ==> internal


Public ==> public
Private ==> private
Protected ==> protected

Delphi Package ==> protected


Public ==> public
Private ==> private
Protected ==> protected

Java Package ==> {blank}


Public ==> public
Private ==> private
Protected ==> protected

PHP Package ==> public

(c) Sparx Systems 2018 Page 308 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Public ==> public


Private ==> private
Protected ==> protected

VB Package ==> Protected


Public ==> Public
Private ==> Private
Protected ==> Protected

VB .Net Package ==> Friend


Public ==> Public
Private ==> Private
Protected ==> Protected

COLLECTION_CLASS([language])

Gives the appropriate collection Class for the language specified for the current linked attribute.

CSTYLE_COMMENT([wrap_length])

Converts the notes for the element currently in scope to plain C-style comments, using /* and */.

DELPHI_PROPERTIES([scope], [separator], [indent])

Generates a Delphi property.

DELPHI_COMMENT([wrap_length])

Converts the notes for the element currently in scope to Delphi comments.

EXEC_ADD_IN(, [function_name],, ...,)

Invokes an Enterprise Architect Add-In function, which can return a result string.
[addin_name] and [function_name] specify the names of the Add-In and function to be invoked.
Parameters to the Add-In function can be specified via parameters [prm_1] to [prm_n].
$result = %EXEC_ADD_IN("MyAddin", "ProcessOperation", classGUID, opGUID)%
Any function that is to be called by the EXEC_ADD_IN macro must have two parameters: an EA.Repository object, and
a Variant array that contains any additional parameters from the EXEC_ADD_IN call. Return type should be Variant.
Public Function ProcessOperation(Repository As EA.Repository, args As Variant) As Variant

(c) Sparx Systems 2018 Page 309 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

FIND([src], [subString])

Position of the first instance of [subString] in [src]; -1 if none.

GET_ALIGNMENT()

Returns a string where all of the text on the current line of output is converted into spaces and tabs.

JAVADOC_COMMENT([wrap_length])

Converts the notes for the element currently in scope to javadoc -style comments.

LEFT([src], [count])

The first [count] characters of [src].

LENGTH([src])

Length of [src]. Returns a string.

MATH_ADD(x,y) MATH_MULT(x,y) and MATH_SUB(x,y)

In a code template or DDL template, these three macros perform, respectively, the mathematical functions of:
· Addition (x+y)
· Multiplication (x*y) and
· Subtraction (x-y)
The arguments x and y can be integers or variables, or a combination of the two. Consider these examples, as used in a
'Class' template for C++ code generation:
· $a = %MATH_ADD(3,4)%
· $b = %MATH_SUB(10,3)%
· $c = %MATH_MULT(2,3)%
· $d = %MATH_ADD($a,$b)%
· $e = %MATH_SUB($b,$c)%
· $f = %MATH_MULT($a,$b)%
· $g = %MATH_MULT($a,10)%
· $h = %MATH_MULT(10,$b)%
These compute, in the same sequence, to:
· a = 3 + 4 = $a
· b = 10 - 3 = $b
· c = 2 * 3 = $c

(c) Sparx Systems 2018 Page 310 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· d = a + b = $d
· e = b - c = $e
· f = a * b = $f
· g = a * 10 = $g
· h = 10 * b = $h
When the code is generated, the .h file (for C++) contains these corresponding strings:
· a=3+4=7
· b = 10 - 3 = 7
· c=2*3=6
· d = a + b = 14
· e=b-c=1
· f = a * b = 49
· g = a * 10 = 70
· h = 10 * b = 70

MID([src], [start]) MID([src], [start], [count])

Substring of [src] starting at [start] and including [count] characters. Where [count] is omitted the rest of the string is
included.

PI([option], [value], {[option], [value]})

Sets the PI for the current template to [value]. Valid values for [value] are:
· "\n"
· "\t "
· ““
· “”
<option> controls when the new PI takes effect. Valid values for <option> are:
· I, Immediate: the new PI is generated before the next non-empty template line
· N, Next: the new PI is generated after the next non-empty template line
Multiple pairs of options are allowed in one call. An example of the situation where this would used is where one
keyword is always on a new line, as illustrated here:
%PI=" "%
%classAbstract ? "abstract"%
%if classTag:"macro" != ""%
%PI("I", "\n", "N", " ")%
%classTag:"macro"%
%endIf%
class
%className%
For more details, see The Processing Instruction (PI) Macro.

(c) Sparx Systems 2018 Page 311 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

PROCESS_END_OBJECT([template_name])

Enables the Classes that are one Class further away from the base Class, to be transformed into objects (such as
attributes, operations, Packages, parameters and columns) of the base Class. [template_name] refers to the working
template that temporarily stores the data.

REMOVE_DUPLICATES([source], [separator])

Where [source] is a [separator] separated list; this removes any duplicate or empty strings.

REPLACE([string], [old], [new])

Replaces all occurrences of [old] with [new] in the given string <string>.

RESOLVE_OP_NAME()

Resolves clashes in interface names where two method-from interfaces have the same name.

RESOLVE_QUALIFIED_TYPE() RESOLVE_QUALIFIED_TYPE([separator])
RESOLVE_QUALIFIED_TYPE([separator], [default])

Generates a qualified type for the current attribute, linked attribute, linked parent, operation, or parameter. Enables the
specification of a separator other than. and a default value for when some value is required.

RIGHT([src], [count])

The last [count] characters of [src].

TO_LOWER([string])

Converts [string] to lower case.

TO_UPPER([string])

Converts [string] to upper case.

TRIM([string]) TRIM([string], [trimChars])

Removes trailing and leading white spaces from [string]. If [trimChars] is specified, all leading and trailing characters in

(c) Sparx Systems 2018 Page 312 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

the set of <trimChars> are removed.

TRIM_LEFT([string]) TRIM_LEFT([string], [trimChars])

Removes the specified leading characters from <string>.

TRIM_RIGHT([string]) TRIM_RIGHT([string], [trimChars])

Removes the specified trailing characters from <string>.

VB_COMMENT([wrap_length])

Converts the notes for the element currently in scope to Visual Basic style comments.

WRAP_COMMENT([comment], [wrap_length], [indent], [start_string])

Wraps the text [comment] at width [wrap_length] putting [indent] and [start_string] at the beginning of each line.
$behavior = %WRAP_COMMENT(opBehavior, "40", " ", "//")%
<wrap_length> must still be passed as a string, even though WRAP_COMMENT treats this parameter as an integer.

WRAP_LINES([text], [wrap_length], [start_string] {, [end_string] })

Wraps [text] as designated to be [wrap_length], adding [start_string] to the beginning of every line and [end_string] to
the end of the line if it is specified.

XML_COMMENT([wrap_length])

Converts the notes for the element currently in scope to XML-style comments.

(c) Sparx Systems 2018 Page 313 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Control Macros
Control macros are used to control the processing and formatting of the templates. The basic types of control macro
include:
· The list macro, for generating multiple element features, such as attributes and operations
· The branching macros, which form if-then-else constructs to conditionally execute parts of a template
· The PI macro for formatting new lines in the output, which takes effect from the next non-empty line
· A PI function macro that enables setting PI to a variable and adds the ability to set the PI that is generated before the
next line
· The synchronization macros
In general, control macros are named according to Camel casing.

(c) Sparx Systems 2018 Page 314 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

List Macro
If you need to loop or iterate through a set of Objects that are contained within or are under the current object, you can do
so using the %list macro. This macro performs an iterative pass on all the objects in the scope of the current template,
and calls another template to process each one.
The basic structure is:
%list=<TemplateName> @separator=<string> @indent=<string> (<conditions>) %
where <string> is a double-quoted literal string and <TemplateName> can be one of these template names:
· Attribute
· AttributeImpl
· Class
· ClassBase
· ClassImpl
· ClassInitializer
· ClassInterface
· Constraint
· Custom Template (custom templates enable you to define your own templates)
· Effort
· InnerClass
· InnerClassImpl
· LinkedFile
· Metric
· Namespace
· Operation
· OperationImpl
· Parameter
· Problem
· Requirement
· Resource
· Risk
· Scenario
· Test
<conditions> is optional and looks the same as the conditions for 'if' and 'elseIf' statements.

Example

In a Class transform, the Class might contain multiple attributes; this example calls the Attribute transform and outputs
the result of processing the transform for each attribute of the Class in scope. The resultant list separates its items with a
single new line and indents them two spaces respectively. If the Class in scope had any stereotyped attributes, they would
be generated using the appropriately specialized template.
%list="Attribute" @separator="\n" @indent=" "%
The separator attribute, denoted by @separator, specifies the space that should be used between the list items, excluding
the last item in the list.

(c) Sparx Systems 2018 Page 315 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The indent attribute, denoted by @indent, specifies the space by which each line in the generated output should be
indented.

Special Cases

There are some special cases to consider when using the %list macro:
· If the Attribute template is used as an argument to the %list macro, this also generates attributes derived from
Associations by executing the appropriate LinkedAttribute template
· If the ClassBase template is used as an argument to the %list macro, this also generates Class bases derived from
links in the model by executing the appropriate LinkedClassBase template
· If the ClassInterface template is used as an argument to the %list macro, this also generates Class bases derived from
links in the model by executing the appropriate LinkedClassInterface template
· If InnerClass or InnerClassImpl is used as an argument to the %list macro, these Classes are generated using the
Class and ClassImpl templates respectively; these arguments direct that the templates should be processed based on
the inner Classes of the Class in scope

(c) Sparx Systems 2018 Page 316 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Branching Macros
Branching macros provide if-then-else constructs. The CTF supports a limited form of branching through these macros:
· if
· elseIf
· else
· endIf
· endTemplate (which exits the current template)
The basic structure of the if and elseIf macros is:
%if <test> <operator> <test>%
where <operator> can be one of:
· ==
· !=
· < (mathematics comparison, less than)
· > (mathematics comparison, greater than)
· <= (mathematics comparison, less than or equal to)
· >= (mathematics comparison, greater than or equal to)
and <test> can be one of:
· a string literal, enclosed within double quotation marks
· a direct substitution macro, without the enclosing percent signs
· a variable reference
Note that if you are using one of the mathematics comparison operators, <test> must be a decimal number in string
format.
Branches can be nested, and multiple conditions can be specified using one of:
· and, or
· or
When specifying multiple conditions, 'and' and 'or' have the same order of precedence, and conditions are processed left
to right.
If conditional statements on strings are case sensitive, 'a String' does not equal 'A STRING'. Hence in some situations it
is better to set the variable $str=TO_LOWER(variable) or TO_UPPER(variable) and then compare to a specific case.
Macros are not supported in the conditional statements. It is best to assign the results of a macro (string) to a variable,
and then use the variable in the comparison.
$fldType = % TO_LOWER ($parameter1)%
$COMMENT = "Use the first 4 characters for Date and Time field types"
$fldType4 = % LEFT ($fldType, 4)%
%if $fldType4 == "date"%
Datetime
%endif%
This takes a parameter of value “Datetime”, “DATETIME” or “Date”, and returns “Datetime”.
The endif or endTemplate macros must be used to signify the end of a branch. In addition, the endTemplate macro causes
the template to return immediately, if the corresponding branch is being executed.

Example 1

(c) Sparx Systems 2018 Page 317 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

%if elemType == "Interface"%


;
%else%
%OperationBody%
%endIf%
In this case:
· If the elemType is "Interface" a semi-colon is returned
· If the elemType is not "Interface", a template called Operation Body is called

Example 2

$bases="ClassBase"
$interfaces=""%
%if $bases !="" and $interfaces !=""%
: $bases, $interfaces
%elseIf $bases !=""%
: $bases
%elseIf $interfaces !=""%
: $interfaces
%endIf%
In this case the text returned is ':ClassBase'.

Conditions using Boolean Value

When setting up branching using conditions that involve a system checkbox (boolean fields), such as Attribute.Static
(attStatic) the conditional statement would be written as:
%if attStatic == "T"%
For example:
% if attCollection == "T" or attOrderedMultiplicity == "T" %
% endTemplate %

(c) Sparx Systems 2018 Page 318 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Synchronization Macros
The synchronization macros are used to provide formatting hints to Enterprise Architect when inserting new sections into
the source code, during forward synchronization. The values for synchronization macros must be set in the File
templates.
The structure for setting synchronization macros is:
%<name>=<value>%
where <name> can be one of the macros listed here and <value> is a literal string enclosed by double quotes.

Synchronization Macros

Macro Name Description

synchNewClassNotesSpace Space to append to a new Class note. Default value: \n.

synchNewAttributeNotesS Space to append to a new attribute note. Default value: \n.


pace

synchNewOperationNotesS Space to append to a new operation note. Default value: \n.


pace

synchNewOperationBodyS Space to append to a new operation body. Default value: \n.


pace

synchNamespaceBodyInde Indent applied to Classes within non-global namespaces. Default value: \t.
nt

(c) Sparx Systems 2018 Page 319 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The Processing Instruction (PI) Macro


The PI (Processing Instruction) macro provides a means of defining the separator text to be inserted between the code
pieces (which represent entities) that are generated using a template.
The structure for setting the Processing Instruction is:
%PI=<value>%
In this structure, <value> is a literal string enclosed by double quotes, with these options:
· "\n" - New line (the default)
· " " - Space
· "\t" - Tab
· "" - Null
By default, the PI is set to generate a new line (\n) for each non-empty substitution, which behavior can be changed by
resetting the PI macro. For instance, a Class’s Attribute declaration in simple VB code would be generated to a single
line statement (with no new lines). These properties are derived from the Class-Attribute Properties in the model to
generate, for example:
Private Const PrintFormat As String = "Portrait"
The template for generating this starts with the PI being set to a space rather than a new line:
% PI = " " %
% CONVERT_SCOPE (attScope)%
% endIf %
% if attConst == "T" %
Const
% endIf %
On transforming this, attscope returns the VB keyword 'Private' and attConst returns 'Const' on the same line spaced by a
single space (fitting the earlier VB Class.Attribute definition example).
Alternatively, when generating a Class you might want the Class declaration, the notes and Class body all separated by
double lines. In this case the %PI is set to '/n/n' to return double line spacing:
% PI = "\n\n" %
% ClassDeclaration %
% ClassNotes %
% ClassBody %

PI Characteristics

· Blank lines have no effect on the output


· Any line that has a macro that produces an empty result does not result in a PI separator (space/new line)
· The last entry does not return a PI; for example, %Classbody% does not have a double line added after the body

(c) Sparx Systems 2018 Page 320 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Code Generation Macros for Executable StateMachines


The templates listed here are available through the Code Template Editor (the 'Code > Configure > Options > Edit Code
Templates' ribbon option); select 'STM_C++_Structured' in the 'Language' field.
The templates are structured as shown here:

StmContextStateMachineEnum
StmStateMachineEnum

StmContextStateEnum
StmAllStateEnum

StmContextTransitionEnum
StmTransitionEnum

StmContextEntryEnum
StmAllEntryEnum

StmContextStateMachineStringToEnum
StmStateMachineStringToEnum

StmContextStateEnumToString
StmStateEnumToString

StmContextTransitionEnumToString
StmTransitionEnumToString

StmContextStateNameToGuid
StmStateNameToGuid

StmContextTransitionNameToGuid
StmTransitionNameToGuid

StmContextDefinition
StmStateMachineEnum
StmAllStateEnum
StmTransitionEnum
StmAllEntryEnum
StmAllRegionVariableInitialize
StmStateWithDeferredEvent
StmDeferredEvent
StmTransitionProcMapping

(c) Sparx Systems 2018 Page 321 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

StmTransitionProc
StmTransitionExit
StmTransitionEntry
StmTargetOutgoingTransition
StmTargetParentSubmachineState
StmStateProcMapping
StmStateProc
StmStateEntry
StmOutgoingTransition
StmConnectionPointReferenceEntry
StmParameterizedInitial
StmSubMachineInitial
StmRegionInitial
StmRegionDeactive
StmStateExitProc
StmStateTransition
StmStateEvent
StmStateTriggeredTransition
StmStateCompletionTransition
StmStateIncomingTransition
StmStateOutgoingTransition
StmSubmachineStateExitEvent
StmVertexOutgoingTransition
StmConnectionPointReferenceExitEvent
StmStateExitEvent
StmVertexOutgoingTransition
StmAllRegionVariable
StmStateMachineStringToEnum
StmStateMachineRun
StmStateInitialData
StmStateMachineEntry
StmOutgoingTransition
StmStateMachineRunInitial
StmStateMachineInitial
StmStateMachineRuns

StmContextManager

StmSimulationManager
StmContextInstanceDeclaration
StmContextInstance
StmContextVariableRunstate

(c) Sparx Systems 2018 Page 322 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

StmContextInstanceAssociation
StmContextInstanceClear

StmEventProxy
StmSignalEnum
StmContextJoinEventEnum
StmJoinEventEnum
StmEventEnum
StmSignalDefinition
StmSignalAttributeAssignment
StmSignalAttribute
StmSignalInitialize
StmEventStringToEnum
StmEventEnumToString
StmEventNameToGuid

StmConsoleManager
StmContextInstanceDeclaration
StmContextInstance
StmContextVariableRunstate
StmContextInstanceAssociation
StmContextInstanceClear

StmStateMachineStrongToEnum

StmInitialForTransition

StmVertextOutgoingTransition

StmSendEvent

StmBroadcastEvent

StmContextRef

Signal & Event

Macro name Description

stmEventEnum The name of the Event with the prefix 'ENUM_', all upper case.

StmEventGuid The GUID of the Event.

(c) Sparx Systems 2018 Page 323 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

stmEventName The name of the Event with spaces and asterixes removed.

stmEventVariable The name of the Event with the prefix 'm_' in lower case.

stmIsSignalEvent Is 'T' if the element is a SignalEvent.

stmSignalEnum The name of the Signal with the prefix 'ENUM_', all upper case.

stmSignalFirstEvent The name of the Event with the prefix 'ENUM_', all upper case.

stmSignalGuid The GUID of the Signal.

stmSignalName The name of the Signal with spaces and asterixes removed.

stmSignalVariable The name of the Signal with the prefix 'm_' in lower case.

stmTriggerName Transition Properties: The name of the Trigger.

stmTriggerSpecification Transition Properties: The specification of the Trigger.

stmTriggerType Transition Properties: The type of the Trigger.

Context

Macro name Description

stmContextName The name of the Class with spaces and asterixes removed.

stmContextQualName The qualified name of the Class for which code is being generated.

stmContextVariableName

stmContextFileName The output file name for the Class for which code is being generated.

Writing Object Runstate to StateMachine Initialization

Macro name Description

stmContextVariableRunstat
eName

stmContextVariableRunstat
eValue

stmContextHasStatemachin Is 'T' if the current context has one or more StateMachines.

(c) Sparx Systems 2018 Page 324 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

stmHasHistoryPattern Is 'T' if the StateMachine has a History Pattern.

stmHasTerminatePattern Is 'T' if the StateMachine has a Terminate Pattern.

stmHasDeferredEventPatte Is 'T' if the StateMachine has a Deferred Event Pattern.


rn

stmHasSubmachinePattern Is 'T' if the StateMachine has a Submachine Pattern.

stmHasOrthogonalPattern Is 'T' if the StateMachine has an Orthogonal Pattern.

StateMachine

Macro name Description

stmStatemachineName The name of the StateMachine with asterixes and spaces removed.

stmStatemachineEnum The name of the StateMachine plus 'ENUM_' plus the name of the StateMachine in
upper case.

stmStatemachineGuid The GUID of the StateMachine element.

stmStateCount The number of State elements in the StateMachine.

stmSubmachineInitialCoun The number of Initial elements in the Sub Machine State element.
t

stmStatemachineHasSubm Is 'T' if the StateMachine has at least one SubMachine State.


achineState

stmStatemachineInitialCou The number of Initial elements in the StateMachine.


nt

Region

Macro name Description

stmRegionEnum The name of the State Region plus 'ENUM_' plus the name of the State Region in
upper case.

stmRegionFQName The fully qualified name of the State Region.

stmRegionName The name of the State Region with spaces and asterixes removed.

(c) Sparx Systems 2018 Page 325 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

stmRegionVariable The name of the State Region with the prefix 'm_' in lower case.

stmRegionFQVariable The fully qualified name of the State Region with the prefix 'm_' in lower case.

stmRegionGuid The GUID of the Region.

stmRegionInitial

stmRegionIsOwnedByState Is 'T' if the Region is owned by a StateMachine.


Machine

Transition

Macro name Description

stmTransitionEnum The name of the Transition with the prefix 'ENUM_', plus the name of the
Transition in upper case.

stmTransitionGuid The GUID of the Transition.

stmTransitionName The name of the Transition with spaces and asterixes removed.

stmTransitionSourceGuid The GUID of the Source element in the Transition.

stmTransitionTargetGuid The GUID of the Target element in the Transition.

stmTransitionVariable The name of the Transition with the prefix 'm_' in lower case.

stmTransitionSourceVariab
le

stmTransitionTargetVariab
le

stmTransitionFQVariable

stmSourceVertexEnum The name of the Transition's source vertex plus '_ENUM' plus the name of the
Transition's source vertex in upper case.

stmTargetVertexEnum The name of the Transition's target vertex plus '_ENUM' plus the name of the
Transition's target vertex in upper case.

stmSourceIsInitial Is 'T' if the Transition's source is an Initial.

stmSourceIsState Is 'T' if the Transition's source is a State.

stmSourceIsEntryPoint Is 'T' if the Transition's source is an Entry Point.

stmSourceIsExitPoint Is 'T' if the Transition's source is an Exit Point.

(c) Sparx Systems 2018 Page 326 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

stmSourceIsFork Is 'T' if the Transition's source is a Fork.

stmSourceIsJoin Is 'T' if the Transition's source is a Join element.

stmTargetIsFinalState Is 'T' if the Transition's target is a Final State element.

stmTargetIsExitPoint Is 'T' if the Transition's target is an Exit Point element.

stmTargetIsState Is 'T' if the Transition's target is a State element.

stmTargetIsChoice Is 'T' if the Transition's target is a Choice element.

stmTargetIsJunction Is 'T' if the Transition's target is a Junction element.

stmTargetIsEntryPoint Is 'T' if the Transition's target is an Entry Point element.

stmTargetIsConnectionPoi Is 'T' if the Transition's target is a Connection Point Reference element.


ntReference

stmTargetIsFork Is 'T' if the Transition's target is a Fork element.

stmTargetIsJoin Is 'T' if the Transition's target is a Join element.

stmTransitionEffect The Effect of the Transition.

stmTransitionGuard The Guard of the Transition.

stmTransitionKind The type or kind of the Transition.

stmTargetInitialTransition

stmTargetIsSubmachineSta Is 'T' if the Transition's target is a Submachine State.


te

stmSourceStateEnum The name of the Transition's source state with the prefix '_ENUM' in upper case.

stmTargetStateEnum The name of the Transition's target state, with the prefix '_ENUM' in upper case.

stmTargetVertexFQName The fully qualified name of the Transition's target vertex.

stmTargetIsDeepHistory Is 'T' if the Transition's target is a Deep History State.

stmTargetIsShallowHistory Is 'T' if the Transition's target is a Shallow History State.

stmTargetIsTerminate Is 'T' if the Transition's target is a Terminate element.

stmParentIsStateMachine Is 'T' if the vertex is an Entry Point or Exit Point, or if the container is a
StateMachine.

stmSourceParentStateEnu
m

(c) Sparx Systems 2018 Page 327 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

stmTargetParentStateEnum

stmTargetSubmachineEnu
m

stmTargetRegionIndex

stmIsSelfTransition Is 'T' if the Transition's source is the same as its target.

stmHistoryOwningRegionI
nitialTransition

stmDefaultHistoryTransitio
n

Vertex and State

Macro name Description

stmVertexName The name of the Vertex.

stmStateName The name of the State.

stmVertexGuid The GUID of the Vertex.

stmVertexFQName The fully qualified name of the Vertex.

stmStateFQName The fully qualified name of the State.

stmVertexType The type of the vertex; one of 'State', 'FinalState', 'Pseudostate',


'ConnectionPointReference' or ' ' (empty).

stmPseudostateKind The kind of the Pseudostate; one of 'initial', 'deepHistory', 'shallowHistory', 'join',
'fork', 'junction', 'choice', 'entryPoint', 'exitPoint' or 'terminate'.

stmPseudostateName The name of the Pseudostate.

stmPseudostateVariable The name of the Pseudostate with the prefix 'm_' in lower case.

stmPseudostateStateMachi The name of the Pseudostate StateMachine.


neName

stmPseudostateStateMachi The name of the Pseudostate StateMachine with the prefix 'm_' in lower case.
neVariable

stmVertexVariable The name of the Vertex with the prefix 'm_' in lower case.

stmVertexEnum The name of the Vertex plus '_ENUM' plus the name of the Vertex in upper case.

(c) Sparx Systems 2018 Page 328 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

stmStateEnum The name of the State plus '_ENUM' plus the name of the State in upper case.

stmConnectionPointRefere The name of the Connection Point Reference.


nceStateName

stmConnectionPointRefere The name of the Connection Point Reference with the prefix 'm_' in lower case.
nceStateVariable

stmConnectionPointRefere
nceEntryCount

stmParameterizedInitialCo
unt

stmInitialCountForTransiti
on

stmStateVariable The name of the State with the prefix 'm_' in lower case.

stmStateEntryBehavior The behavior defined for an 'entry' Action operation for a State (the text on the
'Behavior' tab for the 'entry' Action operation on the Features window for the
element).

stmStateEntryCode The initial code defined for an 'entry' Action operation for a State (the text for the
'entry' Action operation on the Behavior's 'Code' tab).

stmStateDoBehavior The behavior defined for a 'do' Action operation for a State (the text on the
'Behavior' tab for the 'do' Action operation on the Features window for the
element).

stmStateDoCode The initial code defined for a 'do' Action operation for a State (the text for the 'do'
Action operation on the Behavior's 'Code' tab).

stmStateExitBehavior The behavior defined for an 'exit' Action operation for a State (the text on the
'Behavior' tab for the 'exit' Action operation on the Features window for the
element).

stmStateExitCode The initial code defined for an 'exit' Action operation for a State (the text for the
'exit' Action operation on the Behavior's 'Code' tab).

stmStateSubmachineName The name of the Submachine.

stmStateSubmachineVariab The name of the Submachine with the prefix 'm_' in lower case.
le

stmStateIsFinal Is 'T' if the State is a FinalState.

stmStateIsSubmachineState Is 'T' if the State is a Submachine State ('Properties' page | Advanced |


'isSubmachineState' property).

stmSubMachineEnum The name of the Submachine followed by '_ENUM' plus the name of Submachine
in upper case.

stmStateHasChildrenToJoi

(c) Sparx Systems 2018 Page 329 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

stmStateIsTransitionTarget

stmThisIsSource

stmThisIsSourceState

stmStateParentIsSubmachi Is 'T' if the State's container is a StateMachine.


ne

stmStateContainerMatchTr
ansitionContainer

stmVertexRegionIndex

stmStateRegionCount The number of regions in the State.

stmStateInitialCount The number of Initial elements in the StateMachine.

stmVertexContainerVariabl
e

stmVertexParentEnum

stmStateHasUnGuardedCo
mpletionTransition

stmStateEventHasUnGuard
edTransition

stmInitialTransition

Instance Association

Macro name Description

stmSourceInstanceName

stmTargetInstanceName

stmSourceRoleName

stmTargetRoleName

(c) Sparx Systems 2018 Page 330 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

EASL Code Generation Macros


Enterprise Architect provides a number of Enterprise Architect Simulation Library (EASL) code generation macros to
generate code from behavioral models. These are:
· EASL_INIT
· EASL_GET
· EASLList and
· EASL_END

EASL_INIT

The EASL_INIT macro is used to initialize an EASL behavior model. The behavior model code generation is dependent
on this model.

Aspect Description

Syntax %EASL_INIT(<<GUID>>)%
where:
· <<GUID>> is the GUID of the Object (usually a Class element) that is the
owner of the behavior model

EASL_GET

The EASL_GET macro is used to retrieve a property or a collection of an EASL object. The EASL objects and the
properties and collections for each object are identified in the EASL Collections and EASL Properties topics.

Aspect Description

Syntax $result = %EASL_GET(<<Property>>, <<Owner ID>>, <<Name>>)%


where:
· <<Property>> is one of "Property", "Collection", "At", "Count", or "IndexOf"
· <<OwnerID>> is the ID of the owner object for which the property/collection
is to be retrieved
· <<Name>> is the name of the property or Collection being accessed
· $result is the returned value; this is “” if not a valid property
If <<Property>> is:
· "At", then <<OwnerID>> is the ID of a collection and <<Name>> is the index
into the collection for which the item is to be retrieved
· "Count", then <<Owner ID>> is the ID of a collection and <<Name>> is not
used; it will retrieve the item number in the collection
· "IndexOf", then <<Owner ID>> is the ID of a collection and <<Name>> is the
ID of the item in the collection; it will retrieve the index (string format) of the
item within the collection

Example $sPropName = %EASL_GET("Property", $context, "Name")%

(c) Sparx Systems 2018 Page 331 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

EASLList

The EASLList macro is used to render each object in an EASL collection using the appropriate template.

Aspect Description

Syntax $result = %EASLList=<<TemplateName>> @separator=<<Separator>>


@indent=<<indent>> @owner=<<OwnedID>>
@collection=<<CollectionName>> @option1=<<OPTION1>>
@option2=<<OPTION2>>......... @optionN=<<OPTIONN>>%
where:
· <<TemplateName>> is the name of any behavioral model template or custom
template
· <<Separator>> is a list separator (such as “\n”)
· <<indent>> is any indentation to be applied to the result
· <<OwnedID>> is the ID of the object that contains the required collection
· <<CollectionName>> is the name of the required collection
· <<OPTION1>...<<OPTION99>> are miscellaneous options that might be
passed on the template; each option is given as an additional input parameter to
the template
· $result is the resultant value; this is “” if not a valid collection

Example $sStates = %EASLList="State" @separator="\n" @indent="\t"


@owner=$StateMachineGUID @collection="States" @option=$sOption%

EASL_END

The EASL_END macro is used to release the EASL behavior model.

Aspect Description

Syntax %EASL_END%

Behavioral Model Templates

· Action
· Action Assignment
· Action Break
· Action Call
· Action Create
· Action Destroy
· Action If

(c) Sparx Systems 2018 Page 332 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

· Action Loop
· Action Opaque
· Action Parallel
· Action RaiseEvent
· Action RaiseException
· Action Switch
· Behavior
· Behavior Body
· Behavior Declaration
· Behavior Parameter
· Call Argument
· Decision Action
· Decision Condition
· Decision Logic
· Decision Table
· Guard
· Property Declaration
· Property Notes
· Property Object
· State
· State CallBack
· State Enumerate
· State EnumeratedName
· StateMachine
· StateMachine HistoryVar
· Transition
· Transition Effect
· Trigger

(c) Sparx Systems 2018 Page 333 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

EASL Collections
This topic lists the EASL collections for each of the EASL objects, as retrieved by the EASL Code Generation Macros
code generation macro.

Action

Collection Name Description

Arguments The Action's arguments.

SubActions The sub-actions of the Action.

Behavior

Collection Name Description

Actions The Behavior's Actions.

Nodes The Behavior's nodes.

Parameters The Behavior's parameters.

Variables The Behavior's variables.

Classifier

Collection Name Description

AllStateMachines All StateMachines for the Classifier.

AsynchProperties The asynchronous properties of the Classifier.

AsynchTriggers The asynchronous triggers of the Classifier.

Behaviors The behaviors of the Classifier.

Properties The properties of the Classifier.

TimedProperties The timed properties of the Classifier.

TimedTriggers The timed triggers of the Classifier.

(c) Sparx Systems 2018 Page 334 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Triggers All triggers of the Classifier.

Construct

Collection Name Description

AllChildren The Construct's children.

ClientDependencies The client dependencies on the Construct.

StereoTypes The stereotypes of the Construct.

SupplierDependencies The supplier dependencies on the Construct.

Node

Collection Name Description

IncomingEdges The Node's incoming edges.

OutgoingEdges The Node's outgoing edges.

SubNodes The sub-nodes of the Node.

State

Collection Name Description

DoBehaviors The State's Do behaviors.

EntryBehaviors The State's Entry behaviors.

ExitBehaviors The State's Exit behaviors.

StateMachine

Collection Name Description

AllFinalStates The StateMachine's final States.

(c) Sparx Systems 2018 Page 335 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

AllStates All States within the StateMachine, including those within Submachine States.

DerivedTransitions The StateMachine's derived Transitions with the associated valid effect.

States The States within the StateMachine.

Transitions The transitions within the StateMachine.

Vertices The StateMachine's vertices.

Transition

Collection Name Description

Effects The Transition's effects.

Guards The Transition's guards.

Triggers The Transition's triggers.

Trigger

Collection Name Description

TriggeredTransitions The triggered transitions associated with the Trigger.

Vertex

Collection Name Description

DerivedOutgoingTransition The Vertex's derived outgoing transitions after traversing the pseudo-nodes.
s

IncomingTransitions The Vertex's incoming transitions.

OutgoingTransitions The Vertex's outgoing transitions.

(c) Sparx Systems 2018 Page 336 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

EASL Properties
This topic lists the EASL properties for each of the EASL objects, as retrieved by the EASL Code Generation Macros
code generation macro.

Action

Property Name Description

Behavior The Action's associated behavior (Call Behavior Action or Call Operation Action).

Body The Action's body.

Context The Action's context.

Guard The Action's guard.

IsFinal A check on whether the action is a final Action.

IsGuarded A check on whether the action is a guarded Action.

IsInitial A check on whether the action is an initial Action.

Kind The Action's kind.

Next The Action's next action.

Node The Action's associated node in the graph.

Argument

Property Name Description

Parameter The ID of the Argument's associated parameter.

Value The default value of the argument.

Behavior

Property Name Description

InitialAction The Behavior's initial action.

(c) Sparx Systems 2018 Page 337 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

isReadOnly The isReadOnly of the Behavior.

isSingleExecution The isSingleExecution of the Behavior.

Kind The kind of Behavior.

ReturnType The return type of the Behavior.

Specification The specification of the Behavior.

CallEvent

Property Name Description

Operation The operation of the CallEvent.

ChangeEvent

Property Name Description

ChangeExpression The change expression of the ChangeEvent.

Classifier

Property Name Description

HasBehaviors A check on whether the Classifier has behavioral models (Activity and Interaction).

Language The Classifier's language.

StateMachine The StateMachine of the Classifier.

Condition

Property Name Description

Expression The Condition's expression.

Lower The Condition's lower value.

(c) Sparx Systems 2018 Page 338 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Upper The Condition's upper value.

Construct

Property Name Description

GetTaggedValue The Property's Tagged Value.

IsStereotypeApplied A check on whether a particular stereotype is applied to the Property.

Notes Notes on the Property.

UMLType The UML type of the Property.

Visibility The visibility of the Property.

Edge

Property Name Description

From The ID of the node from which the Edge arises.

To The ID of the node at which the Edge is targeted.

EventObject

Property Name Description

EventKind The event kind of the Event Object.

Instance

Property Name Description

Classifier The classifier of the Instance.

Value The value of the Instance.

(c) Sparx Systems 2018 Page 339 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Parameter

Property Name Description

Direction The direction of the Parameter.

Type The type of the Parameter.

Value The value of the parameter.

Primitive

Property Name Description

FQName The FQ name of the Primitive.

ID The ID of the Primitive.

Name The name of the Primitive.

ObjectType The object type of the Primitive.

Parent The IDParent of the Primitive.

PropertyObject

Property Name Description

BoundSize The bound size of the PropertyObject (if it is a collection).

ClassifierStereoType The stereotype of the PropertyObject's classifier.

IsAsynchProp A check on whether the PropertyObject is an asynchronous property.

IsCollection A check on whether the PropertyObject is a collection.

IsOrdered A check on whether the PropertyObject is ordered (if it is a collection).

IsTimedProp A check on whether the PropertyObject is a timed property.

Kind The PropertyObject's kind.

(c) Sparx Systems 2018 Page 340 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

LowerValue The PropertyObject's lower value (if it is a collection).

Type The PropertyObject's type.

UpperValue The PropertyObject's upper value (if it is a collection).

Value The PropertyObject's value.

SignalEvent

Property Name Description

Signal The signal of the SignalEvent.

State

Property Name Description

HasSubMachine A check on whether the State is a Submachine state.

IsFinalState A check on whether the State is a final state.

SubMachine Get the ID of the Submachine contained by the State (if applicable).

StateMachine

Property Name Description

HasSubMachineState A check on whether the StateMachine has a Submachine state.

InitialState The StateMachine's initial state.

SubMachineState The StateMachine's Submachine State.

TimeEvent

Property Name Description

When The 'when' property of the TimeEvent.

(c) Sparx Systems 2018 Page 341 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Transition

Property Name Description

HasEffect A check on whether the transition has a valid effect.

IsDerived A check on whether the transition is a derived transition.

IsTranscend A check on whether the transition transcends from one StateMachine (Submachine
State) to another.

IsTriggered A check on whether the transition is triggered.

Source The Transition's source.

Target The Transition's target.

Trigger

Property Name Description

AsynchDestinationState The asynchronous destination state of the Trigger (if it is an asynchronous trigger).

DependentProperty The ID of the property associated with the Trigger.

Event The Trigger's event.

Name The Trigger's name.

Type The Trigger's type.

Vertex

Property Name Description

IsHistory A check on whether the vertex is a history state.

IsPseudoState A check on whether the vertex is a pseudo state.

PseudoStateKind The Vertex's pseudo-state kind.

(c) Sparx Systems 2018 Page 342 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 343 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Call Templates From Templates


Using function calls with parameters, you can call templates from other templates, whether standard templates or
user-defined templates created within your project. Also, called templates can return a value, and can be called
recursively.

Examples

A call statement returning a parameter to a variable:


$sSource = %StateEnumeratedName($Source)%
A call statement to a template that has parameters:
%RuleTask($GUID, $index)%
Using the $parameter statement in the called template:
$GUID = $parameter1
$index = $parameter2
Templates support recursive calls, such as this recursive call on the template RuleTask:
$GUID = $parameter1
$index = $parameter2
% PI = "" %
$nul = "Initialize condition and action object"
$count = %BR_GET("RuletCount")%
% if $count == "" or $count == $index %
%ComputeRulet($GUID)%
\n
% endTemplate %
%Rulet($index)%
\n
$index = %MATH_ADD($index, "1")%
%RuleTask($GUID, $index)%

(c) Sparx Systems 2018 Page 344 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

The Code Template Editor in MDG Development


These topics describe how you use the Code Template Editor window to create custom templates:
· Create Custom Templates
· Customize Base Templates
· Add New Stereotyped Templates
The Code Template Editor provides the facilities of the Common Code Editor, including Intelli-sense for the code
generation template macros. For more information on Intelli-sense and the Common Code Editor, see the Editing Source
Code topic.

(c) Sparx Systems 2018 Page 345 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Create Custom Templates


Enterprise Architect provides a wide range of templates that define how code elements are generated. If these are not
sufficient for your purposes - for example, if you want to generate code in a language not currently supported by
Enterprise Architect - you can create completely new custom templates. You can also add stereotype overrides to your
custom templates; for example, you might list all of your parameters and their notes in your method notes.

Access

Ribbon Code > Configure > Options > Edit Code Templates
Design > Tools > Transform > Transform Templates

Keyboard Shortcuts Ctrl+Shift+P (code generation templates)


Ctrl+Alt+H (MDA transformation templates)

Create custom templates using the Code Templates Editor

Step Description

1 In the 'Language' field, click on the drop-down arrow and select the appropriate programming language.

2 Click on the Add New Custom Template button.


The 'Create New Custom Template' dialog displays.

3 In the 'Template Type' field, click on the drop-down arrow and select the appropriate modeling object.
The '<None>' option requires special treatment; it enables the definition of a function macro that doesn't
actually apply to any of the types, but must be called as a function to define variables $parameter1,
$parameter2 and so on for each value passed in.

4 In the 'Template Name' field, type an appropriate name.


Click on the OK button.

5 On the 'Code Templates Editor' tab, the new template is included in the 'Templates' list, with the value
'Yes' in the 'Modified' field.
The template is called <Template Type>__<Template Name>.
Note the double underscore character between the template type and template name.

6 Select the template from the Templates list and edit the contents in the Template field to meet your
requirements.

7 Click on the Save button.


This stores the new template, which is now available from the list of templates for use. You can also add a
stereotype override to the template, if necessary.

(c) Sparx Systems 2018 Page 346 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Notes

· For a custom language, you must define the File template so that it can call the Import Section, Namespace and
Class templates, and any other templates that you decide are applicable

(c) Sparx Systems 2018 Page 347 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Customize Base Templates


Enterprise Architect provides a wide range of templates that define how code elements are generated. If you want to
change the way a code element is generated, you can customize the appropriate templates. Your changes might be to the
effect of the template itself, or to its calls to other templates. You can also add stereotype overrides to your customized
templates; for example, you might list all of your parameters and their notes in your method notes.
When you customize a system-provided (base) template, you effectively create a copy of the template that is used in
preference to the original. All subsequent changes are to that copy, and the original base template is hidden. If you
subsequently delete the copy it can no longer override the original, which is then brought into use again.

Access

Ribbon Code > Configure > Options > Edit Code Templates

Keyboard Shortcuts Ctrl+Shift+P

Customize a base template

Step Description

1 On the Code Template Editor, in the 'Language' field, click on the drop-down arrow and select the
programming language for which you want to customize the base templates.

2 In the Templates list, click on the base template to edit.

3 Update the template.

4 Click on the Save button to store your changes.

5 Repeat steps 2 to 4 for each of the relevant base templates you want to customize.

6 If you prefer, add one or more stereotype overrides to any of the templates.

(c) Sparx Systems 2018 Page 348 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Add New Stereotyped Templates


Sometimes it is useful to define a specific code generation template for use with elements of a given stereotype. This
enables different code to be generated for elements, depending on their stereotype. Enterprise Architect provides some
default templates, which have been specialized for commonly used stereotypes in supported languages. For example, the
'Operation Body' template for C# has been specialized for the property stereotype, so that it automatically generates its
constituent 'get' and 'set' methods. You can override the default stereotyped templates as described in the Override
Default Templates topic. Additionally, you can define templates for your own stereotypes, as described here.

Access

Ribbon Code > Configure > Options > Edit Code Templates

Keyboard Shortcuts Ctrl+Shift+P

Add a new stereotyped template using the Code Template Editor

Step Description

1 Select the appropriate language, from the Language list.

2 Select one of the base templates, from the Templates list.

3 Click on the 'Add New Stereotyped Override' button.


The 'New Template Override' dialog displays.

4 Select the required Feature and/or Class stereotype.


Click on the OK button.

5 The new stereotyped template override displays in Stereotype Overrides list, marked as modified.

6 Make the required modifications in the Code Templates Editor.

7 Click on the Save button to store the new stereotyped template in the project file.
Enterprise Architect can now use the stereotyped template, when generating code for elements of that
stereotype.

Notes

· Class and feature stereotypes can be combined to provide a further level of specialization for features; for example,
if properties should be generated differently when the Class has a stereotype MyStereotype, then both property and
MyStereotype should be specified in the New Template Override dialog

(c) Sparx Systems 2018 Page 349 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 350 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Override Default Templates


Enterprise Architect has a set of built-in or default code generation templates. The Code Templates Editor enables you to
modify these default templates, hence customizing the way in which Enterprise Architect generates code. You can
choose to modify any or all of the base templates to achieve your required coding style.
Any templates that you have overridden are stored in the project file. When generating code, Enterprise Architect first
checks whether a template has been modified and if so, uses that template. Otherwise the appropriate default template is
used.

Access

Ribbon Code > Configure > Options > Edit Code Templates

Keyboard Shortcuts Ctrl+Shift+P

Reference

Override a default code generation template using the Code Templates Editor.
When generating code, Enterprise Architect now uses the overriding template instead of the default template.

Field/Button Description

Language Select the appropriate language from the list.

Templates Select one of the base templates from the list.

Stereotype Overrides If the base template has stereotyped overrides, you can select one of these from the
list.

<Other fields> Make any other modifications required.

Save Click on this button to store the modified version of the template to the project file.
The template is marked as modified.

(c) Sparx Systems 2018 Page 351 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Grammar Framework
Enterprise Architect provides reverse engineering support for a number of popular programming languages. However, if
the language you are using is not supported, you can write your own grammar for it, using the in-built Grammar Editor.
You can then incorporate the grammar into an MDG Technology to provide both reverse engineering and code
synchronization support for your target language.
The framework for writing a grammar and importing it into Enterprise Architect is the direct complement to the Code
Template Framework. While code templates are for converting a model to a textual form, grammars are required to
convert text to a model. Both are required to synchronize changes into your source files.
An example language source file and an example Grammar for that language are provided in the Code Samples directory,
which you can access from your installation directory (the default location is C:\Program Files\Sparx Systems\EA). Two
other grammar files are also provided, illustrating specific aspects of developing Grammars.

Components

Component Description

Grammar Syntax Grammars define how a text is to be broken up into a structure, which is necessary
when you are converting code into a UML representation. At the simplest level, a
grammar is instructions for breaking up an input to form a structure.
Enterprise Architect uses a variation of Backus–Naur Form (nBNF) to include
processing instructions, the execution of which returns structured information from
the parsed results in the form of an Abstract Syntax Tree (AST), which is used to
generate a UML representation.

Grammar Editor The Grammar Editor is an in-built editor that you can use to open, edit, validate and
save grammar files.

Grammar Debugging You can debug the grammar files you create using two facilities:
· The Parser, which generates the AST for the Grammar
· The Profiler, which also parses the Grammar and generates the AST but which
exposes the Profiling pathway to show exactly what happened at each step of
the process

(c) Sparx Systems 2018 Page 352 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Grammar Syntax
Grammars define how a text is to be broken up into a structure, which is exactly what is needed when you are converting
code into a UML representation. At the simplest level, a grammar is just instructions for breaking up an input to form a
structure. Enterprise Architect uses a variation of Backus–Naur Form (BNF) to express a grammar in a way that allows it
to convert the text to a UML representation. What the grammar from Enterprise Architect offers over a pure BNF is the
addition of processing instructions, which allow structured information to be returned from the parsed results in the form
of an Abstract Syntax Tree (AST). At the completion of the AST, Enterprise Architect will process it to produce a UML
model.

Syntax

Syntax Detail

Comments Comments have the same form as in many programming languages.

// You can comment to the end of a line by adding two /s.


/* You can comment multiple lines by adding a / followed by a *.
The comment is ended when you add a * followed by a /. */

Instructions Instructions specify the key details of how the grammar works. They are generally
included at the top of the grammar, and resemble function calls in most
programming languages.

Rules Rules make up the body of a grammar. A rule can have one or more definitions
separated by pipe delimiters (|).
For a rule to pass, any single complete definition must pass. Rules are terminated
with the semi-colon character (;).

Definitions A definition is one of the paths a rule can take. Each definition is made up of one or
more terms.

Definition Lists A definition list corresponds to one or more sets of terms. These will be evaluated
in order until one succeeds. If none succeed then the containing rule fails. Each pair
of definitions is separated by a | character.
This is a simple rule with three definitions:
<greeting> ::= "hello" | "hi" | ["good"] "morning";

Terms A term can be a reference to a rule, a specific value, a range of values, a sub-rule or
a command.

Commands Like instructions, commands resemble function calls. They serve two main
purposes:
· To process tokens in a specific way or
· To provide a result to the caller

(c) Sparx Systems 2018 Page 353 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Grammar Instructions
Instructions specify the key details of how the grammar works. They are generally included at the top of the grammar,
and resemble function calls in most programming languages.

Instructions

Instruction Description

caseSensitive() One of these two instructions is expected to specify if token matching needs to be
case sensitive or not. For example, languages in the BASIC family are case
insensitive while languages in the C family are case sensitive.

caseInsensitive()

delimiters(DelimiterRule: The delimiters instruction tells the lexical analyzer which rule to use for delimiter
Expression) discovery. Delimiters are used during keyword analysis, and can be defined as the
characters that can be used immediately before or after language keywords.

lex(TokenRule: The lex instruction tells the lexical analyzer the name of the root rule to use for its
Expression) analysis.

parse(RootRule: The parse instruction tells the parser the name of the root rule to use for its
Expression) processing. The optional second argument specifies a skip (or escape) rule, which is
parse(RootRule: generally used to handle comments.
Expression, SkipRule:
Expression)

(c) Sparx Systems 2018 Page 354 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Grammar Rules
Rules are run to break up text into structure. A rule is made up of one or more definitions, each of which is made up of
one or more terms.

Types of Rule

Rule Description

Named rules A name, followed by a definition list. For example:


<rule> ::= <term1> <term2> | "-" <term1>;

Inline Rules Inside a definition, a rule defined within parentheses. These act in exactly the same
way as if they were a named rule being called by a term. For example:
<rule> ::= (<inline>);

Optional Rules Inside a definition, a rule defined within square brackets. This rule succeeds even if
the contents fail. For example:
<rule> ::= [<inline>];

Repeating Rules Inside a definition, a term followed by a plus sign. This rule matches the inner rule
once or more than once. For example:
<rule> ::= <inline>+;
rule ::= (<term1> <term2>)+;

Optional Repeating Rules Inside a definition, a rule followed by a star. This rule matches the inner rule zero
or more times, meaning it succeeds even if the inner rule never succeeds. For
example:
<rule> ::= <inline>*;
rule ::= (<term1> <term2>)*;

(c) Sparx Systems 2018 Page 355 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Grammar Terms
Terms identify where tokens are consumed.

Types of Term

Type Description

Concrete terms Quoted strings.


For example, "class"

Unicode characters A lexer-only term, having the prefix of U+0x followed by a hexadecimal number.
For example: U+0x1234

Ranges A lexer-only term, matching any character between the two characters specified.
For example, "a".."z" or U+0x1234..U+2345

References The name of another rule, in angled brackets. The token will match if that rule
succeeds.
For example, <anotherRule>

Commands A call to a specific command.

(c) Sparx Systems 2018 Page 356 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Grammar Commands
Commands, like Instructions, resemble function calls. They serve two main purposes:
· To process tokens in a specific way or
· To provide a result to the caller

Commands

Command Description

attribute(Name: String, Creates an attribute on the current AST node. The attribute will be created with the
Value: Expression) Name specified in the grammar source, and will be given the value of all tokens
consumed as a part of executing the Value expression.
This command produces the AST node attributes that Enterprise Architect operates
on in code engineering.

attributeEx(Name: String) Creates an attribute on the current AST node without consuming any tokens. The
attributeEx(Name: String, attribute will be created with the same name as is specified in the grammar source,
Value: String) and with either an empty value or the value specified by the optional Value
argument.
This command produces the AST node attributes that Enterprise Architect operates
on in code engineering.

node(Name: String, Target: Creates an AST node under the current AST node (the nodes that Enterprise
Expression) Architect operates on in code engineering). The node will be created with the Name
specified in the grammar source.

token(Target: Expression) Creates a token during lexical analysis for processing during parsing. The value of
the token will be the value of all characters consumed as a result of executing the
Target expression.

keywords() Matches any literal string used as a grammar term; that is, if you enter an explicit
string that you are searching for, it becomes a key word.

skip(Target: Expression) Consumes input data (characters when lexing, and tokens when parsing) until the
skip(Target: Expression, 'Target' expression is matched. The optional 'Escape' expression can be used to
Escape: Expression) handle instances such as escaped quotes within strings.

skipBalanced(Origin: Consumes input data (characters or tokens) until the 'Target' expression is matched
Expression, Target: and the nesting level reaches zero. If the 'Origin' expression is matched during this
Expression) process, the nesting level is increased. If the 'Target' expression is matched, the
skipBalanced(Origin: nesting level is decreased. When the nesting level reaches zero, the command exits
Expression, Target: with success. An optional 'Escape' expression can be provided.
Expression, Escape:
Expression)

skipEOF() Consumes all remaining data (characters or tokens) until the end of the file.

fail() Causes the parser to fail the current rule, including any remaining definitions.

(c) Sparx Systems 2018 Page 357 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

warning() Inserts a warning into the resulting AST.

except(Target: Expression, Consumes input data that matches the Target expression, but fail on data that
Exception: Expression) matches the Exception expression. This operates somewhat similar to, but exactly
the opposite of, the skip command.

preProcess(Target: Evaluates an expression and uses that pre-processed data in multiple definitions.
Expression) This is most useful within expression parsing, where the same left hand side
expression will be evaluated against a number of operators. This command reduces
the work the parser must do to make this happen.

(c) Sparx Systems 2018 Page 358 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

AST Nodes
In defining a grammar, you would use AST nodes and AST node attributes that can be recognized in code engineering in
Enterprise Architect, in the AST results that are returned by the attribute, attributeEx and node commands. The nodes
and attributes are identified in these tables. Any others will be ignored in code engineering.

FILE Node

The FILE node represents a file. It isn't mapped to anything, but contains all the required information.

Multiplicity / Nodes Description

0..* / PACKAGE See PACKAGE Node.

0..* / CLASS See CLASS Node.

0..* / IMPORT

0..* / COMMENT Field labels as part of a skip rule will be at the root level; the code generator looks
for comments of this sort by position relative to the node.

0..1 / This gives the position where new Classes, Packages and method implementations
INSERT_POSITION can be inserted into the file. If it is not found, the code generator will automatically
insert new items immediately after the last one is found in code.

PACKAGE node

The PACKAGE node corresponds to a namespace or equivalent in the file. When importing with 'package per
namespace', Enterprise Architect will create a Package directly under the import for this and place all Classes within it.
When not importing namespaces, Enterprise Architect will look for Classes under this point, but it will do nothing with
this node.
Additionally, if you are generating with namespaces enabled (see the Code Options topics for generic languages) a
generated Class will not match a Class in code unless they are under the same Package structure.
Contained in nodes: FILE

Multiplicity / Nodes Description

1 / NAME See NAME Node.

0..* / CLASS See CLASS Node.

0..* / PACKAGE

0..1 / OPEN_POSITION Gives the position where the Package body opens. This can also be used as an insert
position.

0..1 / Gives the position where new Classes and Packages can be inserted into the file. If
INSERT_POSITION it is not found, the code generator will automatically insert new items immediately
after the last one is found in code.

(c) Sparx Systems 2018 Page 359 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

0..1 / SUPPRESS Prevents indenting when inserting into this Package.

CLASS/INTERFACE Node

The CLASS (or INTERFACE) node is the most important in code generation. It is brought in as Class (or Interface)
Objects.
See Class DECLARATION and Class BODY.
Contained in Nodes: FILE, PACKAGE, Class BODY

CLASS Declaration

Contained in Nodes: CLASS/INTERFACE

Multiplicity / Nodes Description

1 / NAME See NAME Node.

0..* / PARENT See PARENT Node.

0..* / TAG See TAG Node.

0..1 / DESCRIPTION See DESCRIPTION Node.

1 / NAME The name of the Class. If there is a node NAME, that will overwrite this attribute.

0..1 / SCOPE The UML Scope of the Class - Public, Private, Protected or Package.

0..1 / ABSTRACT If present, indicates that this is an abstract Class.

0..1 / VERSION The version of the Class.

0..1 / STEREOTYPE The stereotype that Enterprise Architect should assign to the Class. This does not
support multiple stereotypes.

0..1 / ISLEAF

0..1 / MULTIPLICITY

0..1 / LANGUAGE Generally, you do not need to set this.

0..1 / NOTE Generally not used as it is addressed by the comments above the Class.

0..1 / ALIAS

0..* / MACRO Adds a numbered Tagged Value that Enterprise Architect can use to round trip
macros.

(c) Sparx Systems 2018 Page 360 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Class BODY Node

Contained in Nodes: CLASS/INTERFACE

Multiplicity / Nodes Description

0..* / METHOD See METHOD Node.

0..* / ATTRIBUTE See ATTRIBUTE Node.

0..* / FIELD See FIELD Node.

0..* / CLASS See CLASS Node.

0..* / SCOPE See SCOPE Node.

0..* / PROPERTY

0..* / TAG See TAG Node.

0..* / PARENT See PARENT Node.

0..1 / OPEN_POSITION Gives the position where the Class body opens. This can also be used as an insert
position.

0..1 / Gives the position where new Class members can be inserted into the file. If it is
INSERT_POSITION not found, the code generator will automatically insert new items immediately after
the last one is found in code.

SCOPE Node

This is an optional feature for languages resembling C++ that have Blocks that specify the scope of elements. The
language needs to have a name specified that is used for the scope of all elements in the Block. In all other respects it
behaves identically to the Class BODY node.
Contained in Nodes: Class BODY

Multiplicity / Nodes Description

1 / NAME Used as the scope for all methods and attributes contained within the scope.

METHOD Node

Contained in Nodes: Class BODY, SCOPE

Multiplicity / Nodes Description

(c) Sparx Systems 2018 Page 361 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

1 / Method See Method DECLARATION Node.


DECLARATION

Method DECLARATION Node

Contained in Nodes: METHOD

Multiplicity / Nodes Description

0..1 / TYPE See TYPE Node.

0..* / PARAMETER See PARAMETER Node.

0..* / TAG See TAG NODE.

0..1 / DESCRIPTION See DESCRIPTION Node.

0..1 / MULTI Supports Delphi's parameter list style of declaration. This is the equivalent of
PARAMETER FIELD.

1 / NAME

0..1 / TYPE

0..1 / SCOPE

0..1 / ABSTRACT

0..1 / STEREOTYPE

0..1 / STATIC

0..1 / CONST or
CONSTANT

0..1 / PURE

0..1 / ISQUERY

0..1 / ARRAY

0..1 / SYNCHRONIZED

0..* / MACRO

0..1 / Specifies special behavior for C#.


CSHARPIMPLEMENTS

0..1 / BEHAVIOR Provides support for Aspect J, using behavior.

(c) Sparx Systems 2018 Page 362 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

0..1 / SHOWBEHAVIOR Provides support for Aspect J, using behavior, and shows the reverse-engineered
behavior on the diagram.

ATTRIBUTE Node

Contained in Nodes: Class BODY, SCOPE

Multiplicity / Nodes Description

1 / TYPE See TYPE Node.

0..* / TAG See TAG Node.

0..1 / DESCRIPTION See DESCRIPTION Node.

1 / NAME

0..1 / TYPE

0..1 / SCOPE

0..1 / DEFAULT

0..1 / CONTAINER or
ARRAY

0..1 / CONTAINMENT Reference or value.

0..1 / STEREOTYPE

0..1 / STATIC

0..1 / CONST or
CONSTANT

0..1 / ORDERED

0..1 / LOWBOUND

0..1 / HIGHBOUND

0..1 / TRANSIENT or
VOLATILE

FIELD Node

A field corresponds to multiple attribute declarations in one. Anything not defined in the Declarators but defined in the
field itself will be set for each declarator. Everything supported in an attribute is supported in the field. If no declarators

(c) Sparx Systems 2018 Page 363 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

are found then this works in the same way as an attribute.


Contained in Nodes: Class BODY, SCOPE

Multiplicity / Nodes Description

0..* / DECLARATOR See ATTRIBUTE Node.

PARAMETER Node

Contained in Nodes: Method DECLARATION, TEMPLATE

Multiplicity / Nodes Description

1 / TYPE See TYPE Node.

0..* / TAG See TAG Node.

0..1 / DESCRIPTION See DESCRIPTION Node.

0..1 / NAME

0..1 / TYPE

0..1 / KIND Expected to be in, inout, out or return.

0..1 / DEFAULT

0..1 / FIXED

0..1 / ARRAY

NAME Node

Contained in Nodes: PACKAGE, Class DECLARATION

Multiplicity / Nodes Description

1 / NAME

0..* / QUALIFIER

0..* / NAMEPART An alternative to using NAME and QUALIFIER. A string of values, all except the
last one taken as qualifiers. The last one is taken as the Name.

TYPE Node

(c) Sparx Systems 2018 Page 364 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Contained in Nodes: Method DECLARATION, ATTRIBUTE, PARAMETER

Multiplicity / Nodes Description

0..1 / TEMPLATE The entire text of the template is the name of the type.
Only used if NAME is undefined.
See TEMPLATE Node.

1 / NAME

0..* / QUALIFIER

0..* / NAMEPART An alternative to using NAME and QUALIFIER. A string of values, all except the
last one taken as qualifiers. The last one is taken as the Name.

TEMPLATE Node

Contained in Nodes: TYPE

Multiplicity / Nodes Description

0..* / PARAMETER See PARAMETER Node.

1 / NAME

PARENT Node

Contained in Nodes: Class DECLARATION

Multiplicity / Nodes Description

0..1 / TYPE Has the value Parent, Implements or VirtualP.

1 / NAME

0..* / QUALIFIER

0..* / NAMEPART An alternative to using NAME and QUALIFIER. A string of values, all except the
last one taken as qualifiers. The last one is taken as the Name.

0..1 / INSTANTIATION

TAG Node

Contained in Nodes: Class DECLARATION, Method DECLARATION, ATTRIBUTE, PARAMETER

(c) Sparx Systems 2018 Page 365 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Multiplicity / Nodes Description

1 / NAME

0..* / VALUE

0..1 / MEMO

0..1 / NOMEMO

0..1 / GROUP

DESCRIPTION Node

Contained in Nodes: Class DECLARATION, Method DECLARATION, ATTRIBUTE, PARAMETER

Multiplicity / Nodes Description

0..* / VALUE

(c) Sparx Systems 2018 Page 366 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Editing Grammars
If you need to write and edit a grammar for code imported in a new programming language, you can do so using the
built-in Grammar Editor.

Access

Ribbon Code > Schema > Grammars

Create and Edit Grammar

Field/Button Action

Open Grammar Display a browser through which you can locate and open the file containing the
grammar you want to edit.

Recent Recently used grammars can be quickly accessed using this combo box.

Save Save the current file.

Save As Saves a copy of the current file

Validate Grammar The grammar validation will run a series of tests on the current grammar to ensure
its validity. Errors and warnings will be displayed informing you of both errors that
will make the grammar unusable, and conditions where you might get unexpected
results.

Help Display this Help topic.

Context Menu Options

Field/Button Action

Open File Display a browser through which you can locate and open the file containing the
grammar you want to edit.

Validate The grammar validation will run a series of tests on the current grammar to ensure
its validity. Errors and warnings will be displayed informing you of both errors that
will make the grammar unusable, and conditions where you might get unexpected
results.

Language The Grammar Editor defaults to normal Backus–Naur Form (nBNF). The mBNF
option is also available.

(c) Sparx Systems 2018 Page 367 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Line Numbers Turn line numbers on or off in the grammar editor.

(c) Sparx Systems 2018 Page 368 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Parsing AST Results


The Abstract Syntax Tree (AST) is the code that Enterprise Architect sees as it processes a grammar.
You parse the text in the bottom half of the Grammar Editor window and review what is displayed as a result. You can
either open a file or paste text in. If you have pasted text that corresponds to something that cannot appear at the file level
(such as Operation Parameters) you can select an alternative rule to use as a starting point. The parse will then commence
from that rule.

Access

Ribbon Code > Schema > Grammars > Grammar Debugger > AST Results

Toolbar Options

Option Action

Open File Open a sample input file to test against.

Recent Recently opened source files can be selected from this combo box.

Parse Perform the parse operation. If the parse is successful, the 'AST Results' tab will
contain the resulting AST.

Select Rule This drop down allows you to select an alternative root rule for processing your
sample source.

Help Display this Help topic.

(c) Sparx Systems 2018 Page 369 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Profiling Grammar Parsing


When you parse a grammar that you have created, it might show errors that you cannot immediately diagnose. To help
you resolve such errors, you can review the process that the parser followed to generate the AST you can see, using the
Grammar Profiler.
You again parse the text in the bottom half of the Grammar Editor window, but this time the tree shows each rule that the
parser attempted, where it got to and if it passed or not. Rules for opening a file, pasting a file and setting the starting rule
remain the same.

Access

Ribbon Code > Schema > Grammars > Grammar Debugger > Profiler Results

Toolbar Options

Option Action

Open File Display a browser through which you can locate and open the file containing the
grammar you want to edit.

Parse Perform the parse operation. If the parse is successful, the 'AST Results' tab will
contain the resulting AST, and the 'Profile Results' tab will contain debug
information regarding the path that the parser took through your grammar. The
profile data is extremely useful when debugging a new grammar.

Select Rule If you want to use a different root rule for processing your sample source, click on
the drop-down arrow and select the alternative rule.

Help Display this Help topic.

Notes

· Because profiling can take a very long time for large files, the 'Profile Results' tab is not filled if you are not
displaying that tab when you begin parsing

(c) Sparx Systems 2018 Page 370 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Macro Editor
The macro editor allow a user to supplement the grammar with a list of keywords and rules to exclude macros during
grammar parse operations. The macro definition list is particularly useful when developing grammars for languages that
support macros such as C++. It avoids the necessity of describing these rules in the grammar itself, and can be used with
multiple grammars.
This feature is available from Enterprise Architect Release 14.1.

Access

Ribbon > Code > Grammar Editor > Macro Editor

Editing Macros

Open File Open an existing macro definition list

Recent Recently opened macro definition lists can be selected from this combo box

Save Saves changes to the opened macro definition list

Save As Saves a copy of the existing macro definition list

Validate Validates the grammar of the macro definition list

(c) Sparx Systems 2018 Page 371 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

Example Grammars
The Code Samples directory set up by the Enterprise Architect installer contains an example Grammar that you can load
into the Grammar editor to review, and into the Grammar Debugger to parse and profile.
The Grammar example consists of two files:
· test.ssl - a simple sample language source file, in the style of C, and
· ssl.nbnf - a grammar for the simple sample language
The example illustrates:
· Tokenization (using the Lexer)
· Creation of a Package
· Creation of a Class or Interface
· Creation of an attribute
· Creation of an operation (with parameters)
· Importing comments
The Code Samples directory also contains two other Grammar files that you can examine:
· Expressions Sample.nBNF - this illustrates how expression parsing is set up and processed, with detailed comment
text providing explanations
· CSV Sample.nBNF - an example grammar for processing CSV files

(c) Sparx Systems 2018 Page 372 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019

(c) Sparx Systems 2018 Page 373 of 373 Created with Enterprise Architect

You might also like