Skip to main content



      Home
Home » Modeling » UML2 » Cloning an Interaction
Cloning an Interaction [message #614489] Sun, 06 May 2007 14:30
Eclipse UserFriend
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 Jul 10 03:52:58 EDT 2025

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

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

Back to the top