Title of the XML editor in Eclipse version

Oxygen general issues.
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Title of the XML editor in Eclipse version

Post by SSC »

Hello,

To open the Oxygen XML editor in Eclipse RCP I inherited a class from the org.eclipse.ui.ide.FileStoreEditorInput and have overridden the getName() method so that the XML Editor has a more informative title than the actual filename of the XML document.

This works well for the session in which the editor is opened with the EditorInput. But when I close the client and restart it, only the filename of the XML document is shown as the editor´s title.

Is there maybe a differend approach to store the title between client sessions?
Simon Scholz
vogella GmbH
http://www.vogella.com
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Title of the XML editor in Eclipse version

Post by Radu »

Hi Simon,

The Oxygen plugin does not alter the functionality of displaying the tab title in any way.
So I do not know what suggestion to give you.
Possible when Eclipse is closed, it uses the:
org.eclipse.ui.ide.FileStoreEditorInput.getPersistable()

to save the path to the file in its options, and then when reopened it will create a regular FileStoreEditorInput for it.
Eclipse also has this lazy way of re-opening files, it just shows the tab text there and only when clicked will actually initialize the editor.

Same behavior could probably be reproduced without re-starting Eclipse, just by using the File menu to Reopen the last closed editor.

Maybe you could call:
org.eclipse.ui.part.EditorPart.setPartName(String)

after the editor is opened. The method is protected but maybe you could call it by using reflection.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: Title of the XML editor in Eclipse version

Post by SSC »

Hi Radu,

thanks for the hint concerning the getPersistable() method.

The org.eclipse.ui.ide.FileStoreEditorInputFactory just stores the uri of the file, so I´ve created my own FileStoreEditorInputFactory which also stores the name of the IEditorInput to an IMemento instance.

So the issue is solved. :wink:
Simon Scholz
vogella GmbH
http://www.vogella.com
Post Reply