Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Cloning an Interaction
Cloning an Interaction [message #614489] Sun, 06 May 2007 18:30
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hi,

I'd like to clone a interaction (sequence diagram). I want a complete
copy of all the elements, any references to external classes and
operations can remain intact. Does anyone know an easy way to achieve this?

My initial thoughts were something like this, but it doesn't seem to
work properly. Anyone got any ideas how to accomplish something like this?

Thanks,
Andrew.

public static Interaction cloneInteraction(Interaction interaction)
{
Interaction newInter = UMLFactory.eINSTANCE.createInteraction();
for (EAttribute ea : interaction.eClass().getEAllAttributes())
{
newInter.eSet(ea, interaction.eGet(ea));
}
for (Element element : interaction.allOwnedElements())
{
Element newElement = (Element)
UMLFactory.eINSTANCE.create(element.eClass());
for (EAttribute ea : element.eClass().getEAllAttributes())
{
newElement.eSet(ea, newElement.eGet(ea));
newInter.allOwnedElements().add(newElement);
}
}
return interaction;

}
Previous Topic:Sequence Diagrams
Next Topic:How to create Arrays in UML2?
Goto Forum:
  


Current Time: Thu Apr 25 13:55:28 GMT 2024

Powered by FUDForum. Page generated in 0.03060 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top