パースペクティブの追加

リッチ・クライアント・アプリケーションが、ワークベンチをカスタマイズする 1 次手段として WorkbenchAdvisor を使用する場合は、ワークベンチ・ウィンドウに表示されるパースペクティブを指定する必要があります。 このパースペクティブは、アプリケーションのワークベンチ・アドバイザー・クラスで識別される必要があります。以下は、BrowserAdvisor クラス内に指定されています。

	public String getInitialWindowPerspectiveId() {
		return BrowserApp.BROWSER_PERSPECTIVE_ID;
	}

BrowserApp は、以下のように定義します。

	public static final String PLUGIN_ID = "org.eclipse.ui.examples.rcp.browser";
	public static final String BROWSER_PERSPECTIVE_ID = PLUGIN_ID + ".browserPerspective";

ブラウザー・プラグインのマニフェストに対応するパースペクティブが定義されます。

   <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>

BrowserPerspectiveFactory は、ビューを適切にレイアウトします。

	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);
	}

ブラウザー・パースペクティブは、2 つのビュー (1 つは他方のプレースホルダーを持ち可視) を定義し、エディター・エリアを可視にします。パースペクティブおよび対応するレイアウトについての詳細は、『パースペクティブ』を参照してください。