How to open a new file in a split editor through code?
已回答
I have a file open in an editor and if the user clicks on a button I made, it should open a file in split view. I have tried using FileEditorManager to open virtual file but it opens that file in non split view only.
请先登录再写评论。
com.intellij.ide.actions.OpenInRightSplitAction.Companion#openInRightSplit(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile, com.intellij.pom.Navigatable, boolean)?
Thank you so much Yann!!!
Hello, I have implemented this, now I want to that if the user clicks on the right file, the caret is moved to the left file where it was before and the focus is also on the left file. I am trying to use IdeFocusManager in a mouse click function where I recognise if the user has clicked on the right window file but requestFocus is not shifting the focus to the left window.
Please try using listener
com.intellij.openapi.editor.event.EditorMouseListener
andcom.intellij.openapi.fileEditor.FileEditorManager#setSelectedEditor
Hello, how to get the fileEditorProviderId for the above mentioned function? thank you.
Possibly via `com.intellij.openapi.fileEditor.FileEditorProvider#KEY` and then its `com.intellij.openapi.fileEditor.FileEditorProvider#getEditorTypeId`