listener for ide actions

I am creating first plugin for idea.
Can I create listener for ide actions like "on open file", "on close file", "commit in git" and etc

My be link to documentation or examples?

thank you

1 comment
Official comment


As for listening for "on open file" and "on close file" event, it can be archived with this code:

MessageBus messageBus = project.getMessageBus();
// or
// MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
MessageBusConnection connection = messageBus.connect();
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {


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

// when it's no longer needed, call 'connection.disconnect()'

To listen for "commit in git", you may use `com.intellij.openapi.vcs.checkin.CheckinHandlerFactory` extension point:

Register it in plugin.xml

<checkinHandlerFactory implementation="package.YourCheckinHandlerFactory"/>

Then you need to obtain information about checked in files in com.intellij.openapi.vcs.checkin.CheckinHandler#checkinSuccessful (see javadoc):

public void checkinSuccessful() {

See another example:

As for documentation or examples, please refer to IntelliJ IDEA source code and

Please sign in to leave a comment.