[Howto] [jface] open an editor from within a Wizard? [message #1492] |
Mon, 21 April 2003 14:56  |
Eclipse User |
|
|
|
R2.0.2, Win2K
One can open an editor with the following code, where _site is an
IWorkbenchPartSite (ViewSite or EditorSite) and _ifile is a valid IFile
known to Eclipse.
final IWorkbenchPage page =
_site.getWorkbenchWindow().getActivePage();
try {
if (page != null) {
page.openEditor(_ifile);
}
} catch (PartInitException e) {
e.printStackTrace();
}
Since Wizards have no (access to any) IWorkbenchPartSite, is it possible
as one of the effects of a Wizard to open an editor? If not, what is
the theoretical reason, if any, for not allowing that?
thanks,
Paul K
|
|
|
Re: [Howto] [jface] open an editor from within a Wizard? [message #1567 is a reply to message #1492] |
Sun, 20 April 2003 16:02   |
Eclipse User |
|
|
|
Originally posted by: gsrt.terra.com.br
I'm not quite sure if it will work, or even if it is possible, but have you
tried the code ?
PlaformUI.getWorkbench().getActiveWorkbenchWindow().getActiv ePage().openEditor(IFile);
[]s
Glauco Reis
"Paul T. Keyser" wrote:
> R2.0.2, Win2K
>
> One can open an editor with the following code, where _site is an
> IWorkbenchPartSite (ViewSite or EditorSite) and _ifile is a valid IFile
> known to Eclipse.
>
> final IWorkbenchPage page =
> _site.getWorkbenchWindow().getActivePage();
> try {
> if (page != null) {
> page.openEditor(_ifile);
> }
>
> } catch (PartInitException e) {
> e.printStackTrace();
> }
>
> Since Wizards have no (access to any) IWorkbenchPartSite, is it possible
>
> as one of the effects of a Wizard to open an editor? If not, what is
> the theoretical reason, if any, for not allowing that?
>
> thanks,
> Paul K
|
|
|
Re: [Howto] [jface] open an editor from within a Wizard? [message #2829 is a reply to message #1567] |
Tue, 22 April 2003 11:48  |
Eclipse User |
|
|
|
Perfect! Thanks!
Paul K
Glauco Reis wrote:
> I'm not quite sure if it will work, or even if it is possible, but have you
> tried the code ?
>
> PlaformUI.getWorkbench().getActiveWorkbenchWindow().getActiv ePage().openEditor(IFile);
>
> []s
> Glauco Reis
>
> "Paul T. Keyser" wrote:
>
> > R2.0.2, Win2K
> >
> > One can open an editor with the following code, where _site is an
> > IWorkbenchPartSite (ViewSite or EditorSite) and _ifile is a valid IFile
> > known to Eclipse.
> >
> > final IWorkbenchPage page =
> > _site.getWorkbenchWindow().getActivePage();
> > try {
> > if (page != null) {
> > page.openEditor(_ifile);
> > }
> >
> > } catch (PartInitException e) {
> > e.printStackTrace();
> > }
> >
> > Since Wizards have no (access to any) IWorkbenchPartSite, is it possible
> >
> > as one of the effects of a Wizard to open an editor? If not, what is
> > the theoretical reason, if any, for not allowing that?
> >
> > thanks,
> > Paul K
|
|
|
Powered by
FUDForum. Page generated in 0.02645 seconds