Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Undo/Redo of CDOTransactions(Undo/Redo of CDOTransactions)
[CDO] Undo/Redo of CDOTransactions [message #924960] Thu, 27 September 2012 09:13 Go to next message
Kenny Lee is currently offline Kenny LeeFriend
Messages: 39
Registered: September 2012
Member
Hi,

Say i want to implement some undo/redo feature for modifying CDOObjects.

Do you recommend using CDORevision strategy, or CDOSavePoints concept?
Bearing in mind that each modification requires a new CDOTransaction.

Ken
Re: [CDO] Undo/Redo of CDOTransactions [message #924982 is a reply to message #924960] Thu, 27 September 2012 09:27 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 27.09.2012 11:14, schrieb Kenny Lee:
> Hi,
>
> Say i want to implement some undo/redo feature for modifying CDOObjects.
>
> Do you recommend using CDORevision strategy,
What would that be?

> or CDOSavePoints concept?
Savepoints are good for Undo, but they don't support Redo.

> Bearing in mind that each modification requires a new CDOTransaction.
Not sure how to interpret that. You can modify the model many times before you commit and you don't need a new
transaction after a commit. Just continue to modify the model and commit again eventually.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Undo/Redo of CDOTransactions [message #925016 is a reply to message #924982] Thu, 27 September 2012 10:05 Go to previous messageGo to next message
Kenny Lee is currently offline Kenny LeeFriend
Messages: 39
Registered: September 2012
Member
Eike Stepper wrote on Thu, 27 September 2012 05:27
Am 27.09.2012 11:14, schrieb Kenny Lee:
> Hi,
>
> Say i want to implement some undo/redo feature for modifying CDOObjects.
>
> Do you recommend using CDORevision strategy,
What would that be?

I guess after each commit, a new CDORevision would be created. And i can somehow
fetch an earlier revision of the CDOObject? Any sample code.

> or CDOSavePoints concept?
Savepoints are good for Undo, but they don't support Redo.

Ok. So that rues out using Savepoints. Because my use case is both undo and redo.

> Bearing in mind that each modification requires a new CDOTransaction.
Not sure how to interpret that. You can modify the model many times before you commit and you don't need a new
transaction after a commit. Just continue to modify the model and commit again eventually.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper

Re: [CDO] Undo/Redo of CDOTransactions [message #925090 is a reply to message #925016] Thu, 27 September 2012 11:09 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 27.09.2012 12:05, schrieb Kenny Lee:
> Eike Stepper wrote on Thu, 27 September 2012 05:27
>> Am 27.09.2012 11:14, schrieb Kenny Lee:
>> > Hi,
>> >
>> > Say i want to implement some undo/redo feature for modifying CDOObjects.
>> >
>> > Do you recommend using CDORevision strategy, What would that be?
>>
>> I guess after each commit, a new CDORevision would be created. And i can somehow
>> fetch an earlier revision of the CDOObject? Any sample code.
That would theoretically be possible but it would require to persist/commit each stage you want to return to. Normally
undo/redo are needed at the client side only, e.g., in editors before commit is called. An EMF command stack is used
normally to support undo/redo of edit commands.

>>
>> > or CDOSavePoints concept?
>> Savepoints are good for Undo, but they don't support Redo.
>>
>> Ok. So that rues out using Savepoints. Because my use case is both undo and redo.
>>
>> > Bearing in mind that each modification requires a new CDOTransaction.
>> Not sure how to interpret that. You can modify the model many times before you commit and you don't need a new
>> transaction after a commit. Just continue to modify the model and commit again eventually.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>
>


Re: [CDO] Undo/Redo of CDOTransactions [message #925766 is a reply to message #925090] Fri, 28 September 2012 02:20 Go to previous messageGo to next message
Kenny Lee is currently offline Kenny LeeFriend
Messages: 39
Registered: September 2012
Member
Eike Stepper wrote on Thu, 27 September 2012 07:09
Am 27.09.2012 12:05, schrieb Kenny Lee:
> Eike Stepper wrote on Thu, 27 September 2012 05:27
>> Am 27.09.2012 11:14, schrieb Kenny Lee:
>> > Hi,
>> >
>> > Say i want to implement some undo/redo feature for modifying CDOObjects.
>> >
>> > Do you recommend using CDORevision strategy, What would that be?
>>
>> I guess after each commit, a new CDORevision would be created. And i can somehow
>> fetch an earlier revision of the CDOObject? Any sample code.
That would theoretically be possible but it would require to persist/commit each stage you want to return to. Normally
undo/redo are needed at the client side only, e.g., in editors before commit is called. An EMF command stack is used
normally to support undo/redo of edit commands.

Thanks Eike.
Do you have a sample of fetching a certain revision of a CDOObject by the CDORevisionKey?

>>
>> > or CDOSavePoints concept?
>> Savepoints are good for Undo, but they don't support Redo.
>>
>> Ok. So that rues out using Savepoints. Because my use case is both undo and redo.
>>
>> > Bearing in mind that each modification requires a new CDOTransaction.
>> Not sure how to interpret that. You can modify the model many times before you commit and you don't need a new
>> transaction after a commit. Just continue to modify the model and commit again eventually.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>
>

Re: [CDO] Undo/Redo of CDOTransactions [message #925914 is a reply to message #925766] Fri, 28 September 2012 06:07 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 28.09.2012 04:20, schrieb Kenny Lee:
>> >> I guess after each commit, a new CDORevision would be created. And i can somehow
>> >> fetch an earlier revision of the CDOObject? Any sample code.
>> That would theoretically be possible but it would require to persist/commit each stage you want to return to.
>> Normally undo/redo are needed at the client side only, e.g., in editors before commit is called. An EMF command stack
>> is used normally to support undo/redo of edit commands.
>>
>> Thanks Eike.
>> Do you have a sample of fetching a certain revision of a CDOObject by the CDORevisionKey?
CDORevision r1 = CDOUtil.getRevisionByVersion(CDOObject, int version)
CDORevision r2 = CDOUtil.getRevisionByVersion(CDOObject, CDOBranch, int version)

For access to historical CDOObjects you must open an audit view:

CDOView audit = session.openView(long timeStamp);

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:Store EMF models in a database without using Eclipse
Next Topic:[CDO] Thread-local legacy mode default
Goto Forum:
  


Current Time: Fri Apr 19 19:27:26 GMT 2024

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

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

Back to the top