Skip to main content



      Home
Home » Modeling » EMF » EMF code to add copied package into another package.
EMF code to add copied package into another package. [message #1408459] Fri, 15 August 2014 01:11 Go to next message
Eclipse UserFriend
Hi,

I am trying to copy UML package and paste the same package under the parent of the copied package. i am trying to promote the service so the next promoted package should not miss the previous version detail. I have gathered detail up to copy the package. but I am struggling to paste that package under the parent package. Please help.

My code:

private List<EObject> selectedElements;
private EObject selectedElement;

selectedElements = UMLModeler.getUMLUIHelper().getSelectedElements();
selectedElement = selectedElements.get(0);

Package selectedElementCopy = (Package)EcoreUtil.copy(selectedElement);
Package selectedElementParent = (Package)selectedElement.getOwner();

selectedElementCopy.setName("New Package Name");

// How to add the selectedElementCopy to selectedElementParent is troubling me.
.....


If anyone has done before, please pass me java code.

Thanking you,
Raj
Re: EMF code to add copied package into another package. [message #1408463 is a reply to message #1408459] Fri, 15 August 2014 01:26 Go to previous message
Eclipse UserFriend
Rajendra,

Given this is a question specifically about UML2's API, its better to
ask on the UML2 forum.

On 15/08/2014 7:11 AM, Rajendra Kashi wrote:
> Hi,
>
> I am trying to copy UML package and paste the same package under the
> parent of the copied package. i am trying to promote the service so
> the next promoted package should not miss the previous version detail.
> I have gathered detail up to copy the package. but I am struggling to
> paste that package under the parent package. Please help.
>
> My code:
>
> private List<EObject> selectedElements;
> private EObject selectedElement;
>
> selectedElements = UMLModeler.getUMLUIHelper().getSelectedElements();
> selectedElement = selectedElements.get(0);
>
> Package selectedElementCopy = (Package)EcoreUtil.copy(selectedElement);
> Package selectedElementParent = (Package)selectedElement.getOwner();
>
> selectedElementCopy.setName("New Package Name");
>
> // How to add the selectedElementCopy to selectedElementParent is
> troubling me.
> ....
>
>
> If anyone has done before, please pass me java code.
>
> Thanking you,
> Raj
Previous Topic:How do I download source code emf project?
Next Topic:CDO Timeout Exception
Goto Forum:
  


Current Time: Sun Jul 13 07:05:44 EDT 2025

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

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

Back to the top