简体   繁体   中英

Finding execution context information about an Eclipse plug-in

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 (ie, 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 (eg, '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).

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM