开发者

Load a class from the users workspace

开发者 https://www.devze.com 2023-04-03 13:32 出处:网络
I´m writing an eclipse plugin which should show some infor开发者_如何学Pythonmation of an enum class. The new view should show all enum constants and the assigned values. The enum values are calculat

I´m writing an eclipse plugin which should show some infor开发者_如何学Pythonmation of an enum class. The new view should show all enum constants and the assigned values. The enum values are calculated in the constructor somehow and it is not obvious in the editor which value they will have at runtime. So that´s the motivation for the plugin. I have tried to access the class which is opened in the editor by the eclipse AST. That way I´m getting the enum constant names of that file but not the assigned values at runtime.

So how can I get the enum values? Is it possible to load a class from the user´s workspace and use reflection to access the values of that class?


I have solved this on the dirty way: I am looking up the .class file from the bin directory, loading it and grabbing the values on this way.

0

精彩评论

暂无评论...
验证码 换一张
取 消