查找有关 Eclipse 插件的执行上下文信息

发布于 2024-12-19 21:20:30 字数 539 浏览 1 评论 0原文

我正在当前开发的 Eclipse 插件中使用 Reflections 库。 显然,当插件在 Eclipse 中作为捆绑包部署时一切都很好(即,它的 jar 被放入 Eclipse 的插件文件夹中),但是当插件在开发过程中执行时(运行为/Eclipse 应用程序),我需要将执行插件的项目的输出文件夹(例如“bin”)添加到 Reflections 库的搜索路径中。

那么我的问题是,是否有办法在插件激活时知道以下信息: - 如果插件已作为捆绑包部署,或者已在另一个 Eclipse 实例的上下文中执行 - 启动插件的项目的输出目录(如果插件是从另一个 Eclipse 实例执行的)。所以我可以将该输出目录添加到 Reflections 库中。

这更像是一种黑客行为,而不是理想的解决方案,但这是我迄今为止想到的唯一使反射正常工作的解决方法,因为我不想在代码中硬编码我的开发项目的输出文件夹。 (如果有人知道我如何使用 Reflections 而无需在开发模式下设置输出文件夹,那也将受到高度赞赏)。

I am using the Reflections library in the Eclipse plug-in I am currently developing.
Apparently everything is fine when the plug-in is deployed as a bundle in Eclipse (i.e., its jar is dropped in the plugins folder of Eclipse), but when the plug-in is executed during development (Run As/Eclipse Application), I need to add to the search paths of the Reflections library the output folder (e.g., 'bin') from the project where the plug-in was executed.

Then my question is if there a way to know, at plug-in activation time, the following:
- if the plugin has been deployed as a bundle, or if it has been executed in the context of another Eclipse instance
- the output directory of the project from where the plugin was launched (in case of the plug-in being executed from another Eclipse instance). So I could add that output directory to the Reflections library.

This is rather more a hack than an ideal solution, but it is the only workaround that has occurred to me until now to make Reflections work properly, given that I do not want to hardcode the output folder of my development project in the code. (if someone knows how I could use Reflections without having to set the output folder when in developing mode, that would be highly appreciated also).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花落人离去 2024-12-26 21:20:30

您可能需要研究 PDE 如何与 JDT 配合使用来创建运行时 Eclipse。我知道当它从工作区启动 Eclipse 时,它​​会设置一个 -dev 选项,其中包含额外的 bin/类路径。它也可能设置一些标志或属性。

请参阅 PDE指南

You might have to investigate how PDE works with JDT to create a runtime eclipse. I know when it launches an eclipse from a workspace, it sets a -dev option that includes extra bin/ classpaths. It might set some flags or properties as well.

See PDE Guide.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文