How to find topics ?

MessageBus bus = ApplicationManager.getApplication().getMessageBus();
MessageBusConnection connection = bus.connect();
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
    @Override
    public void
fileOpened(FileEditorManager source, VirtualFile file) {
    }

    @Override
    public void
fileClosed(FileEditorManager source, VirtualFile file) {

    }

    @Override
    public void
selectionChanged(FileEditorManagerEvent event) {

    }
});




I want to use the MessageBus to subscribe some event like: saved file, installed a plugin, run tests.

But I don't know the Topic of these event.

How to find the Topics I wanted?

6 comments
Comment actions Permalink

The only way seems to be using "Find Usages" on com.intellij.util.messages.Topic#create(java.lang.String, java.lang.Class<L>) or any of its other CTORs.

0
Comment actions Permalink

Note that topics aren't a general way to learn about everything happening inside the IDE; there is no such way. For example, IntelliJ IDEA does not broadcast notifications of any kind when a plugin is installed, and test execution listeners need to be attached to specific run configurations.

0
Comment actions Permalink

so what's the best way to do this?

0
Comment actions Permalink

To do what? As I said, there is no API to let you get notified about everything happening in the IDE.


0
Comment actions Permalink

Would it be possible to use enum (instead of String) for topics? ;)

0
Comment actions Permalink

No, of course not. Any component of the IDE, and any plugin, can provide its own topic.

0

Please sign in to leave a comment.