Load module event listener
Answered
Hello,
I need to listen module load events. From documentation I found that can listen module added/removed events
project.getMessageBus().connect().subscribe(ProjectTopics.MODULES, new ModuleListener() { @Override public void moduleAdded(@NotNull Project project, @NotNull Module module) { } });
But I need to listen events on module load. For example, in Pycharm I have two projects (modules) and I need to handle events when Pycharm is opened and modules loaded.
Thankful for any help!
Best regards,
Aleks.
Please sign in to leave a comment.
IRR moduleAdded invoked not when it was created and added, but when it was loaded and added to the project too.
See the documentation to com.intellij.openapi.module.ModuleComponent
Thank you, Alexandr! I'll check it.
ModuleComponent is deprecated. What is its replacement, or - how do I listen for modules loaded?
TIA,
dd
Dragiša,
Regarding the replacement - or to be more precise, migration to the new SDK API, please read our docs: Plugin Components.
To listen for the module's lifecycle, register ModuleListener.
Everything that I've mentioned is described in the ModuleComponent JavaDocs.
Jakub,
Thank you! I reread documentation last evening, it looks like I skimmed some parts or did not understand them on first reading.