查找有关Eclipse插件的执行上下文信息 [英] Finding execution context information about an Eclipse plug-in

查看:151
本文介绍了查找有关Eclipse插件的执行上下文信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用我正在开发的Eclipse插件中的 Reflections 库。
显然,当插件在Eclipse中部署为捆绑包时(即,其jar被放在Eclipse的plugins文件夹中),但是当插件在开发期间执行(Run As / Eclipse应用程序),我需要将Reflections库的搜索路径添加到从插件执行的项目中输出的文件夹(例如bin)。

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.

然后我的问题是如果有一种方式知道插件激活时间如下:
- 如果插件已经被部署为捆绑包,或者如果它已经在另一个Eclipse实例的上下文中执行了
- 从插件启动的项目的输出目录(在插件从另一个Eclipse实例执行的情况下)。所以我可以把这个输出目录添加到Reflections库中。

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.

这比一个理想的解决方案更麻烦,但它是唯一的解决方法,直到我发生了,直到现在要使Ref​​lections正常工作,因为我不想在代码中对我的开发项目的输出文件夹进行硬编码。 (如果有人知道如何使用反射,而不必在开发模式下设置输出文件夹,那么也将非常感谢)。

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).

推荐答案

您可能需要调查PDE如何与JDT一起创建运行时eclipse。我知道什么时候从工作区启动eclipse,它设置一个-dev选项,其中包含额外的bin / classpath。它也可能设置一些标志或属性。

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.

请参阅 PDE指南

这篇关于查找有关Eclipse插件的执行上下文信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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