Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Creating elements in GMF outside of the current editor
Creating elements in GMF outside of the current editor [message #216794] Fri, 30 January 2009 03:27 Go to next message
Jevon  is currently offline Jevon Friend
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
Re: Creating elements in GMF outside of the current editor [message #216976 is a reply to message #216794] Fri, 30 January 2009 15:58 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jevon,

> I cannot use EMF directly with GMF running, because I need write
> access, and I get a transaction exception.
Try subclassing AbstractTransactionalCommand.

-----------------
Alex Shatalin
Re: Creating elements in GMF outside of the current editor [message #217034 is a reply to message #216976] Mon, 02 February 2009 00:27 Go to previous message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi Alex,

Thanks for your help! After subclassing AbstractTransactionalCommand,
the command works exactly as desired.

Thanks!
Jevon

Alex Shatalin wrote:
> Hello Jevon,
>
>> I cannot use EMF directly with GMF running, because I need write
>> access, and I get a transaction exception.
> Try subclassing AbstractTransactionalCommand.
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:Link to node connection deletion
Next Topic:Reference Ecore Model to LayoutNode
Goto Forum:
  


Current Time: Fri Feb 26 22:29:42 GMT 2021

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

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

Back to the top