We are currently working on a plugin that adds a custom editor. We have implemented a FileEditorProvider that accepts files with certain extensions, and creates a custom FileEditor. It works very well; however, after the first editor is open, we would like to somehow intercept any attempt to open a file with the supported extensions, prevent opening a new editor tab, and instead obtain the already opened editor and perform some custom logic.
What we've tried: in FileEditorProvider.createEditor(), we return the already existing editor, but a new editor tab is still opened, with no content. Any way to prevent this? We've also tried registering an AnActionListener to intercept the open action, but it does not seem to be called on double-click.
Any pointers on how to achieve this would be very appreciated,