Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Gokcen Guner on October 25, 2013, 02:04:44 am

Title: Duplicating Element in The Same Package
Post by: Gokcen Guner on October 25, 2013, 02:04:44 am
Hello,
I need to copy-paste some elements in the same package. These elements are usecases. When using GUI, this operation creates a usecase named with the original one plus " - Copy". Can I use automation interface to achieve same thing?
Thanks in advance.
Title: Re: Duplicating Element in The Same Package
Post by: Yves C on October 25, 2013, 02:47:44 am
You can use copy/paste diagram to do this :
1. Create a diagram containing all the elemenst you want to clone
2. Select the package and launch paste diagram
3. Select the option "Deep" or "Smart" depending on your intention.
4. That's it.

Beware : the objects are cloned. It means that all their properties including their relationships are cloned.
Title: Re: Duplicating Element in The Same Package
Post by: Gokcen Guner on October 25, 2013, 03:32:05 am
Quote
You can use copy/paste diagram to do this :
1. Create a diagram containing all the elemenst you want to clone
2. Select the package and launch paste diagram
3. Select the option "Deep" or "Smart" depending on your intention.
4. That's it.

Beware : the objects are cloned. It means that all their properties including their relationships are cloned.

Thanks Yves but I need to do this using automation not GUI.
Title: Re: Duplicating Element in The Same Package
Post by: qwerty on October 25, 2013, 05:43:35 am
You could use the Repository.Clone method if you move the element(s) to clone into a temp package. (Should I say that it would be nice if the API would be a bit more OO and offer clone and delete methods for all objects?)

q.
Title: Re: Duplicating Element in The Same Package
Post by: Gokcen Guner on October 25, 2013, 06:16:45 am
Quote
You could use the Repository.Clone method if you move the element(s) to clone into a temp package. (Should I say that it would be nice if the API would be a bit more OO and offer clone and delete methods for all objects?)

q.
Hi qwerty,
I couldn't find Repository.Clone method in EA Help contents. There is only one clone method in Package class.
I also agree what you wrote in parenthesis :)
Title: Re: Duplicating Element in The Same Package
Post by: qwerty on October 25, 2013, 07:20:59 am
Sorry. It's package.clone (of course). You'd need to call that for the temp package where you moved in the elements to clone.

q.
Title: Re: Duplicating Element in The Same Package
Post by: Gokcen Guner on October 26, 2013, 10:04:15 pm
Quote
Sorry. It's package.clone (of course). You'd need to call that for the temp package where you moved in the elements to clone.

q.
Thank you qwerty. I'll check it out.