How can I specify a position for a view ? [message #467124] |
Sat, 28 April 2007 04:18  |
Eclipse User |
|
|
|
hi, all
I separatea perspective into two parts with the code below:
------------------------------------------------------------ --
String editorArea = layout.getEditorArea();
IFolderLayout folder = layout.createFolder("left",IPageLayout.LEFT,0.6f,editorArea);
folder.addView(CustomView.ID);
IFolderLayout rightFolder = layout.createFolder("right",IPageLayout.RIGHT,0.4f,editorArea);
rightFolder.addView(ProductView.ID);
------------------------------------------------------------ --
I want to open another view that named "TaskView" in the left part, when click a button on CustomView. The code is:
------------------------------------------------------------ --
IWOrkbenchWindow window = getViewSite().getWorkbenchWindow();
window.getActivePage().showView(TaskView.ID,Integer.toString (instanceNum++),IWorkbenchPage.VIEW_ACTIVATE);
------------------------------------------------------------ --
But the "TaskView" is always opened in the right part.
Why? And how can I specify the position for a view?
Any help will be appreciated!
|
|
|
Re: How can I specify a position for a view ? [message #467130 is a reply to message #467124] |
Sat, 28 April 2007 06:37   |
Eclipse User |
|
|
|
xldelg schrieb:
> hi, all
> I separatea perspective into two parts with the code below:
> ------------------------------------------------------------ --
> String editorArea = layout.getEditorArea();
> IFolderLayout folder = layout.createFolder("left",IPageLayout.LEFT,0.6f,editorArea);
> folder.addView(CustomView.ID);
>
> IFolderLayout rightFolder = layout.createFolder("right",IPageLayout.RIGHT,0.4f,editorArea);
> rightFolder.addView(ProductView.ID);
> ------------------------------------------------------------ --
> I want to open another view that named "TaskView" in the left part, when click a button on CustomView. The code is:
>
> ------------------------------------------------------------ --
> IWOrkbenchWindow window = getViewSite().getWorkbenchWindow();
> window.getActivePage().showView(TaskView.ID,Integer.toString (instanceNum++),IWorkbenchPage.VIEW_ACTIVATE);
> ------------------------------------------------------------ --
>
> But the "TaskView" is always opened in the right part.
> Why? And how can I specify the position for a view?
> Any help will be appreciated!
hi,
you can add a placeholder for the view to the lef folder in your
perspective. Eclipse will then place the view at the position of the
placeholder.
For your example code this line may fix it.
folder.addPlaceholder(TaskView.ID);
karsten
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08846 seconds