Re: NSUndoManager setActionName: oddity
Re: NSUndoManager setActionName: oddity
- Subject: Re: NSUndoManager setActionName: oddity
- From: Kyle Sluder <email@hidden>
- Date: Mon, 02 Jul 2012 10:48:45 -0700
On Mon, Jul 2, 2012, at 10:26 AM, Conrad Shultz wrote:
> Thanks Kyle.
>
> As I mentioned the actual action opening the undo group is in the
> -insertObject:in: method in the model, which does work. My very first
> thought was an ordering issue so I tried inverting the order of method
> calling on the wrapper to no avail, but as Michael pointed out this might
> have been fruitless anyway.
>
> I'll take a look at GCUndoManager. I'd heard of it being used in the
> context of Core Data, but maybe I should consider it here too. (I hate to
> introduce third-party dependencies unless absolutely necessary.)
>
> I could set the action name in the model too, but that feels icky. (Do
> you set the action name or just register undo operations in the model? I
> don't see why action names would be needed for scripting, but then again
> I don't really know AppleScript.)
Looking through the code, it appears that we set most of our action
names in the controller using an extension method
-setActionNameIfGrouped:
<https://github.com/omnigroup/OmniGroup/blob/master/Frameworks/OmniFoundation/OpenStepExtensions.subproj/NSUndoManager-OFExtensions.m#L104>.
I suppose the main reason is that we want the action names to match the
user interface terminology: "Undo check" rather than "Undo set item
value". But I know we've had internal debates about this before.
But our actual action registration (-prepareWithInvocationTarget:)
always happens in our model. This is because AppleScript talks directly
to our model objects. (This is standard practice for implementing
scriptability in Cocoa.) There are some interesting (historical?)
interactions between AppleScript and NSUndoManager related to the
runloop.
--Kyle Sluder
_______________________________________________
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