same view multiple times in perspective [message #51125] |
Thu, 11 October 2007 09:29 |
Eclipse User |
|
|
|
Originally posted by: s5824917.inf.tu-dresden.de
hello again,
I want to display a view multiple times in a perspective.
For a single view I simply create a folder and use the AddView(String
viewId) function to show that view. But
if I use the same view for the second folder it won't show up. No errors
show up though.
code inside the perspective.java... createInitialLayout...
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible( false );
IFolderLayout topLeft = layout.createFolder(
"left",IPageLayout.LEFT,0.25f,editorArea );
topLeft.addView( "testview" );
IFolderLayout topRight = layout.createFolder(
"right",IPageLayout.RIGHT,0.70f,editorArea );
topRight.addPlaceholder(viewId + ":*");
topRight.addView( "testview" );
So I looked for a solution and found that you have to use some secondary ID.
IWorkbenchPage page = ...;
String id = "org.eclipse.faq.examples.BooksView";
page.showView(id, "1", IWorkbenchPage.VIEW_VISIBLE);
page.showView(id, "2", IWorkbenchPage.VIEW_ACTIVATE);
But I can't find a way to apply that to my code inside the perspective.java
Any hints would be appreciated :)
|
|
|
Re: same view multiple times in perspective [message #52305 is a reply to message #51125] |
Wed, 17 October 2007 10:59 |
Eclipse User |
|
|
|
Originally posted by: fappel.innoopract.com
Hi,
here is a snippet from the RAP demo which shows how multiple views normally
opened within actions
browserAction = new Action() {
public void run() {
browserIndex++;
try {
window.getActivePage()
.showView( "org.eclipse.rap.demo.DemoBrowserViewPart",
String.valueOf( browserIndex ),
IWorkbenchPage.VIEW_ACTIVATE );
} catch( PartInitException e ) {
e.printStackTrace();
}
}
};
Unfortunately I'm not aware of any method how to do this in the
IPerspectiveFactory. But I opened the multiple views in the
WorkbenchWindowAdviser#postWindowOpen() method which worked fine for me.
Maybe that will do the trick for you too.
Note that the view's extension declaration must set the flag multiple to
true.
Hope that helps
Ciao
Frank
"Stefan Lindner" <s5824917@inf.tu-dresden.de> schrieb im Newsbeitrag
news:fekqe1$n2o$1@build.eclipse.org...
> hello again,
>
> I want to display a view multiple times in a perspective.
>
> For a single view I simply create a folder and use the AddView(String
> viewId) function to show that view. But
> if I use the same view for the second folder it won't show up. No errors
> show up though.
>
>
> code inside the perspective.java... createInitialLayout...
>
> String editorArea = layout.getEditorArea();
> layout.setEditorAreaVisible( false );
>
> IFolderLayout topLeft = layout.createFolder(
> "left",IPageLayout.LEFT,0.25f,editorArea );
> topLeft.addView( "testview" );
>
> IFolderLayout topRight = layout.createFolder(
> "right",IPageLayout.RIGHT,0.70f,editorArea );
> topRight.addPlaceholder(viewId + ":*");
> topRight.addView( "testview" );
>
>
>
> So I looked for a solution and found that you have to use some secondary
> ID.
>
> IWorkbenchPage page = ...;
> String id = "org.eclipse.faq.examples.BooksView";
> page.showView(id, "1", IWorkbenchPage.VIEW_VISIBLE);
> page.showView(id, "2", IWorkbenchPage.VIEW_ACTIVATE);
>
>
> But I can't find a way to apply that to my code inside the
> perspective.java
> Any hints would be appreciated :)
>
|
|
|
Powered by
FUDForum. Page generated in 0.04041 seconds