处理 Eclipse Package Explorer 中的文件拖放
我正在尝试创建一个 Eclipse 插件来支持专有的项目文件格式。我的目标是能够将项目资源管理器中的文件(任何类型的文件)拖放到我支持的类型的文件上,并将被拖动的文件的名称附加到专有文件的末尾。
现在,我有一个自定义编辑器,可以以可管理的方式从现有文件中解析出一些数据。这意味着我有一个与该文件类型关联的编辑器,这样我的特殊图标就会显示在它旁边。我不知道这是否相关。
我正在尝试使用扩展点“org.eclipse.ui.dropActions”,但我不确定如何注册我的 DropActionDelegate (实现 org.eclipse.ui.part.IDropActionDelegate),以便在文件时调用它被拖放到项目资源管理器中我的类型之一。
有人有什么想法吗?我的 DropActionDelegate 是否走在正确的轨道上?
I'm trying to create an Eclipse plugin to support a proprietary project file format. My goal is to be able to drag and drop a file in the Project Explorer (any type of file) onto a file of the type I support, and have the name of the file being dragged appended to the end of the proprietary file.
Right now, I have a custom editor that can parse out some data from an existing file in a manageable way. This means that I have an editor associated with the file type, such that my special icon shows up next to it. I don't know if that's relevant.
I'm attempting to use the extension point "org.eclipse.ui.dropActions" but I'm not sure how to register my DropActionDelegate (implements org.eclipse.ui.part.IDropActionDelegate) such that it will be called when a file is dropped onto one of my type within the Project Explorer.
Anybody have any ideas? Am I even on the right track with the DropActionDelegate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在正确实施 IDropActionDelegate:
扩展点
org.eclipse.ui.dropActions
的目的是为您不需要的视图提供放置行为没有定义自己(如项目资源管理器)。您注册 删除操作扩展,如下所示:
不要忘记在插件代码中为编辑器附加足够的侦听器:
You are on the right track implementing an IDropActionDelegate:
The purpose of the extension point
org.eclipse.ui.dropActions
is to provide drop behaviour to views which you don't have defined yourself (like the Project Explorer).You register the drop action extension like this:
Don't forget to attach an adequate listener to your editor in your plugin code: