FileEditorManagerListener does not trigger selectionChanged if window is opened on second screen

Hello,

in my plugin i use the FileEditorManagerListener to be informed about changes of tabs or when a new file is opened. This looks like this:

project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
			@Override
			public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
				//react on file opened
			}

			@Override
			public void selectionChanged(@NotNull FileEditorManagerEvent event) {
				//react on selection changed
			}
		});

Today I realized that selectionChanged will only be triggered if the selection of tabs changes in the main window. If you look at the screenshot that would for instance be a switch of tabs from MyFirstTest.java to MyThirdTest.java. In this case the listener works totally fine.

However if I change tabs in the second window(in the screenshot a change between MySecondTest.java to AThourthTest.java) the listener will not trigger.

I am using Intellij 2024.3.3.

Am I doing something wrong here or is this a bug?
Is there a way to work around this issue if it is really a bug?

Best regards,
Samuel

Known issue https://youtrack.jetbrains.com/issue/IJPL-26901/FileEditorManagerListener-fails-to-send-selectionChanged-for-files-opened-in-second-window

1 Like

Oh ok thank you! I will close this topic :ok_hand: