Creating a Form with Table in main editor window Follow
HI JB Team,
I have a JTree structure in TolWIndow, whenever a user clicks an element in JTree I want to create a new file and display a form with JTable in that.
Also, I don't want to save this file in localFileSystem(when the user closes form this needs to be deleted) and also it is read-only. How can I achieve this? I got stuck at creating a new file in editor pane and displaying form content.
Please sign in to leave a comment.
You can customize editors (display Table instead of text editor) via com.intellij.openapi.fileEditor.FileEditorProvider. You can use in-memory files built via com.intellij.testFramework.LightVirtualFile.
As suggested by you, |'ve Implemented FileEditorProvider and FileEditor interfaces and also added the extension in plugin.xml. The mouse click is opening a new form.
My FileEditorProvider accept is like below
After that when the user double clicks an element in the Jtree I'm calling below code.
How can I check a particular LightVirtualFile is already opened? So that when user clicks the same item rather than opening a new tab, we can move to already open file?
Please post link to full plugin sources
Hi, Thanks for your reply.
Unfortunately, I can't share plugin source as I don't know my company policy will allow that or not.
As suggested by you I am able to open a form whenever a JTree element is selected.
But every time I select JTree element it is creating new Form in new Tab. I want to check whether the file corresponding to selected element(determine by filename) is already opened in the editor and if so, I want to change the focus to the existing file rather than creating a new file.
Please try overriding equals() in your LightVirtualFile object according to your semantics