|
|
|
Re: Copy Objects with ecoreutil.copy [message #509486 is a reply to message #508971] |
Fri, 22 January 2010 15:09 |
Christian Messages: 4 Registered: September 2009 |
Junior Member |
|
|
Hi everyone, its me again.
I hope Im able to ask a more concrete question now:
So I tried to copy an element with this code (executed via popup menu extension point)
EObject selectedEObject = ((View) selectedElement.getModel()).getElement();
EObject newEObject = EcoreUtil.copy(selectedEObject);
IElementType type = ElementTypeRegistry.getInstance().getElementType(selectedEObject);
DiagramEditPart mapEditPart = (DiagramEditPart) selectedElement.getParent();
CreateViewRequest.ViewDescriptor viewDescriptor1 = new CreateViewRequest.ViewDescriptor(
new EObjectAdapter(newEObject),
Node.class,
((IHintedType) type).getSemanticHint(),
mapEditPart.getDiagramPreferencesHint());
CreateViewRequest createViewRequest = new CreateViewRequest(viewDescriptor1);
Command cmd = mapEditPart.getCommand(createViewRequest);
cc.add(cmd);
My Problem: The element appears in the diagram but is not part of the underlying emf model. Can anyone tell me how to make the new copy of that element part of the emf model as well? Because after saving and reopening it it's gone
Thank you!
[Updated on: Fri, 22 January 2010 16:29] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03594 seconds