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.
0

com.intellij.ide.actions.OpenInRightSplitAction.Companion#openInRightSplit(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile, com.intellij.pom.Navigatable, boolean)?

0

Thank you so much Yann!!!

0

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.

0

Please try using listener com.intellij.openapi.editor.event.EditorMouseListener and com.intellij.openapi.fileEditor.FileEditorManager#setSelectedEditor

0

Hello, how to get the fileEditorProviderId for the above mentioned function? thank you.

0

Possibly via `com.intellij.openapi.fileEditor.FileEditorProvider#KEY` and then its `com.intellij.openapi.fileEditor.FileEditorProvider#getEditorTypeId`

0

请先登录再写评论。