Load module event listener

已回答

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.

0

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

0

Thank you, Alexandr! I'll check it.

0

ModuleComponent is deprecated. What is its replacement, or - how do I listen for modules loaded?

TIA,

dd

0

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.

0

Jakub,

Thank you! I reread documentation last evening, it looks like I skimmed some parts or did not understand them on first reading.

0

请先登录再写评论。