I have an application where I have different perspective.In one perspective I want to remove certain views which has been added to the layout. Below is my snippet:
This is the snippet which I call when I want to reset perspective
public void createInitialLayout(IPageLayout layout) {
layout.setEditorAreaVisible(false);
layout.setFixed(false);
//I am dividing the whole layout into 4 parts.One is top left,top right,bottom left,bottom right.
IFolderLayout topLeft = layout.createFolder(TOP_LEFT_ID, IPageLayout.LEFT, 0.25f, IPageLayout.ID_EDITOR_AREA);
topLeft.addView(SpaceView.ID);
topLeft.addView(RepositoryView.ID);
IFolderLayout topRight = layout.createFolder(TOP_RIGHT_ID, IPageLayout.TOP, 0.25f, IPageLayout.ID_EDITOR_AREA);
topRight.addView(ModuleView.ID);
topRight.addView(ProjectChangeLogView.ID);
topRight.addView(SearchViewPart.ID);
IFolderLayout bottomLeft = layout.createFolder(BOTTOM_LEFT_ID, IPageLayout.BOTTOM, 0.70f, TOP_LEFT_ID);
bottomLeft.addView(QueueView.ID);
IFolderLayout bottomRight = layout.createFolder(BOTTOM_RIGHT_ID, IPageLayout.BOTTOM, 0.55f, TOP_RIGHT_ID);
bottomRight.addView(Objects.ID);
}
Now after the perspective got reset ,I want to remove certain views (e.g Object view) from the layout.Here I dont get any option for bottomRight.delelte/removeView etc.So how can I achieve the same?
The perspective factory is only used when the perspective is first used and when it is reset. It can't be used to change the layout of an open perspective.
I don't know of a simple way to move the position of views. You probably need to modify the e4 application model by moving the MPart
to a new MPartStack
in a similar way to the drag and drop code (org.eclipse.e4.ui.workbench.addons.dndaddon.DnDManager
)