The framework I'm writing a plugin for has a specific directory defined for "user" libraries, which can contain binary, source and javadoc JARs. I want my plugin to automatically add this directory as a directory based dependency/library to a module (or as a project library and then that library as a module dependency).
I've tried to find some example of this in the IDEA source code, but everything I'm finding it is heavily intertwined with GUI code and I can't find the point where you just say "create a dependency/library from this directory and add it to the module".
Can you provide some information on how to do such? Ultimately it will run from either AnAction, upon project open, or upon adding my Facet. So I have a handle on the module in all cases.