Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Korchkidu on July 15, 2009, 09:49:09 pm

Title: [Newbie] Changing class name
Post by: Korchkidu on July 15, 2009, 09:49:09 pm
Hi all,

I am currently trying EA and for now, I must admit that it is pretty impressive compared to other very expensive software.

I still have a question. I have imported several packages with tens of classes. I want now to be able to change class names and generate the associated code but keeping the existing method bodies of course.
So for example, I have a class ClassA and I want to rename it ClassB and keeping all existing code.

 For the moment, I have two choices:
1) If I choose to replace then I simply erase all my source code...
2) If I choose to synchronize, then it generates two classes instead of one: it keeps old ClassA and generates an new ClassB with empty methods prototypes...

Any idea of what I am doing wrong?

Thanks for any help-
K.
Title: Re: [Newbie] Changing class name
Post by: resolve on July 16, 2009, 12:32:01 am
In ur model you can just double click on class an it will give u class properties and you can change name there and save it. That should rename your class from Class A to class B.

Hope I answered correctly because I also just strted using EA.

Thanks!
Title: Re: [Newbie] Changing class name
Post by: Korchkidu on July 16, 2009, 12:37:59 am
Hi,

thanks for your answer. However, I am not concerned by only changing the name of a class in the model but also in the source code... Now, I end up with multiple classes in the same file.... :-[

K.
Title: Re: [Newbie] Changing class name
Post by: resolve on July 16, 2009, 01:27:13 am
ButIf you change the class name in model than you can generate source code out of the model and it will give you fresh generated code. I hope thats what you trying to do. It worke din my case.
Thanks!
Title: Re: [Newbie] Changing class name
Post by: Korchkidu on July 16, 2009, 01:38:03 am
Well, it should. But I cannot have it working. I already have source code with say ClassA. I import it into EA and in the diagram, I change ClassA into ClassB and then regenerate the C++ code. If you see my first post, you will see that you have two different solutions (as far as I know) and none of them are satisfactory for me. I hope their is a way to do what I want to do...

K.
Title: Re: [Newbie] Changing class name
Post by: Korchkidu on July 16, 2009, 02:53:53 am
For those who are interested, if you check the option "include method bodies in model when reverse engineering", then you can regenerate all your classes from scratch. It is not the perfect solution but it works... Any other ideas?

K.
Title: Re: [Newbie] Changing class name
Post by: Korchkidu on July 16, 2009, 07:04:26 pm
Am I the only one having this trouble?

K.
Title: Re: [Newbie] Changing class name
Post by: Makulik on July 16, 2009, 10:42:11 pm
Hi,

If you change the class names, the code generation should create the new header files accordingly. I guess you shouldn't synchronize, but generate the renamed classes only. Well, this will not keep the implementation but generate new empty method bodies. This stuff I am afraid, you need to copy manually there.

HTH,
Günther
Title: Re: [Newbie] Changing class name
Post by: Korchkidu on July 17, 2009, 12:17:55 am
Ok, I see. Thanks a lot for your answer. It is what I was afraid of.

Best regards.
K.