I have a Document.xib and a MainMenu.xib, and a class MainController. I added an instance of MainController to Document.xib by dragging the NSObject from the object library to Document.xib's instance tree and setting the class in the property to MainController. I added a button and connected it to one of the actions provided by MainController.
So far, so clear. Now I basically want to call the same action from a menu item. Obviously, I can't just add another instance of MainController to the MainMenu.xib, because I'd end up with two instances. There should be just one per document, and the menu item should call the action in the active document's MainController. How do I do this?
This is what the First Responder proxy icon is for. You can connect menu items to the First Responder proxy, and messages will be sent up the responder chain until they reach an object that handles the message. Your document, along with views and other objects, will participate in the responder chain, and so will have an opportunity to handle the message provided an object earlier in the chain hasn't already done so. The responder chain concept also ensures that the message is delivered to the active document -- if you have more than one document open, you naturally want menu commands to be handled by the document that the user is working on.
So, just make the First Responder icon the target for your menu items and the right thing will happen.