Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFStore] Atomic Undo/Redo
[EMFStore] Atomic Undo/Redo [message #1578911] Thu, 22 January 2015 17:43 Go to next message
Yuriy Flyud is currently offline Yuriy FlyudFriend
Messages: 12
Registered: January 2015
Location: Lviv, Ukraine
Junior Member
I have an EMF-based plugin that uses the capabilities of EMFStore. My problem is that the operations I perform can be completely undone only in several steps. For example, creating a child object using CreateChildCommand results in two operations (Copied from Commit dialog):

  1. Created child
  2. Added Child as child in Parent

That's why to perform the undo I have to actually call the undo operation twice (Using UIUndoLastOperationController).

I found a solution using the ProjectSpace.beginCompositeOperation() method, but is looks too "internal".

Here:
www.eclipse.org/forums/index.php/t/540419/
I read that starting from version 1.1 there should be a some kind of a command stack per project. In this case I could just call the undo/redo on command stack.

Also I noticed that the remove command generates one operation but with "nested operations", so undo works here. Can this be applied also for other types of operations?

Yuriy
Re: [EMFStore] Atomic Undo/Redo [message #1580329 is a reply to message #1578911] Fri, 23 January 2015 12:28 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Yuriy,

> I have an EMF-based plugin that uses the capabilities of EMFStore. My
> problem is that the operations I perform can be completely undone only
> in several steps. For example, creating a child object using
> CreateChildCommand results in two operations (Copied from Commit dialog):
>
> Created child
> Added Child as child in Parent
>
> That's why to perform the undo I have to actually call the undo
> operation twice (Using UIUndoLastOperationController).
> I found a solution using the ProjectSpace.beginCompositeOperation()
> method, but is looks too "internal".
We use an ESOperationModifier to collect operations into composites in
many of our customer projects:
http://download.eclipse.org/emfstore/releases_14/javadoc/org/eclipse/emf/emfstore/client/handler/ESOperationModifier.html

> Also I noticed that the remove command generates one operation but with
> "nested operations", so undo works here. Can this be applied also for
> other types of operations?
In general this would be also possible for CreateOperations but was
never implemented.

Cheers,
Maximilian

--
Maximilian Kögel

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMFStore] Atomic Undo/Redo [message #1597479 is a reply to message #1580329] Mon, 02 February 2015 10:16 Go to previous messageGo to next message
Yuriy Flyud is currently offline Yuriy FlyudFriend
Messages: 12
Registered: January 2015
Location: Lviv, Ukraine
Junior Member
Hi Maximilian,
Thank you for this quick and life-saving answer!

I managed to do this with the following line:
ExtensionRegistry.INSTANCE.set(ESOperationModifier.ID, new AutoOperationWrapper());

I will declare this in plugin activator for now, but it would be great to set the operation modifier through extension point some day.
Re: [EMFStore] Atomic Undo/Redo [message #1601018 is a reply to message #1597479] Wed, 04 February 2015 17:10 Go to previous message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Yuriy,

you are welcome!
Maybe you want to open a bugzilla for having an extension point for
this, I think it is a good idea.

Cheers,
Maximilian

Am 02.02.2015 um 11:16 schrieb Yuriy Flyud:
> Hi Maximilian,
> Thank you for this quick and life-saving answer!
>
> I managed to do this with the following line:
> ExtensionRegistry.INSTANCE.set(ESOperationModifier.ID, new
> AutoOperationWrapper());
>
> I will declare this in plugin activator for now, but it would be great
> to set the operation modifier through extension point some day.


--
Maximilian Kögel

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:Call for Submissions: Modeling Symposium @ EclipseCon North America 2015
Next Topic:[TENEO] Possible performance Issue in IdentifierCacheHandler
Goto Forum:
  


Current Time: Tue Apr 23 14:15:31 GMT 2024

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

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

Back to the top