Hey,
I have a FileEditorManagerListener
implementation that displays a balloon notification for eligible files on file open. I override the fileOpened(FileEditorManager, VirtualFile)
method for that.
class FileOpenListener: FileEditorManagerListener {
override fun fileOpened(source: FileEditorManager, file: VirtualFile) {
//Check file eligibility
//Show balloon if file is eligible
}
}
It works properly for simple cases, but I have faced a problem handling file editor movement to a different editor split or IDE window (e.g via drag-and-drop).
I’m trying to avoid showing the balloon in those cases to not annoy users with it in such cases.
I see that such movements are not handled as actual movements/relocations of an editor, but instead as closing the file, and then reopening that same file. Unfortunately I haven’t found a way of checking if FileEditorManagerListener.fileOpened()
is called after a tab move, or just from a simple file open.
I also saw the com.intellij.openapi.fileEditor.FileEditorManagerKeys#CLOSING_TO_REOPEN
data key, but that is available only during file closing.
So my question is, is there a way to check if a file was reopened after a drag-and-drop or moving to a split?