re: Core Data undo grouping
re: Core Data undo grouping
- Subject: re: Core Data undo grouping
- From: Ben Trumbull <email@hidden>
- Date: Thu, 2 Oct 2008 20:02:59 -0700
Peter,
I'm using CoreData for some internal state management that sometimes
requires an undo boundary in a specific place. In other words, I need
something along these lines to work:
NSManagedObject *object = [self getObjectFromSomewhere];
NSManagedObjectContext *context = [object managedObjectContext];
[object setValue:@"1" forKey:@"attr"];
[self forceUndoBoundaryInContext:context];
[object setValue:@"2" forKey:@"attr"];
This is a little odd. If this is in the UI thread, it will be
confusing to the user in the typical scenarios. Are you sure you
don't want to create a nested undo group ?
Based on the documentation, it seems clear that all I have to do to
accomplish this is call processPendingChanges:
No, Core Data works with NSUndoManager. -processPendingChanges simply
ensures that all the coalesced work Core Data might be deferring gets
put into the current undo grouping. It may register new actions with
the undo manager, but does not end current grouping.
Fiddling with the undo groupings themselves should be done with
NSUndoManager API.
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden