Managing Open Recent menu in a sandboxed application
Emmanuel Puybaret
puybaret at eteks.com
Mon Mar 9 18:29:35 UTC 2015
Hi,
As you probably know, an Apple sandboxed application can read only files that the user selected with a standard file dialog box or from an Open Recent menu. In a sandboxed Swing application, this obliges to use FileDialog AWT class to select files but this is not a big issue since JFileChooser class is so poor. Managing an Open Recent menu from a such an application is much more tricky because Apple lets you read only the recent files managed by a menu created with a nib file, and menus in a Swing application are not created that way.
As all programers who use a non standard framework for their application have the same issue, a simple search
https://www.google.com/search?q=%22open+recent%22+sandbox
might give some tips like the following one
http://www.juce.com/comment/287990#comment-287990
which proposes to create a dummy nib file containing only "File > Open recent" menu, retrieve recent files returned by recentDocumentURLs in NSDocumentController class, and then uses these recent files to populate your own menu.
Would it be possible to use this tip to create a new method in com.apple.eawt.Application that would return the recent files?
Thanks for your suggestions,
--
Emmanuel PUYBARET
Sweet Home 3D developer
Email : puybaret at eteks.com
Web : http://www.eteks.com
http://www.sweethome3d.com
More information about the macosx-port-dev
mailing list