Creating elements in GMF outside of the current editor [message #216794] |
Fri, 30 January 2009 03:27 |
Jevon Messages: 164 Registered: July 2009 |
Senior Member |
|
|
Hi,
I am trying to automatically create elements in my model, directly from
selecting an element in the GMF editor. This works fine for elements
that can be displayed in the editor itself (as following from the GMF
Tutorial):
CreateElementCommand cc = getDiagramCreateNodeCommand(new
CreateElementRequest(getEditingDomain(), container,
getDiagramEditType(eClass)), eClass );
getDiagramEditType() gets the IElementType from the current GMF editor
for the given eClass (taken from XXXPackage.eINSTANCE).
However, I now want to create elements outside of the current GMF
editor, that can't be displayed in the current editor. (I am using
diagram partitioning.) Obviously I don't want the element displayed, but
I want it created in the model.
I cannot use the code above, because the current editor has no knowledge
of the other elements in the model, and fails with an invalid operation
error.
If I import another editor and use its IElementType in the original
editors' code, I get a NullPointerException.
I cannot use EMF directly with GMF running, because I need write access,
and I get a transaction exception.
Any ideas?
Thanks!
Jevon
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03923 seconds