Combining EMF Commands and Text Editor operations [message #1075319] |
Mon, 29 July 2013 08:20 |
saurav sarkar Messages: 428 Registered: July 2009 |
Senior Member |
|
|
Hi,
I have a multi page editor . One tab has a model and another one has a corresponding source
I trigger an EMF AddCommand (A1) in the model editor followed by a text operation (T1) (Initiated by the text editor editor framework).
Then I have number of set commands (S1...S3) depending upon some condition. (for e.g. on page change)
Like this A1->T1->S1->S2->S3
Now I would like to have undo/redo for a transaction shown as the sequence above. How this can this be achieved in a better way. Both text operation and EMF model commands have to work seamlessly.
The framework must revert in the above order starting from S3.
Do I have to put all the commands in the Compound Command. In that case how can I achieve the text operation synchronization ?.
Cheers,
Saurav
My Blog http://codifyit.blogspot.com/
Follow me: http://twitter.com/sauravs
|
|
|
|
|
|
|
Re: Combining EMF Commands and Text Editor operations [message #1075628 is a reply to message #1075529] |
Mon, 29 July 2013 19:29 |
|
Hi, Saurav,
EMFCompositeOperation is an IUndoableOperation (as defined by the
Eclipse Operation History API) that aggregates multiple discrete
operations on EMF models/editing-domains. It is analogous to the
CompoundCommand in EMF.Edit.
The NonEMFTransaction is intended to encapsulate undoable state changes
in stuff that is not EMF model content, to embed it in an EMF
transaction's change description for undo/redo. Updates to the state
of UI components is an example of what this is intended to capture.
As far as I recall (it has been several years, now) the
NonEMFTransaction is supposed only to be used internally by the
TransactionalEditingDomain, but I could be wrong. I don't there is
public API for creating and manipulating these transactions ... A
search of the code would answer that for you.
HTH,
Christian
On 2013-07-29 15:31:29 +0000, saurav sarkar said:
> Thanks for the comments Ed.
>
> I could achieve the same by using Compound Command and overriding the
> doUndo() method to undo the text editor stack changes.
>
> Just a curiosity on what would EMFCompositeOperation and
> NonEMFTransaction in org.eclipse.emf.workspace plugin are used for ?any
> sample implementation done on those ?
>
> cheers,
> Saurav
|
|
|
Powered by
FUDForum. Page generated in 0.03414 seconds