Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFStore] command stack flushing
[EMFStore] command stack flushing [message #1179081] Sat, 09 November 2013 22:21 Go to next message
Scott Dybiec is currently offline Scott Dybiec
Messages: 126
Registered: July 2009
Senior Member
When saving an XMI file-based Resource, the CommandStack is not flushed
on save, so the user in many cases is able to undo changes made as far
back as the time when the file was first loaded, regardless of when it
was saved.

When my application uses EMFStore, the CommandStack is flushed on every
commit, so undo/redo is no longer possible on the local copy after a
commit. This flushing is done in the ESCommitObserver in
ESWorkspaceProviderImpl.

I'd like my application's users to be able to undo and redo changes to
their local copies even after a commit. Is this possible? Can this flush
of the CommandStack be eliminated, and, if so, how?


/**
*
* {@inheritDoc}
*
* @see
org.eclipse.emf.emfstore.client.observer.ESCommitObserver#commitCompleted(org.eclipse.emf.emfstore.client.ESLocalProject,
*
org.eclipse.emf.emfstore.server.model.versionspec.ESPrimaryVersionSpec,
* org.eclipse.core.runtime.IProgressMonitor)
*/
public void commitCompleted(ESLocalProject project,
ESPrimaryVersionSpec newRevision, IProgressMonitor monitor) {
flushCommandStack();
}
Re: [EMFStore] command stack flushing [message #1180965 is a reply to message #1179081] Mon, 11 November 2013 04:23 Go to previous messageGo to next message
Edgar Mueller is currently offline Edgar Mueller
Messages: 54
Registered: March 2011
Member
Hi Scott,

EMFStore doesn't support undo/redo after commit/update, because you are
likely to get inconsistent states on your command stack when trying to
perform an undo after incoming changes have been applied. For instance,
consider the case where a conflict arises. In case you resolve the
conflict by choosing to apply the incoming changes, those changes would
not have a represenentation on the command stack, i.e. you can not undo
incoming changes. So, let's assume that undo would undo only your most
recent local change. But then again, what if the model instance you
edited just got deleted by the conflict resolution? A undo isn't
possible since the model instance does not exist anymore.

I hope this helps to see why we choosed to flush the command stack upon
commit/update.

Cheers,
Edgar

> I'd like my application's users to be able to undo and redo changes to
> their local copies even after a commit. Is this possible? Can this flush
> of the CommandStack be eliminated, and, if so, how?


--
Edgar Mueller

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] command stack flushing [message #1181790 is a reply to message #1180965] Mon, 11 November 2013 16:05 Go to previous message
Scott Dybiec is currently offline Scott Dybiec
Messages: 126
Registered: July 2009
Senior Member
Thanks, Edgar. That helps. I get it now. Appreciate your explanation.

On 11/11/2013 4:23 AM, Edgar Mueller wrote:
> Hi Scott,
>
> EMFStore doesn't support undo/redo after commit/update, because you are
> likely to get inconsistent states on your command stack when trying to
> perform an undo after incoming changes have been applied. For instance,
> consider the case where a conflict arises. In case you resolve the
> conflict by choosing to apply the incoming changes, those changes would
> not have a represenentation on the command stack, i.e. you can not undo
> incoming changes. So, let's assume that undo would undo only your most
> recent local change. But then again, what if the model instance you
> edited just got deleted by the conflict resolution? A undo isn't
> possible since the model instance does not exist anymore.
>
> I hope this helps to see why we choosed to flush the command stack upon
> commit/update.
>
> Cheers,
> Edgar
>
>> I'd like my application's users to be able to undo and redo changes to
>> their local copies even after a commit. Is this possible? Can this flush
>> of the CommandStack be eliminated, and, if so, how?
>
>
Previous Topic:[EMF][Teneo] Order of children in references
Next Topic:[EMFClient] Usable together with e4?
Goto Forum:
  


Current Time: Thu Aug 21 18:16:56 EDT 2014

Powered by FUDForum. Page generated in 0.01780 seconds