Access class from project in plugin code
I need to access a project level Class from plugin code at runtime
I see that plugin classloader is different from project's classloader. I am getting ClassNotFoundException when I try to find class using both plugin's classloader & also classloader of PsiElement
Is there a way to get access project level Class from plugin code?
Please sign in to leave a comment.
The IDE analyzes source code, not class files resulting from the compilation, and so doesn't normally use classloaders for project classes. Which problem are you trying to solve?
I'm trying to show suggestions if the class I encountered in the classpath via OrderEnumerator. If the class I enum, I want to show the suggestion as a list of choices in UI
Sorry, I don't understand you. If you need to enumerate all classes, you can use AllClassesSearch (but it can be very slow).
Sorry for the delay in responding.
I need to show values of an enum as suggestions within IDE editor. This enum comes from the classpath of the project, which can only be determined at runtime.
What if the enum is not compiled?
Have you considered finding corresponding PsiClass (JavaPsiFacade#findClass) and using its getFields for suggestions?
Hi,
I'll give it a try. Thanks