Listen to event for editor focus / unfocus.

MessageBus bus = project.getMessageBus();

MessageBusConnection connection = bus.connect();

connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
@Override
public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
System.out.println("11111111111111111111111111");
}

@Override
public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
System.out.println("222222222222222222222222222");
}
});

 

This will only be triggered when something is opened, not when it is activated / unactivated. 

 

Is there a way to listen to desired events? 

2 comments
Comment actions Permalink

I had to poll in the end. 

0
Comment actions Permalink

I had to poll in the end. 

0

Please sign in to leave a comment.