For reference, the best documentation on the internal workings of the Open menu that I found is: http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open- recent-menu /
Unfortunately, this helps a little, because even if you create such a menu, it will be ignored by NSDocumentController . The menu must exist in the main menu before calling applicationDidFinishLaunching: otherwise it will not be selected - and, therefore, duplicated ones are also ignored.
What I have finished, and that seems to work so far, is this:
The first idea was to select the appropriate NSMenu from the main menu and attach it to other menus, hoping that link counting would do the job. There is no such luck, setSubmenu displays if the submenu is already in another NSMenuItem .
So, I change the submenu instead - when I need to show it in another menu, I delete it from the "Open last item" main menu and set it as a submenu in the new menu. Later I return it back. Of course, this is an ugly hack, but it does its job.
source share