7
votes

In Enterprise Architect when I model a class and specify the implementation language of the class, then use an instance of the class in a use case, the implementation language of the instance in the use case is not the implementation language of the class, but is the default. Is there a way to make Enterprise Architect use the set implementation language of the class for the implementation language of all instances of that class?

3
Of course, code generation doesn't work on instances, so an instance doesn't really need a code generation language. - chimp
Right, I agree in most cases. Every once and a while though it could be nice to be able to tell what the implementation language of an object is (like in a project that encompasses several pieces written in different languages, and you are sorting through use cases) - KSletmoe

3 Answers

22
votes

There isn't an option to make instances follow the class language (but that's a good suggestion to send to Sparx), but you can set the default language for all new elements. From your question, I take it you already know how but I'll include it for other readers.

Tools - Options - Source Code Engineering - Default Language for Code Generation is the one you're after. This option is somewhat incorrectly named; it actually sets the default language for created elements.

As long as you're modelling things for one implementation language at a time this works very well. If you're modelling for different languages and realize that you've got the wrong one in a large part of your model, you can right-click the package in the project browser and select "Code Engineering - Reset Options for this Package."

Select "Where language is" - Any, and "Convert to" the language you want. Make sure to tick "Process Child Packages."

10
votes

In Enterprise Architect 12.1 I found it here:

PROJECT - Settings - Project Options - Source Code Engineering - Default Language for Code Generation

2
votes

In Enterprise Architect 13.0 I found it here:

Start - Window - Show Toolbar - Code Engineering

In toolbar its first option. Second is default database. Database option is also in:

Start - Workspace - Preferences - Source Code Engineering - Code Editors

but there is not programming language.