EMF code to add copied package into another package. [message #1408459] |
Fri, 15 August 2014 01:11  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03783 seconds