Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: jepessen on October 31, 2016, 05:03:19 am
-
Hi.
I've a project where there are many uml classes inside a package. The problem is that the language is wrong for all of them. I have to change classes language from Java to C++ for all of them. How can I automate this task without changing every class manually (they are almost 500)?
-
You can do that either with a SQL or a script (executing the SQL or using the API):
UPDATE t_object SET genType="C++" WHERE genType='Java
I you want to do that for a single package you could add a WHERE clause for the packageId or extract the package with XMI and change it either in the XMI with an editor or imported in a dummy repo.
q.
-
Thanks I'll try it.
-
A low tech way is to export the package, make the change with an editor (I use Notepad++) and import it.
-
I missed this first time around or I would have mentioned that you can do it with the UI: Right-click package in Project Browser > Code Engineering > Reset Options for this Package.
-
I missed this first time around or I would have mentioned that you can do it with the UI: Right-click package in Project Browser > Code Engineering > Reset Options for this Package.
This is the way IU do it, but recently, I've noticed that new items don't seem to get the language defined for the package - they get "<none>". Should they? I get EA to reset all the defaults and looking at the package it has the correct language. BTW, the language is a non-standard one ("Conceptual")
Paolo
-
Paolo, there is no option to propagate the language from a package to the elements created within it. A diagram type can specify a language, but not a package.
-
Paolo, there is no option to propagate the language from a package to the elements created within it. A diagram type can specify a language, but not a package.
Learn something new every day!
You can specify it on each individual diagram.
However, there seems to be a bug. If I set the language to <none> in the Diagram | Elements dialog I don't get "<none>" on a new element. A specific language seems to work OK.
Paolo
-
Selecting '<none>' is the only way to specify that this diagram doesn't specify a language (and that the model default should be used.)
-
Out of curiosity: why is it, that a diagram is related to a certain language? Seems like a coincidental choice.
q.
-
Selecting '<none>' is the only way to specify that this diagram doesn't specify a language (and that the model default should be used.)
That's what I suspected, Simon. But I couldn't find, in the new UI, where to set the Repository default. Can you please enlighten me? Also, since I can't see it, I can't check if "<none>" is an available option for the reposiotory default. I believe it should be.
Paolo
-
In EA 13 - Configure > Model > Options > Source Code Engineering : Default Language for Code Generation.
http://sparxsystems.com/enterprise_architect_user_guide/13.0/model_domains/code_generation_options.html
-
Out of curiosity: why is it, that a diagram is related to a certain language? Seems like a coincidental choice.
In EA a diagram specifies a profile being used by specifying the default toolbox. As a result it made sense when adding profiles for different programming languages that the same mechanism used to control the elements and stereotypes available controlled the language.
-
In EA 13 - Configure > Model > Options > Source Code Engineering : Default Language for Code Generation.
http://sparxsystems.com/enterprise_architect_user_guide/13.0/model_domains/code_generation_options.html
Ahh... EAUI! I was using the old Ctrl+F9 dialog and couldn't find it under Source Code Engineering!
The new UI puts up a similar looking, BUT DIFFERENT dialog.
Paolo
-
Thanks Simon. that seems to make sense.
q.
-
The new UI puts up a similar looking, BUT DIFFERENT dialog.
The two dialogs were split some time before 13 into user preferences and model configuration. Prior to that you didn't know what the option applied to and it caused a lot of confusion.
-
The new UI puts up a similar looking, BUT DIFFERENT dialog.
The two dialogs were split some time before 13 into user preferences and model configuration. Prior to that you didn't know what the option applied to and it caused a lot of confusion.
Yes, I agree, it's better this way, but it would be helpful to set them more apart visually. It really does look like one is a "mini-Me" of the other.
Paolo