How to unsubscribe a BulkFileListener
I registered one like this:
ApplicationManager.getApplication().getMessageBus().connect(project).subscribe(VFS_CHANGES, new ConfigBulkFileListener());
ConfigBulkFileListener is my implementation of BulkFileListener.
But how can I unsubscribe the listener? I tried:
ApplicationManager.getApplication().getMessageBus().connect(project).disconnect();
ApplicationManager.getApplication().getMessageBus().connect(project).subscribe(VFS_CHANGES, null);
both don't work, my listener still get triggered.
Thanks.
Please sign in to leave a comment.
Keep the instance of `MessageBusConnection` returned by `connect()`, and call `disconnect()` on it.
Thank you Roman, it works!