Multi-tabbed editor

I'm trying to add a feature to my plugin that allows the user to edit two files in one tabbed editor. For it to open this edit the user just has to click on some node on the project view panel.

To get this working i've created a VirtualFile wrapper implementation that is associated with each project view tree node. When the user clicks on the node the VirtualFile wrapper is sent into my two FileEditorProvider implementations. Each implementation opens an editor to a different file, this way i get the tabbed editor. The files are usually one java file and one html file.

This works fine except for the fact that when i close the project with one of these editors opened and open the project again, i don't get the VirtualFile wrapper sent into my FileEditorProvider implementations, instead i get just one of the individual VirtualFiles that are really behing edited. This prevents me from opening the tabbed editor correctly on project open.

Any ideas ?
(sorry for the long post but i'm getting desperate)

0
13 comments
Avatar
Permanently deleted user

Jetbrains folks ??? Anyone ???

There's no docs about this and no source code for me to look into, i really need some help on this.

0
Avatar
Permanently deleted user

AFAIK there is already tabbed editing.

Usinw Window>Split command you can see different files in different tabs. Is this different from what you're aiming for ?

0
Avatar
Permanently deleted user

That not the type of tabbed editing that i'm talking about. If you for instance go the JAVA EE view and double click on a web module node you'll see one editor with two tabs on the bottom of the editor.
That's the kind of tabbed editor that i'm referring to.

0
Avatar
Permanently deleted user

The StrutsAssistant plugin has these tabs for the struts-config.xml file. (at least it did in version 6) maybe the source of that one can help you out.

0
Avatar
Permanently deleted user

It does have a tabbed editor, but it's different from what i need. In the struts plugin both tabs edit the same file.
I want to edit two files in two different tabs, using the default editor for both file types.

Consider the following example:

In web framework Tapestry, a component is made up of an HTML file and a class. I want that when a user click on a component node in the Tapestry custom project view to open an editor for the component, with HTML file in one tab and the class file in another tab.
Like i explained before, i have this working, the problem is in restoring the open editor when the project is reopened.

0

Hi Hugo,

How did you implement the multi-tabbed editor?
I need to do something similar... I want to display spec and body of an oracle package in the same editor but under different tabs.
Could you give me some more hints on this? Would appreciate it a lot.

Thanks,
Dan

0
Avatar
Permanently deleted user

Sure.
All you have to do is provide an application component that implements the FileEditorProvider interface. I think you find in the interface javadocs all the info you'll need to get it working. If not, i can provide you with an example.

0

Thanks Hugo!
i did read again your first explanation and finally understood how it is supposed to work. If i define two file editor providers for the same file, than i can expect that ij is showing a tabbed editor, am i right? Wrapping the virtual file and showing two faces of it depending on the editor provider should do the rest. That's cool!

0
Avatar
Permanently deleted user

Yep, that's right......

0

Hi Hugo,

one more thing. How can i rename the tabs of the multitabbed editor?
I am using for both Spec and Body the same type of editor, which is TextEditor.
The tabs are both showing the name "Text" which is fairly undesirable.
Searched long for a public solution to this inconvenience but didn't find. Not even getting hold of the JTabbedPane component seems to be possible.

--
Being able to put some images on the tabs would also be quite nice.
Appreciate any help.

0

That's up to the file editor implementation. If you have a custom implementation just implement the getName() method of the TextEditor interface.

If ur not using a custom file editor i don't have a solution for it.

Message was edited by:
Hugo Palma

0

Well i have one ugly solution for that.
Since i don't want to reimplement TextEditor and inheriting it is not possible, i simply wrap it with my fake implementation of TextEditor and use it's functionality by accessing it's methods. The only method which does something "complex" is the getName() method... :)
uh...

0

Yep, that will work also :o)

0

Please sign in to leave a comment.