Page 1 of 1

Title of the XML editor in Eclipse version

Posted: Mon Mar 12, 2012 12:13 pm
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?

Re: Title of the XML editor in Eclipse version

Posted: Mon Mar 12, 2012 12:58 pm
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

Re: Title of the XML editor in Eclipse version

Posted: Mon Mar 12, 2012 2:01 pm
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: