tags:

views:

29

answers:

1

Hi.

I'm developing a plug-in in Eclipse and I want to show a view. I'm using this:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.ui.articles.MyView");

however it's being added on the right not at the set of views where I want it to be displayed.

How can I specify the location?

Thanks and regards Krt_Malta

A: 

Ok found out how.

This gave me the idea of what I should do: http://www.eclipse.org/articles/viewArticle/ViewArticle2.html in the View Position paragraph under the Step 3 section.

When declaring the perspective, I added a placeholder to contain the view. It is shown in the following code:

public void defineLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();   
IFolderLayout bottom =
            layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75f, editorArea);
bottom.addPlaceholder("org.eclipse.ui.articles.MyView");
}

Later on, I use:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.ui.articles.MyView")

to show the view and it appears where I had declared in the Perspective and not at the default right-hand side.

Hope it could help someone else.

Thanks and regards,

Krt_Malta

Krt_Malta
When declaring the perspective, one could use bottom.addView("org.eclipse.ui.articles.MyView"); to show the view immediately once the perspective is loaded, however I didn't want this. I wanted it to be displayed just when required during runtime.
Krt_Malta