Open an IFile in default editor [message #224418] |
Thu, 08 April 2004 10:55 |
Eclipse User |
|
|
|
Originally posted by: Newsletter.ThorstenSchaefer.de
Hi,
I have to open a file (java source, text file, xml file, ...) in it's
default editor. All I have is the corresponding IFile object. Does anybody
know how to open the editor with the file's content? I searched the help and
newsgoups but all solutions I saw were partial or don't function with the
3.0 M-builds.
TIA,
Thorsten
|
|
|
|
Re: Open an IFile in default editor [message #224865 is a reply to message #224418] |
Thu, 08 April 2004 20:47 |
Eclipse User |
|
|
|
Originally posted by: Marko.Schulz.gmx.de
Thorsten Schäfer wrote:
>
> I have to open a file (java source, text file, xml file, ...) in it's
> default editor. All I have is the corresponding IFile object.
Use org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, IFile, boolean)
You usually get the IWorkbenchPage by calling getPage() on some instance
of IWorkbenchSite, depending on the context you are in. If that really
is impossible, you can revert to acquiring the active Page through
org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchW indow().getActivePage()
HTH
marko
|
|
|
Powered by
FUDForum. Page generated in 0.03186 seconds