将文件拖放到Dock中的应用程序图标上 [英] Dropping files on application icon in Dock

查看:130
本文介绍了将文件拖放到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):

我有一个自定义Mac应用程序(如果需要的话,请使用Java).本质上,它采用特定类型的文档包,对其进行一些处理,然后将结果发送到服务器.除了用户将一个文件"拖放到应用程序的停靠图标上的一个用例之外,我已经完成了所有工作.

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. I have everything working, except for the one use-case of a user dropping a "file" onto the application's dock icon.

到目前为止,我所阅读的所有内容似乎都表明,将Mac Dock图标放到桌面上使用的是与Finder使用的启动服务相同的启动服务.但是,打开应用程序"目录并将其放在该应用程序上是可行的,而在Dock中的应用程序图标上却没有任何作用.

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:

  • 应用程序处理扩展名为* .foo的文档,这些文档是文档包(即opt-click提供显示包内容"选项)
  • 文档的UTI为org.example.foo,符合UTI的com.apple.package和public.composite-content(从所有者应用程序Info.plist导出的类型的UTIs密钥复制的所有信息)
  • Info.plist在导入的类型" UTI(UTImportedTypeDeclarations键)中声明此文档类型
  • 也在Info.plist中,在文件类型(CFBundleDocumentTypes键)中声明了UTI.
    • CFBundleTypeExtensions包含"foo"
    • CFBundleTypeOSTypes设置为"****"
    • 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 "****"

      Dock图标上的Cmd-Opt-drop(强制放置)没有任何作用.放入Finder的工作原理与预期的完全一样.因此,这似乎是专门放置Dock图标的问题.

      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触及了问题的核心.该应用程序已设置为可在Mac OS X 10.5或10.6中运行,并且我正在使用的Java API(com.apple.eawt.*)似乎已被弃用,无需替换;这很可能解释了为什么它大部分都能工作,但不能以烦人的方式工作.

      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.

      看来,实际的解决方案将涉及对JavaApplicationStub可执行文件进行逆向工程以与较新的API一起使用,并制作JNI挂钩,以便将正确的事件传递给我的应用程序.

      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.

      这篇关于将文件拖放到Dock中的应用程序图标上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆