How to open an editor in createInitialLayout [message #447557] |
Mon, 10 April 2006 19:21  |
Eclipse User |
|
|
|
Hi,
I am developing a RCP with a view and a editor as the initial perspective.
I add a view to the initial perspective in the createInitialLayout method:
------------------------------------------------------------ ------------------
IFolderLayout tl = layout.createFolder("tl", IPageLayout.LEFT, 0.28f,
editorArea);
tl.addView("views");
------------------------------------------------------------ ------------------
I add an editor in the createInitialLayout method using the following-
------------------------------------------------------------ ------------------
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
page.openEditor(input, "Editor");
------------------------------------------------------------ ------------------
The problem that I am facing is the "page is null" when I run this as an
RCP.
As expected, this works when I run as part of the Eclipse workbench and
not as a product. How do I get around this issue?
Thanks in advance.
Regards,
Ravi
|
|
|
|
|
|
|
Re: How to open an editor in createInitialLayout [message #448358 is a reply to message #447674] |
Fri, 21 April 2006 17:26  |
Eclipse User |
|
|
|
Hi Paul,
Many thanks for your prompt response.
I have resolved this issue by opening the editor in the postWindowOpen
method. The page would have got created by the time this method gets
called.
Regards,
Ravi
Paul Webster wrote:
> Ravi wrote:
>> Hi Paul,
>>
>> Thanks for the reply.
>> I tried attaching a perspective listener to the workbench window. The
>> addPerspectiveListener method doesn't have a return value. I cannot
>> check if my perspective is opened and hence cannot open the editor. Any
>> suggestions?
> Sorry, why didn't you just listen for the perspectiveOpened() event?
> Check out IPerspectiveListener/2/3/4
>> When does the page get created? I understand that createInitialLayout
>> defines the layout of a perspective. To display a perspective you need a
>> page. Any ideas what is the sequence?
> The page gets created and then the perspective gets created in the page.
> The createInitialLayout() can happen any time before the perspective
> gets created. Some of them never get called, since they only get
> instantiated when someone tries to open their perspective.
> Later,
> PW
|
|
|
Powered by
FUDForum. Page generated in 0.05007 seconds