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.
请先登录再写评论。
Keep the instance of `MessageBusConnection` returned by `connect()`, and call `disconnect()` on it.
Thank you Roman, it works!