How to create a vertical Split Editor from Plugin?

Hi, 

I am working on an IntelliJ Plugin and wanted to know if there is a way to create a split editor with some custom string when the action is triggered in via the plugin.

The idea is to click a button and create a split pane/ split editor preferably vertical and show some custom text.

Any Suggestion would be helpful.

 

Thank you,

0
5 comments

See FileEditorManager/FileEditorManagerEx classes. e.g. `FileEditorManagerEx#createSplitter` method can be used to create a split window.

 

0
Avatar
Permanently deleted user

Hi Dmitry, 

 

Thank you for the quick response, it worked. Just head into another blocker here, is there a way to pass a custom value that can be printed out in the new window?

0

Adding a tab with some content is done by opening a file (VirtualFile) in FileEditorManager. You can use LightVirtualFile if it's just some content which is not stored on disk.

0
Avatar
Permanently deleted user

If I change a file in one window (by passing in the characters), it changes the file in the other window as well.

Is there a way to keep one file as it is and pass another file reference in the createSplitter method.

The createSplitter requires editorWindow, and a new instance of editorWindow requires another dependency, it seems to be a rabbit hole.

Can you help me with a scratch pad code just to get my head around it.

 

Thank you,

0

FileEditorManagerEx#createSplitter does indeed an editor for the same file in created split. You can close it and open the file you want in target split, but it's simpler to use EditorWindow.split method instead, passing VirtualFile that you want to open in new split. You can obtain required EditorWindow instance from FileEditorManager (e.g. using FileEditorManagerEx.getCurrentWindow()).

0

Please sign in to leave a comment.