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.

:Q: Where to put the events to:

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

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

:A: 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”

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

:A: 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.

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

:A: 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.