Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Java code on how to copy UML package to another UML Package (EMF)
Java code on how to copy UML package to another UML Package [message #1408087] Thu, 14 August 2014 07:53 Go to next message
Rajendra Kashi is currently offline Rajendra KashiFriend
Messages: 2
Registered: August 2014
Junior Member
Hi,
Using org.eclipse.emf.ecore.util.EcoreUtil.Copier.Copy method, i can make a copy of the package. Now I am trying to added this copiedPackage to it parent, i could not find any API for that. Please if anyone know appreciate if you pass it to me.

My Objective:
I want to promote package to next version. Promote means - if I have a package name
Service_V1 under package called 'Root', now promote should take a copy of Service_V1 and paste that package under 'Root' as Service_V2.

My code:
Package packageServiceV1 = set Service_V1 package from UMLModeler.getUMLUIHelper().getSelectedElements();

Package packageRoot = packageServiceV1.getOwner();

Package packageCopyOfServiceV1;

org.eclipse.emf.ecore.util.EcoreUtil.Copier copier = new org.eclipse.emf.ecore.util.EcoreUtil.Copier();

packageCopyOfServiceV1 = copier.copy(Service_V1)

// do not how to add the packageCopyOfServiceV1 to root.

.....


Please if anyone know how to do will help me lot.

Thanking you,
Raj
Re: Java code on how to copy UML package to another UML Package [message #1408506 is a reply to message #1408087] Fri, 15 August 2014 08:21 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4312
Registered: July 2009
Senior Member
Hi

The normal EMF API is:

parent.getChildren().add(aChild)

If you are interested in versioning you might want to study the UML2
projects version support, perhaps by experimenting with editing profiles
in papyrus.

Regards

Ed Willink


On 14/08/2014 14:08, Rajendra Kashi wrote:
> Hi,
> Using org.eclipse.emf.ecore.util.EcoreUtil.Copier.Copy method, i can
> make a copy of the package. Now I am trying to added this
> copiedPackage to it parent, i could not find any API for that. Please
> if anyone know appreciate if you pass it to me.
>
> My Objective:
> I want to promote package to next version. Promote means - if I have a
> package name
> Service_V1 under package called 'Root', now promote should take a copy
> of Service_V1 and paste that package under 'Root' as Service_V2.
>
> My code:
> Package packageServiceV1 = set Service_V1 package from
> UMLModeler.getUMLUIHelper().getSelectedElements();
>
> Package packageRoot = packageServiceV1.getOwner();
>
> Package packageCopyOfServiceV1;
>
> org.eclipse.emf.ecore.util.EcoreUtil.Copier copier = new
> org.eclipse.emf.ecore.util.EcoreUtil.Copier();
>
> packageCopyOfServiceV1 = copier.copy(Service_V1)
>
> // do not how to add the packageCopyOfServiceV1 to root.
>
> .....
>
>
> Please if anyone know how to do will help me lot.
>
> Thanking you,
> Raj
Previous Topic:UML 2.4 schema
Next Topic:Problems with profile "file:" URI in UML Model Editor
Goto Forum:
  


Current Time: Tue Apr 21 08:30:31 GMT 2015

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

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