Software Modeling Fundamentals
Software Modeling Fundamentals
Software Modeling
Fundamentals
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
Usage Quickly browse element usage across all diagrams. Perform powerful element
searches using sophisticated queries.
(c) Sparx Systems 2018 Page 9 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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
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
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
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
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.
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.
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
Step Detail
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
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.
(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.
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
Access
Ribbon Code > Source Code > Synchronize > Synchronize Package
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
(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 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
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.
Language
Action Script
(c) Sparx Systems 2018 Page 23 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
C#
C++
Delphi
Java
PHP
Python
Visual Basic
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.
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.
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.
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.
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.
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
Step Action
1 In the Project Browser, select (or add) a diagram into which to import the Classes.
3 From the file browser that appears, locate and select one or more source code files to import.
(c) Sparx Systems 2018 Page 27 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Notes
Language Notes
(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.
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
Access
Ribbon Code > Import > File > Import Resource Script
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.
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
(c) Sparx Systems 2018 Page 31 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Code > Import > File > Import Source Directory
Step Action
(c) Sparx Systems 2018 Page 32 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Code > Import > File > Import Binary Module
Use
(c) Sparx Systems 2018 Page 33 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 34 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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
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
(c) Sparx Systems 2018 Page 39 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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
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
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
(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
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
Access
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.
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
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
Context Menu Right-click on selected text | Search for <selected text> | Search in Files
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 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.
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
(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
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
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
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
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 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 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
Key Description
(c) Sparx Systems 2018 Page 65 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 66 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Shift+Insert Paste
Ctrl+keypad(+) Zoom in
Ctrl+Z Undo
Ctrl+Y Redo
Ctrl+V Paste
(c) Sparx Systems 2018 Page 67 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
F2 Go to next bookmark
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
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
Generate Models
(c) Sparx Systems 2018 Page 69 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Option Action
Name Displays the Application Patterns available for the selected technology; select the
required Pattern to import.
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
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
(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'.
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
4:26 PM
Title Book Title Blurb Overview of the story for the user
to read.
Year Year published
Author1
Book1
Book2
Book3
Author2
Author3
Book1
Book2
4:26 PM
Stopwatch
Total
00
Lap
00
Access
On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or 'Android'.
(c) Sparx Systems 2018 Page 74 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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
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
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
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
3G 4:26 PM
T itle
Enabled
Option1
Option4 Next
3G 4:26 PM
File Search
Item
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
Access
On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or 'Apple'.
(c) Sparx Systems 2018 Page 82 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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)
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
(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
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
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
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)
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
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 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
Business Charting
3rd quarter
Previous Next
᛫᛫᛫
Access
On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or 'Windows
Phone'.
(c) Sparx Systems 2018 Page 90 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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.
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)
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
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
Object position
Position Orientation
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
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)
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
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.
(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.
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
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
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.
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
Text Field Generates a text element with a pale border, the text being the element name,
representing a simple data entry field.
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
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
Similar Items
Access
On the Diagram Toolbox, click on to display the 'Find Toolbox Item' dialog and specify 'Wireframing' or
'Webpage'.
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.
Step Action
1 Open the EAExample.eap file by selecting the 'Start > Help > Help > Open the Example Model' ribbon
option.
(c) Sparx Systems 2018 Page 109 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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.
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.
Step Action
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
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.
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.
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.
You can also use two macros in the code generation for StateMachines.
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
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:
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
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]
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.
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)
(c) Sparx Systems 2018 Page 115 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
(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
Operations
Operation Description
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
Actions
Action Description
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
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.
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
(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
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.
(c) Sparx Systems 2018 Page 130 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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.
(c) Sparx Systems 2018 Page 131 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
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
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
Access
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
The UI Toolbox
(c) Sparx Systems 2018 Page 135 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
This window is where all the properties of a control can be viewed and edited.
(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
(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.
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
Model-Specific Options
Access
Ribbon Configure > Model > Options > Source Code Engineering
Types of Option
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
Access
On the 'Preferences' dialog, click on 'Source Code Engineering' in the left-hand list.
(c) Sparx Systems 2018 Page 141 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Types of Option
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.
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
Access
Ribbon Configure > Model > Options > Source Code Engineering
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
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
Access
Ribbon Configure > Model > Options > Source Code Engineering: Component Types
Option Action
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.
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
Access
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
(c) Sparx Systems 2018 Page 146 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
Access
On the 'Preferences' dialog, select the 'Source Code Engineering > Code Editors' option.
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
(c) Sparx Systems 2018 Page 149 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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.
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
C#
C++
Delphi
Java
PHP
Python
Visual Basic
(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.
Tagged Values
Tag Applies To
(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
(c) Sparx Systems 2018 Page 158 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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.
Tagged Values
Tag Applies To
IsAccess Parameter
Corresponds To: Determination of whether the parameter is an access variable.
(c) Sparx Systems 2018 Page 159 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Other Conventions
-- 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
Tagged Values
Tag Applies To
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.
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
UML C Code
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
(c) Sparx Systems 2018 Page 163 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Stereotypes
Stereotype Applies To
enumeration Class
Corresponds To: An enumerated type.
struct Class
Corresponds To: A 'struct' type.
typedef Class
Corresponds To: A 'typedef' statement, where the parent is the original type name.
union Class
Corresponds To: A union type.
Tagged Values
Tag Applies To
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.
(c) Sparx Systems 2018 Page 164 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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.
· 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
const Attribute
(c) Sparx Systems 2018 Page 166 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
delegate Operation
Corresponds To: The 'delegate' keyword.
extern Operation
Corresponds To: The 'extern' keyword.
fixed Attribute
Corresponds To: The 'fixed' keyword.
generic Operation
Corresponds To: The generic parameters for this 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.
override Operation
Corresponds To: The 'override' keyword.
params Parameter
Corresponds To: A parameter list using the 'params' keyword.
(c) Sparx Systems 2018 Page 167 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
sealed Operation
Corresponds To: The 'sealed' keyword.
static Class
Corresponds To: The 'static' keyword.
virtual Operation
Corresponds To: The 'virtual' keyword.
Other Conventions
(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.
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.
(c) Sparx Systems 2018 Page 169 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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.
throws Operation
Corresponds To: The exceptions that are thrown by this method.
typeSynonyms Class
Corresponds To: The 'typedef' name and/or fields of this type.
volatile Operation
Corresponds To: The 'volatile' keyword.
Other Conventions
(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
Stereotypes
Stereotype Applies To
property Operation
Corresponds To: The '__property' keyword.
reference Class
Corresponds To: The '__gc' keyword.
value Class
Corresponds To: The '__value' keyword.
Tagged Values
Tag Applies To
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.
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
generic Operation
Description: Defines the generic parameters for this Operation.
initonly Attribute
Description: Corresponds to the 'initonly' keyword.
literal Attribute
Description: Corresponds to the literal keyword.
(c) Sparx Systems 2018 Page 173 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Other Conventions
(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.
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.
struct Class
Corresponds To: A record type.
Tagged Values
Tag Applies To
(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
(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.
enumeration Class
Corresponds To: An enumerated type.
operator Operation
Corresponds To: An operator.
Tagged Values
Tag Applies To
annotations Anything
Corresponds To: The annotations on the current code feature.
(c) Sparx Systems 2018 Page 177 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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'.
Tagged Values
Tag Applies To
Common Conventions
PHP 5 Conventions
(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
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.
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.
Tagged Values
Tag Applies To
(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++
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.
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
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
Handles Operation
Corresponds To: The 'handles' clause on this operation.
Implements Operation
Corresponds To: The 'implements' clause on this operation.
MustOverride Operation
Corresponds To: The 'MustOverride' 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.
Shared Attribute
Corresponds To: The 'Shared' keyword.
(c) Sparx Systems 2018 Page 186 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Other Conventions
(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.
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
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.
Access: 'Design > Diagram > Toolbox : 'Hamburger' icon > HDL | Verilog Constructs'
Drag these icons onto a diagram to model a Verilog design.
Item Action
(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.
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.
synchronous Method
Corresponds To: A synchronous process.
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
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.
(c) Sparx Systems 2018 Page 191 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Item Action
Item Action
(c) Sparx Systems 2018 Page 192 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Stereotypes
Stereotype Applies To
global Attribute
Corresponds To: The 'Global' keyword.
import Operation
Corresponds To: An operation to be imported from another library.
Tagged Values
Tag Applies To
attribute_name Operation with stereotype property get, property set or property let
Corresponds To: The name of the variable behind this property.
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>
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
Visual Basic
(c) Sparx Systems 2018 Page 195 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 196 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Start > View > Preferences > Source Code Engineering > ActionScript
Options
Option Action
Disable Language Leave this checkbox unselected to support ActionScript code generation.
Select this checkbox to disable ActionScript code support.
Notes
(c) Sparx Systems 2018 Page 197 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > Ada
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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > ArcGIS
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
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
Options
Option Action
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
(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#
Options
Option Action
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
(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
Access
Ribbon Start > View > Preferences > Source Code Engineering > C++
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
(c) Sparx Systems 2018 Page 208 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > Delphi
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
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.
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > Java
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)
(c) Sparx Systems 2018 Page 214 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
Access
Ribbon Start > View > Preferences > 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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > Python
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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > SystemC
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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > VB.Net
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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > Verilog
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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > VHDL
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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > Visual Basic
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
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
Access
Ribbon Start > View > Preferences > Source Code Engineering > MDG
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.
Default Source Directory The default directory to save generated source files.
This is always shown.
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.
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.
4 Change the options, and click on the Close button to apply the changes.
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
(c) Sparx Systems 2018 Page 232 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
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
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
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.
(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
Access
Ribbon Code > Configure > Options > Edit Code Templates
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
CTF Templates
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
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.
(c) Sparx Systems 2018 Page 248 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Code > Configure > Options > Edit Code Templates
Design > Tools > Transform > Transform 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.
Template Description
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 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.
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.
Templates for generating code for languages with separate interface and
implementation sections
Template Description
Class Body Impl Used by the Class Impl template to generate the implementation of Class members.
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
Access
Ribbon Configure > Model > Transfer > Export Reference Data
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.
3 When prompted to do so, enter a valid file name with a .xml extension.
(c) Sparx Systems 2018 Page 254 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Configure > Model > Transfer > Import Reference Data
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
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.
(c) Sparx Systems 2018 Page 256 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 257 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 258 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 259 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 260 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Code > Configure > Options > Edit Code Templates
Options
Option Action
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
Syntax Elements
Elements Detail
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.
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
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
Definition Rules
Examples
(c) Sparx Systems 2018 Page 265 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Variable References
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%
(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
(c) Sparx Systems 2018 Page 268 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
· 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
Project Macros
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
(c) Sparx Systems 2018 Page 272 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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 Macros
attClassifierGUID The unique GUID for the classifier of the current attribute.
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
(c) Sparx Systems 2018 Page 275 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Class Macros
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.)
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.
classModified The date and time the Class was last modified.
classQualName The Class name prefixed by its outer Classes. Class names are separated by double
colons (::).
(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.
(c) Sparx Systems 2018 Page 278 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 279 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
genOptDefaultAssocAttNa Source Code Engineering page: Default name for associated attribute.
me
(c) Sparx Systems 2018 Page 280 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
genOptGenCapitalisedProp 'Source Code Engineering' page: 'Capitalize Attribute Names for Properties'
erties checkbox.
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.
(c) Sparx Systems 2018 Page 281 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
genOptPropertyPrefix 'Source Code Engineering' page: Remove prefixes when generating Get/Set
properties.
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 Macros
connectorDestAllowDuplic Connector 'Properties' dialog, 'Target Role' tab: 'Allow Duplicates' checkbox.
ates
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
(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
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
(c) Sparx Systems 2018 Page 285 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 286 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Constraint Macros
(c) Sparx Systems 2018 Page 287 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Effort Macros
(c) Sparx Systems 2018 Page 288 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
File Macros
fileNameImpl The filename of the implementation file for this generation, if applicable.
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
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
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
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 Macros
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).
(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).
(c) Sparx Systems 2018 Page 292 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 293 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Metric Macros
(c) Sparx Systems 2018 Page 294 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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).
opMacros A space-separated list of macros defined in the declaration for this operation.
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.
(c) Sparx Systems 2018 Page 295 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 296 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Package Macros
packagePath The string representing the hierarchy of Packages, for the Class in scope. Each
Package name is separated by a dot (.).
(c) Sparx Systems 2018 Page 297 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Parameter Macros
paramClassifierGUID The unique GUID for the classifier of the current parameter.
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.
(c) Sparx Systems 2018 Page 298 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Problem Macros
(c) Sparx Systems 2018 Page 299 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Requirement Macros
(c) Sparx Systems 2018 Page 300 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Resource Macros
(c) Sparx Systems 2018 Page 301 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Risk Macros
(c) Sparx Systems 2018 Page 302 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Scenario Macros
scenarioGUID The unique ID for a scenario. Identifies the scenario unambiguously within a
model.
(c) Sparx Systems 2018 Page 303 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
(c) Sparx Systems 2018 Page 305 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 306 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Test Macros
testClass Testing window: Test Class (the type of test defined: Unit, Integration, System,
Acceptance, Inspection, Scenario)
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'.)
(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) Sparx Systems 2018 Page 308 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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_COMMENT([wrap_length])
Converts the notes for the element currently in scope to Delphi comments.
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])
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])
LENGTH([src])
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
Substring of [src] starting at [start] and including [count] characters. Where [count] is omitted the rest of the string is
included.
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.
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])
TO_LOWER([string])
TO_UPPER([string])
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
VB_COMMENT([wrap_length])
Converts the notes for the element currently in scope to Visual Basic style comments.
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.
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
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'.
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
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
PI Characteristics
(c) Sparx Systems 2018 Page 320 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
stmEventEnum The name of the Event with the prefix 'ENUM_', all upper case.
(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.
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.
stmSignalName The name of the Signal with spaces and asterixes removed.
stmSignalVariable The name of the Signal with the prefix 'm_' in lower case.
Context
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.
stmContextVariableRunstat
eName
stmContextVariableRunstat
eValue
(c) Sparx Systems 2018 Page 324 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
StateMachine
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.
stmSubmachineInitialCoun The number of Initial elements in the Sub Machine State element.
t
Region
stmRegionEnum The name of the State Region plus 'ENUM_' plus the name of the State Region in
upper case.
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.
stmRegionInitial
Transition
stmTransitionEnum The name of the Transition with the prefix 'ENUM_', plus the name of the
Transition in upper case.
stmTransitionName The name of the Transition with spaces and asterixes removed.
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.
(c) Sparx Systems 2018 Page 326 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
stmTargetInitialTransition
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.
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
stmHistoryOwningRegionI
nitialTransition
stmDefaultHistoryTransitio
n
stmPseudostateKind The kind of the Pseudostate; one of 'initial', 'deepHistory', 'shallowHistory', 'join',
'fork', 'junction', 'choice', 'entryPoint', 'exitPoint' or 'terminate'.
stmPseudostateVariable The name of the Pseudostate with the prefix 'm_' in lower case.
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 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).
stmStateSubmachineVariab The name of the Submachine with the prefix 'm_' in lower case.
le
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
stmStateContainerMatchTr
ansitionContainer
stmVertexRegionIndex
stmVertexContainerVariabl
e
stmVertexParentEnum
stmStateHasUnGuardedCo
mpletionTransition
stmStateEventHasUnGuard
edTransition
stmInitialTransition
Instance Association
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_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
(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
EASL_END
Aspect Description
Syntax %EASL_END%
· 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
Behavior
Classifier
(c) Sparx Systems 2018 Page 334 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Construct
Node
State
StateMachine
(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.
Transition
Trigger
Vertex
DerivedOutgoingTransition The Vertex's derived outgoing transitions after traversing the pseudo-nodes.
s
(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
Behavior The Action's associated behavior (Call Behavior Action or Call Operation Action).
Argument
Behavior
(c) Sparx Systems 2018 Page 337 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
CallEvent
ChangeEvent
Classifier
HasBehaviors A check on whether the Classifier has behavioral models (Activity and Interaction).
Condition
(c) Sparx Systems 2018 Page 338 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Construct
Edge
EventObject
Instance
(c) Sparx Systems 2018 Page 339 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Parameter
Primitive
PropertyObject
(c) Sparx Systems 2018 Page 340 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
SignalEvent
State
SubMachine Get the ID of the Submachine contained by the State (if applicable).
StateMachine
TimeEvent
(c) Sparx Systems 2018 Page 341 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Transition
IsTranscend A check on whether the transition transcends from one StateMachine (Submachine
State) to another.
Trigger
AsynchDestinationState The asynchronous destination state of the Trigger (if it is an asynchronous trigger).
Vertex
(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
Examples
(c) Sparx Systems 2018 Page 344 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
(c) Sparx Systems 2018 Page 345 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Code > Configure > Options > Edit Code Templates
Design > Tools > Transform > Transform Templates
Step Description
1 In the 'Language' field, click on the drop-down arrow and select the appropriate programming language.
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.
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.
(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
Access
Ribbon Code > Configure > Options > Edit Code Templates
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.
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
Access
Ribbon Code > Configure > Options > Edit Code Templates
Step Description
5 The new stereotyped template override displays in Stereotype Overrides list, marked as modified.
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
Access
Ribbon Code > Configure > Options > Edit Code Templates
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
Stereotype Overrides If the base template has stereotyped overrides, you can select one of these from the
list.
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
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
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
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>
(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
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.
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
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
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
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 / 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 / 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
0..* / PROPERTY
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
1 / NAME Used as the scope for all methods and attributes contained within the scope.
METHOD Node
(c) Sparx Systems 2018 Page 361 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
(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
1 / NAME
0..1 / TYPE
0..1 / SCOPE
0..1 / DEFAULT
0..1 / CONTAINER or
ARRAY
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
PARAMETER Node
0..1 / NAME
0..1 / TYPE
0..1 / DEFAULT
0..1 / FIXED
0..1 / ARRAY
NAME 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.
TYPE Node
(c) Sparx Systems 2018 Page 364 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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
1 / NAME
PARENT 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.
0..1 / INSTANTIATION
TAG Node
(c) Sparx Systems 2018 Page 365 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
1 / NAME
0..* / VALUE
0..1 / MEMO
0..1 / NOMEMO
0..1 / GROUP
DESCRIPTION Node
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
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.
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.
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
(c) Sparx Systems 2018 Page 368 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
Access
Ribbon Code > Schema > Grammars > Grammar Debugger > AST Results
Toolbar Options
Option Action
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.
(c) Sparx Systems 2018 Page 369 of 373 Created with Enterprise Architect
User Guide - Software Modeling Fundamentals 16 January, 2019
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.
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
Editing Macros
Recent Recently opened macro definition lists can be selected from this combo box
(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