When a rich client application uses the WorkbenchAdvisor
as the primary means for customizing the workbench, it must supply a perspective that is shown in the workbench window.
This perspective must be identified in the application's workbench advisor class. The following is specified in the
BrowserAdvisor class:
public String getInitialWindowPerspectiveId() {
return BrowserApp.BROWSER_PERSPECTIVE_ID;
}
While BrowserApp defines:
public static final String PLUGIN_ID = "org.eclipse.ui.examples.rcp.browser";
public static final String BROWSER_PERSPECTIVE_ID = PLUGIN_ID + ".browserPerspective";
The corresponding perspective is defined in the browser plug-in's manifest:
<extension
point="org.eclipse.ui.perspectives">
<perspective
id="org.eclipse.ui.examples.rcp.browser.browserPerspective"
name="%perspectives.browser.name"
class="org.eclipse.ui.examples.rcp.browser.BrowserPerspectiveFactory"
fixed="true"/>
</extension>
The BrowserPerspectiveFactory is responsible for laying out the views appropriately.
public void createInitialLayout(IPageLayout layout) {
layout.addView(BrowserApp.BROWSER_VIEW_ID, IPageLayout.RIGHT, .25f, IPageLayout.ID_EDITOR_AREA);
layout.addPlaceholder(BrowserApp.HISTORY_VIEW_ID, IPageLayout.LEFT, .3f, IPageLayout.ID_EDITOR_AREA);
IViewLayout historyLayout = layout.getViewLayout(BrowserApp.HISTORY_VIEW_ID);
historyLayout.setCloseable(true);
layout.setEditorAreaVisible(false);
}
The browser perspective defines two views (one visible, with a placeholder for the other), and makes the
editor area invisible. For a complete discussion of perspectives and their corresponding layout, see Perspectives.