Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Display an XML file in an XML editor, not in the default text editor
Display an XML file in an XML editor, not in the default text editor [message #336847] Tue, 07 July 2009 17:10 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:ComboBoxViewerCellEditor problem
Next Topic:When is the feature "image" property used?
Goto Forum:
  


Current Time: Wed Mar 12 00:28:21 EDT 2025

Powered by FUDForum. Page generated in 0.02431 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top