I have read the documentation: Listeners | IntelliJ Platform Plugin SDK
I have added the message subscription code to my StartupActivity.
project.getMessageBus().connect().subscribe(VirtualFileManager.VFS_CHANGES,
new BulkFileListener() {
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
// handle the events
System.out.println("MyFileDropListener.after: "+events);
}
});
I have registered my listener in plugin.xml
<applicationListeners>
<listener class="simula.plugin.util.MyVfsListener"
topic="com.intellij.openapi.vfs.newvfs.BulkFileListener"/>
</applicationListeners>
And implemented MyVfsListener.java
public class MyVfsListener implements BulkFileListener {
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
System.out.println("MyVfsListener.after: "+events);
}
}
When I run my plugin and drop a file, no ‘after’ method is called.
However; the editor got the file and showed it correctly.
What am I doing wrong ?