Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » How UNDO works in graphiti?(UNDO in Graphiti)
How UNDO works in graphiti? [message #1128879] Tue, 08 October 2013 04:39 Go to next message
PALANI SANKAR is currently offline PALANI SANKARFriend
Messages: 35
Registered: April 2013
Member
Hi All

How UNDO works in graphiti?
My requirement is to clear all elements in graphiti diagram , for ex if i add 200 container shape in graphiti and if i do undo it is removing elements fastly.

I want to clear the elements as fast as undo does..so can anyone help me out in clearing of elements in a faster way.

Thanks
Palani


Thanks
Palani
Re: How UNDO works in graphiti? [message #1130111 is a reply to message #1128879] Wed, 09 October 2013 08:34 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Palani,

undo is implemented in Graphiti using EMF Transaction. Whenever a feature is
executed this is done inside a transaction which records what is being
changed in the EMF model. This information is stored in the history of the
editor/TransactionalEditingDomain and used to revert the changes again on
pressing undo.

Does that help?

Michael
Re: How UNDO works in graphiti? [message #1130116 is a reply to message #1130111] Wed, 09 October 2013 08:39 Go to previous messageGo to next message
PALANI SANKAR is currently offline PALANI SANKARFriend
Messages: 35
Registered: April 2013
Member
Hi Michael

It Helps.Thanks for the info. I basically looked for this because if i add 100 elements and if i do undo it is clearing those very fast.But when i explicitly clear those graphiti elements then the clearing is taking more time.It is affecting the performance. so i am trying to find a way to avoid this performance issue. is there any way? can you suggest something on this.

Thanks
Palani


Thanks
Palani
Re: How UNDO works in graphiti? [message #1130131 is a reply to message #1130116] Wed, 09 October 2013 08:45 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Palani,

I guess with clearing you mean deleting the objects. The default delete
functionality in Graphiti (and also the called EMF delete) checks a lot more
things and traverses the object tree to find and remove references pointing
to the deleted elements. Looping over that 100 times will surely be slow.

I think the best way would be to implement a custom delete that does exactly
what you want (and only that). Not sure if there is a possibilty in EMF
Transaction to store and replay (or rather revert) the recorded changes in
the way you like to do...

Michael
Re: How UNDO works in graphiti? [message #1130140 is a reply to message #1130131] Wed, 09 October 2013 08:57 Go to previous messageGo to next message
PALANI SANKAR is currently offline PALANI SANKARFriend
Messages: 35
Registered: April 2013
Member
Michael,

Thanks i will try this way.

Palani


Thanks
Palani
Re: How UNDO works in graphiti? [message #1130238 is a reply to message #1130131] Wed, 09 October 2013 10:50 Go to previous message
Eclipse UserFriend
Hi,

Le 09/10/13 10:45, Michael Wenz a écrit :
> Palani,
>
> I guess with clearing you mean deleting the objects. The default delete
> functionality in Graphiti (and also the called EMF delete) checks a lot
> more things and traverses the object tree to find and remove references
> pointing to the deleted elements. Looping over that 100 times will
> surely be slow.
>
> I think the best way would be to implement a custom delete that does
> exactly what you want (and only that). Not sure if there is a possibilty
> in EMF Transaction to store and replay (or rather revert) the recorded
> changes in the way you like to do...
>
> Michael

It may be possible to subclass the BasicCommandStack used in the
TransactionalEditingDomain. I used once a long ago so I don't well
remember how I do that.

BasicCommandStack must have the list of executed commands stored in an
array list but not visible for users. Instead, the user can get the most
recent commands (used by the undo method).

Thus, if you subclass the command stack with your own implementation,
you may be able to define an array list that stores a restrained set of
specialized commands (only the ones you would undo). Then, you may
provide a custom undo implementation that undoes all the commands only
stored in this array list.

Finally you bind your custom commandStack with the transactional editing
domain used by Graphiti.

Is this possible ?

Regards,

--
Nicolas H
Previous Topic:Best way of clearing the commandstack on saving of editor
Next Topic:Getting width of text
Goto Forum:
  


Current Time: Fri Mar 29 15:32:57 GMT 2024

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

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

Back to the top