Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 05:11 Go to next message
Rajendra Kashi is currently offline Rajendra KashiFriend
Messages: 2
Registered: August 2014
Junior Member
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 05:26 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How do I download source code emf project?
Next Topic:CDO Timeout Exception
Goto Forum:
  


Current Time: Sat Apr 20 03:25:52 GMT 2024

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

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

Back to the top