Login | Register
My pages Projects Community openCollabNet

scplugin
Wiki: MenuCallbackDefinition

On Friday, May 18, the normal maintenance window (17:00 Pacific time) will be extended for data center maintenance until 23:00 Pacific. No extended down-time is planned, but brief delays and interruptions are possible throughout the period.

Edit this page | Links to this page | Page information | Attachments | Refresh page

 

When the user picks a menu item, some code you don't have to mess with causes Finder to send an Apple Event over to the SCPluginUIDaemon process. This code unpacks the message, and calls a "call-back routine," which you have to provide. These callbacks are coded in SCPluginUIDaemon/SCUIDaemonController+SubversionSupport.m.

Call-back routines should not do any UI stuff. Call-back routines should not do any SVN stuff. Call-back routines are strictly argument-marshalling routines between the AppleEvent mechanisms and the real code.

As you can see from the existing examples, the callbacks get one argument, an NSArray of NSStrings called "paths". This is the list of files and/or directories which are the Finder selection. The first one, [paths objectAtIndex: 0], is the "primary selection," if that matters to you. This is the one where the user actually issued the command. That is, if you select 10 files and directories, you still have to hit ctrl-click ir right-click to pop up the menu to issue the command. The file or directory you actually click on is the "primary selection."

Some commands care which member of the selection is "primary." For example, the "Checkout…" command defaults to checking out the files into the directory which is the primary selection. If the user selects 20 files and directories, you're still only going to get one checkout! It goes into the "primary selection."

MenuCallbackDefinition (last edited 2009-10-02 23:19:54 -0700 by jackrepenning)