How to get the test sources directories of the module of given virtualfile Follow
Answered
That's it, my pluging generates test objectmother for java classes so, when selected that classes, I would like to generate their correponding object mothers in the same package in its corresponding testsource directory.
How can I get the testsource directory(or directories) from the virtualfile selected by user?
Please sign in to leave a comment.
Via com.intellij.openapi.roots.ModuleRootManager#getInstance, obtain com.intellij.openapi.roots.ModuleRootModel#getSourceRoots(org.jetbrains.jps.model.module.JpsModuleSourceRootType<?>) that allows querying Module's source/content roots etc. You can use com.intellij.psi.JavaDirectoryService to create class.
Thanks, works flawlessly :D