Abhit
Abhit

Reputation: 491

Adding a view on perspective in particular folder

In my Eclipse RCP application I have four views A, B, C, D. I want to display only A, B, C view at application start-up, and D view to be displayed when user click on button.On start-up Application will look like this

I am adding a view dynamically

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("D_ViewID",null, IWorkbenchPage.VIEW_ACTIVATE);

this view is added at the bottom but I want this D view adjacent to B_View in such a way enter image description here

my perspective code is here:

@Override
public void createInitialLayout(IPageLayout layout) {

    String editor = layout.getEditorArea();
    layout.setEditorAreaVisible(false); 

    IFolderLayout top=layout.createFolder("view",IPageLayout.TOP , 0.80f, editor);
    top.addView(B.ID);

    layout.addView(A.ID, IPageLayout.LEFT, 0.20f, BrowserView.B);           
    layout.addView(c.ID, IPageLayout.BOTTOM, 0.20f,editor); 
}

Upvotes: 6

Views: 5374

Answers (1)

Bananeweizen
Bananeweizen

Reputation: 22070

You need to add a placeholder to the perspective, just like you added your already visible views. If you look at the top of the IPageLayout documentation, there is an example adding the bookmarks view as placeholder.

Upvotes: 5

Related Questions