Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Remove and add several child-elements in one command
Remove and add several child-elements in one command [message #484544] Tue, 08 September 2009 07:58 Go to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
Hi,

I've got an action, in which I would like to add/remove several child elements of of a node (displayed as border node items).

I managed to add them the way it's done in mindmap tutorial (http://wiki.eclipse.org/GMF_Tutorial_Part_3#Custom_Actions), but I guess I would have to add other commands to set attributes for these new nodes, so it would be quite a lot of code. And, I did not find any DestroyViewRequestFactory, so I don't get a destroy request for now.

I think the best solution would be, to change the underlying EObjects and then update the view. This results in a "java.lang.IllegalStateException: Cannot modify resource set without a write transaction".

I tried to somehow get this into a command and execute on stack, but I got lost somewhere between requests, eclipse-, emf- and gef-Commands, ICommands, TransactionalEditingDomain and IDiagramEditDomain ;-)

I'm sure it's quite simple when it's done, so could anyone help me with this?

Thanks a lot,
Peter
Re: Remove and add several child-elements in one command [message #484825 is a reply to message #484544] Wed, 09 September 2009 12:57 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

Create a subclass of AbstractTransactionalCommand and execute it using OperationHistoryFactory.getOperationHistory().execute()
method

-----------------
Alex Shatalin
Re: Remove and add several child-elements in one command [message #484833 is a reply to message #484825] Wed, 09 September 2009 13:23 Go to previous message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
Thanks a lot, Alex!

As I said, it's quite simple when it's done ;-)
Previous Topic:Update connection when target-attribute changes
Next Topic:Multiple Domain File Extensions
Goto Forum:
  


Current Time: Fri Apr 26 17:00:20 GMT 2024

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

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

Back to the top