Hello World Manifest

在執行新視圖之前,讓我們先查看產生的 Manifest 檔︰

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
   id="com.example.helloworld"
   name="Helloworld Plug-in"
   version="1.0.0"
   provider-name="EXAMPLE"
   class="com.example.helloworld.HelloworldPlugin">

   <runtime>
      <library name="helloworld.jar">
         <export name="*"/>
      </library>
   </runtime>

      <requires>
 <import plugin="org.eclipse.ui"/>
      <import plugin="org.eclipse.core.runtime"/>
 <import plugin="org.eclipse.core.runtime.compatibility"/>
   </requires>

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

當我們建立外掛程式專案時所提供有關視圖的資訊會用來產生 Manifest 檔,內含定義視圖延伸的適當標記。在延伸定義中,我們定義視圖的種類,包括其名稱ID。接著定義視圖本身(包括其名稱ID),然後使用我們定義給種類的 ID 來建立視圖與種類的關聯性。我們還要指定實作視圖的類別HelloWorldView

如您所見,Manifest 檔將我們的延伸及如何執行的所有相關資訊包裝成為一個很簡潔的套件。

法律注意事項