Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 21:10 Go to next message
Andy is currently offline AndyFriend
Messages: 47
Registered: July 2009
Member
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 06:48 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
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: Tue Apr 16 05:28:15 GMT 2024

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

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

Back to the top