Display an XML file in an XML editor, not in the default text editor [message #336847] |
Tue, 07 July 2009 17:10  |
Eclipse User |
|
|
|
Hi,
I am trying to display an XML file programmatically in Eclipse.
Everything is working fine except for the file being displayed as a simple
text file. Since it is an XML file I want it displayed in the XML editor
in Eclipse.
Right now I am opening the file as so:
page.openEditor(fileEditorInput,
org.eclipse.ui.editors.text.EditorsUI.DEFAULT_TEXT_EDITOR_ID );
It opens, but in the default text editor, not in the XML editor.
I notice that once I click on the newly created file in the project list
Eclipse can apparently see that it is an xml file and then decides to
display the file in the XML editor and not the basic text editor. So,
does anyone know the proper replacement ID that I need to give instead of
DEFAULT_TEXT_EDITOR_ID ? I searched and couldn't find any answer.
Thanks,
Andy
|
|
|
Re: Display an XML file in an XML editor, not in the default text editor [message #336848 is a reply to message #336847] |
Wed, 08 July 2009 02:48  |
Eclipse User |
|
|
|
Andy wrote:
> display the file in the XML editor and not the basic text editor. So,
> does anyone know the proper replacement ID that I need to give instead
> of DEFAULT_TEXT_EDITOR_ID ? I searched and couldn't find any answer.
You can use the PDE Spy to find the ids. Its
" org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditor Part ".
Alternatively, you can use simply call IDE.openEditor(page, iFile) to
let the system to determine the correct id using the content type
bindings (or the last opened editor on that IFile)
- Prakash
---
http://blog.eclipse-tips.com
|
|
|
Powered by
FUDForum. Page generated in 0.02431 seconds