Listener for module library changes

Answered

I'need to be able to listen to module library changes to determine when I need to restart some externa process. Is there a way to do this?

2 comments
Comment actions Permalink

This is how to do it

 

myProject.getMessageBus().connect(myProject).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@Override
public void rootsChanged(ModuleRootEvent event) {
//Here goes your code ;)
}

@Override
public void beforeRootsChange(ModuleRootEvent event) {
System.out.println("WeaveEditorToolingAPI.beforeRootsChange");
}
});
0
Comment actions Permalink

Yes, listening for PROJECT_ROOTS topic is the right way to do this.

0

Please sign in to leave a comment.