开发者

Dropping files on application icon in Dock

I have been hitting the wall on this issue for a few days now, and cannot for the life of me figure out what I am doing wrong (or if this is some kind of bug):

I have a custom Mac application (in Java, if it matters). It essentially takes a specific type of document bundle, does some processing on it, and sends the results to a server. 开发者_Python百科I have everything working, except for the one use-case of a user dropping a "file" onto the application's dock icon.

Everything I have read so far seems to indicate that dropping on a Mac Dock icon uses the same Launch Services that the Finder uses. And yet, opening the Applications directory and dropping on the application there works, while dropping on the application icon in the Dock does nothing.

So, some specifics of what I have tried so far:

  • App handles documents with a *.foo extension, which are Document Bundles (i.e. opt-click gives "Show Package Contents" option)
  • Document has UTI of org.example.foo, which conforms to the UTIs com.apple.package and public.composite-content (all info copied from owner application Info.plist Exported Type UTIs key)
  • Info.plist declares this document type in Imported Type UTIs (UTImportedTypeDeclarations key)
  • Also in Info.plist, the UTI is declared in Document Types (CFBundleDocumentTypes key)
    • CFBundleTypeExtensions includes "foo"
    • CFBundleTypeOSTypes set to "****"

Cmd-Opt-drop on the Dock icon (to force the drop) does nothing. Dropping in Finder works exactly as expected. So this appears to be an issue with dropping on the Dock icon specifically.

Any ideas on what to change?


Maz has hit the heart of the issue, I think. The application is set up to run in Mac OS X 10.5 or 10.6, and the Java APIs I am using (com.apple.eawt.*) appear to be deprecated without replacements; which likely explains why it mostly works, but doesn't work in annoying ways.

It seems the actual solution will involve reverse-engineering the JavaApplicationStub executable to work with the newer APIs, and make JNI hooks so that the proper events get passed along to my application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜