0

I am working on an IntelliJ plugin, where the use case is to create a split pane within the editor and add some custom code. The IntelliJ community repo defines RadSplitPane that can be extended to create a split pane, but it does not render a split pane. So my question is

  • is there an out of the box class that I can use to create a split editor (preferably vertical), and passing in some custom string to display?

My IntelliJ version is 2017.3 A code example would be really helpful.

Thank you

shubham
  • 547
  • 2
  • 6
  • 20

1 Answers1

1

There are two ways to do this, as I can understand so far.

FileEditorManager CreateSplitter

// get the project
    Project project = event.getProject();

// get File editor Manager Ex
    final FileEditorManagerEx fileEditorManagerEx = 
    FileEditorManagerEx.getInstanceEx(project);

// get the editorWindow from File Editor Manager Ex
    EditorWindow currentWindow = fileEditorManagerEx.getCurrentWindow();

// create a split
   fileEditorManager.createSplitter(myOrientation, currentWindow);

EditorWindow.split

// get the project
    Project project = event.getProject();

// get File editor Manager Ex
    final FileEditorManagerEx fileEditorManagerEx = 
    FileEditorManagerEx.getInstanceEx(project);

// get the editorWindow from File Editor Manager Ex
    EditorWindow currentWindow = fileEditorManagerEx.getCurrentWindow();
// Create a virtual file 
    VirtualFile virtualFile = new LightVirtualFile(origFile.getName(),origFile.getFileType(), results.get(0));

// create a split
   fileEditorManager.createSplitter(myOrientation, currentWindow);

The first one, creates a copy of the existing virtual file in the current editor and creates a split, the second one can be supplied with an instance of virtual file.

shubham
  • 547
  • 2
  • 6
  • 20