Load a class from the users workspace

2019-07-17 05:00发布

I´m writing an eclipse plugin which should show some information 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?

1条回答
小情绪 Triste *
2楼-- · 2019-07-17 05:31

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.

查看更多
登录 后发表回答