Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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); 
}
like image 783
Abhit Avatar asked Nov 03 '12 06:11

Abhit


People also ask

Which determines the visible actions views and view layout within the Eclipse window?

A perspective determines the visible actions, views, and view layout within the window. There are many types of perspective, and each one defines the layout in a different way.

How do I change the view in Eclipse?

You may switch perspectives by choosing Window, Open Perspective from the main menu, as shown below. Close the Welcome window and you will see the Eclipse user interface. The current perspective is displayed on the title bar.

Which is the valid set of perspective in Eclipse?

The default perspective is called java. An eclipse window can have multiple perspectives open in it but only one perspective is active at any point of time. A user can switch between open perspectives or open a new perspective.


1 Answers

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.

like image 115
Bananeweizen Avatar answered Oct 18 '22 10:10

Bananeweizen