| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html lang="en"> |
| <HEAD> |
| |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| |
| <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> |
| <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> |
| |
| <LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> |
| <TITLE> |
| Adding the perspective |
| </TITLE> |
| |
| <link rel="stylesheet" type="text/css" HREF="../book.css"> |
| </HEAD> |
| <BODY BGCOLOR="#ffffff"> |
| <H3> |
| Adding the perspective</H3> |
| <P> |
| When a rich client application uses the <b><a href="../reference/api/org/eclipse/ui/application/WorkbenchAdvisor.html">WorkbenchAdvisor</a></b> |
| 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 |
| <b>BrowserAdvisor</b> class:</p> |
| <pre> public String getInitialWindowPerspectiveId() { |
| return BrowserApp.BROWSER_PERSPECTIVE_ID; |
| } |
| </pre> |
| <p>While <b>BrowserApp</b> defines:</p> |
| <pre> public static final String PLUGIN_ID = "org.eclipse.ui.examples.rcp.browser"; |
| public static final String BROWSER_PERSPECTIVE_ID = PLUGIN_ID + ".browserPerspective"; |
| </pre> |
| <p>The corresponding perspective is defined in the browser plug-in's manifest:</p> |
| <pre> <extension |
| point="org.eclipse.ui.perspectives"> |
| <perspective |
| id="org.eclipse.ui.examples.rcp.browser.browserPerspective" |
| name="%perspectives.browser.name" |
| class="<b>org.eclipse.ui.examples.rcp.browser.BrowserPerspectiveFactory</b>" |
| fixed="true"/> |
| </extension> |
| </pre> |
| <p>The <b>BrowserPerspectiveFactory</b> is responsible for laying out the views appropriately.</p> |
| <pre> 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); |
| } |
| </pre> |
| <p>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 <a href="workbench_perspectives.htm">Perspectives</a>. |
| </p> |
| |
| |
| |
| |
| |
| </BODY> |
| </HTML> |