Hello World Manifest

在執行新視圖之前,讓我們先查看產生的 Manifest 檔。首先,按兩下 plugin.xml 檔來開啟外掛程式編輯器, 然後選取 plugin.xml 標籤。

<?xml version="1.0" encoding="big5" ?>
<?eclipse version="3.0"?>
<plugin>
	<extension point="org.eclipse.ui.views">
		<category
			name="Hello Category"
			id="com.example.helloworld">
		</category>
		<view
			name="Hello View"
			icon="icons/sample.gif"
			category="com.example.helloworld"
			class="com.example.helloworld.HelloWorldView"
			id="com.example.helloworld.HelloWorldView">
		</view>
	</extension>
</plugin>

在建立外掛程式專案時提供的視圖相關資訊,會用來產生 plugin.xml 檔中定義視圖延伸規格的項目。在延伸定義中,我們定義視圖的種類,包括其名稱ID。接著定義視圖本身(包括其名稱ID),然後使用我們定義給種類的 ID 來建立視圖與種類的關聯性。我們還要指定實作視圖的類別HelloWorldView

如您所見,外掛程式 Manifest 檔會將延伸規格以及執行方式的所有相關資訊,包裝成為一個很簡潔的套件。

PDE 產生的另一個 Manifest 檔是 OSGi Manifest:MANIFEST.MF。這個檔案會建立在外掛程式專案的 META-INF 目錄中,但只要按一下外掛程式編輯器的 MANIFEST.MF 標籤即可檢視。OSGi Manifest 會利用 OSGi 軟體組專有名詞說明套裝外掛程式相關的低階資訊。其包含外掛程式(軟體組)名稱以及其需要的軟體組之類的資訊。