Enterprise Architect HowTo

Enterprise Architect HowTo

Below some tips and tricks are listed that simplify the state-chart creation using Enterprise Architect. If you have further hints let us know and we add them here. For a short intro on on how to use EA with the codegen go on reading here.

:?: Where to put the events to:

:!: States should be put “below” the class containing the state diagram. See next figure.


:?: How to define the path to the state machine:

:!: Since version 9.0 of Enterprise architect it looks like that always a view package is required. This package must appear in the path you specify on the codegen command line. In the figure above the path to the state machine is -t “Model:test:testclass”


:?: I always get the error message ‘Can't find path element ….’. But I’m sure the path is correct:

:!: Most probably you have not selected to root element (e.g. Model in the figure above) before exporting the XMI file. Select the root model element and then export to XMI.


:?: How to specify multiple lines entry/exit/do action code:

:!: So far there were two ways. The codegen took the name of the action as code. To specify multiple lines it was necessary to specify several actions. The other option was to attach a comment to a state and define the code there.

Now with EA 9.2 it is possible to specify multiple lines of action code in the behavior field. The name of the action is not used anymore as code line if code is found in the behavior field. The strange thing is that EA allows to define initial code which is unfortunately not exported in the normal XMI state tree. So it can't be used right now. In the example below two lines of entry code were added to S1.

:?: Where do I find the “export to XMI” dialog?

:!: In recent versions of EA the export to XMI is available under Publish → Export XMI

:?: EA updates the model file when loading with the new EA17Beta. Notes that were previously linked to the class are incorrectly linked to the state diagram.

:!: Link the Notes again with the class in which the state diagram is contained.