天生我才

          常用鏈接

          統計

          最新評論

          RCP2

          2RCP入門

          1)實現RCP 應用程序的步驟

          l         標識擴展點

          l         定義plugin清單文件

          l         實現擴展

          l         定義透視圖

          l         定義WorkbenchAdvisor

          l         定義Application

          l         導出應用程序

          2)創建項目

          l         File > New > Plug-in Project

          l         輸入項目名Google,保留其它默認值,點擊Next

          l         Class Name 域中鍵入com.xqtu.google.GooglePlugin

          l         點擊Finish完成項目創建

          3)理解插件清單

          l         Eclipse生成項目時,會生成很多有關文件,其中最重要的是插件清單文件plugin.xml

          l         plugin.xml位于項目的根目錄,負責定義Eclipse運行環境用來管理的資源、依存關系和擴展

          l         Eclipse提供插件清單編輯器,其底部的每個標簽頁提供了訪問和操作plugin.xml特定部分的簡便方法

          l         其中plugin.xml頁顯示plugin.xml的源文件,向導最初生成的插件清單的內容如下

          <?xml version="1.0" encoding="UTF-8"?>
          <?eclipse version="3.0"?>
          <plugin
             id="Google"
             name="Google Plug-in"
             version="1.0.0"
             provider-name="nelson_tu"
             class="com.xqtu.google.GooglePlugin">
           
             <runtime>
                <library name="Google.jar">
                   <export name="*"/>
                </library>
             </runtime>
           
             <requires>
                <import plugin="org.eclipse.ui"/>
                <import plugin="org.eclipse.core.runtime"/>
             </requires>
           
          </plugin>

          l         <plugin> 標記描述插件的基本內容,有下列 5 個屬性:

          l         id :插件惟一標識符;為了減少命名沖突,應該從插件作者的 Internet 域名得出該屬性,其命名約定和 Java 命名約定是一致的,如類的package

          l         name:插件一般名稱

          l         version —— 插件版本,格式是major.minor.service

          l         provider-name:插件作者

          l         class ——插件類全路徑;盡管定義了插件類,但 RCP 應用程序在執行時并不使用該類

          l         <plugin>部分可以在Overview頁的Genernal Information部分進行設置

          l         <runtime>標記定義了插件需要的運行庫;使用 <library> 標記列出每個運行庫;<export>標記指定是導出整個庫(使用*),還是其下具體的package(用多個<export>標記列出)

          l         <runtime>部分可以在Runtime頁中進行設置

          l         <requires>標記定義對其它插件的依存關系;使用<import>標記列出每個插件

          l         <requires>部分可以在Dependencies頁中進行設置

          4)理解擴展

          l         Eclipse 平臺使用相對較小的運行環境內核和它精致的插件體系結構提供高度可擴展性

          l         通過使用插件將新的功能添加到運行環境內核

          l         每個插件都可以包含任何數目使用擴展點集成的擴展

          l         同樣,插件也可以定義自己的一組擴展點,以便其他開發人員可以在自己的插件或 RCP 應用程序中使用

          l         在本例中,我們要定義兩個擴展

          <?xml version="1.0" encoding="UTF-8"?>
          <?eclipse version="3.0"?>
          <plugin
             id="Google"
             name="Google Plug-in"
             version="1.0.0"
             provider-name="nelson_tu"
             class="com.xqtu.google.GooglePlugin">
           
             <runtime>
                <library name="Google.jar">
                   <export name="*"/>
                </library>
             </runtime>
           
             <requires>
                <import plugin="org.eclipse.ui"/>
                <import plugin="org.eclipse.core.runtime"/>
             </requires>
           
             <extension
                   id="GoogleApplication"
                   point="org.eclipse.core.runtime.applications">
                <application>
                   <run class="com.xqtu.google.GoogleApplication"/>
                </application>
             </extension>
             
             <extension
                   point="org.eclipse.ui.perspectives">
                <perspective
                      class="com.xqtu.google.GooglePerspective"
                      name="Google"
                      id="com.xqtu.google.GooglePerspective"/>
             </extension>
           
          </plugin>

          l         通過org.eclipse.core.runtime.applications定義第一個擴展,這為 RCP 應用程序聲明入口點;id屬性標識該應用程序

          l         <run>標記指定RCP 應用程序啟動類的全路徑

          l         通過org.eclipse.ui.perspectives定義第二個擴展,這為 RCP定義一個添加到通用工作臺的透視圖

          l         <perspective>標記定義了透視圖類全路徑(class屬性)、透視圖名稱(name屬性)和唯一標識(id屬性)

          l         <extension>部分可以在Extensions頁中進行設置 



          Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=79306

          posted on 2006-02-06 16:55 天生我才 閱讀(188) 評論(0)  編輯  收藏 所屬分類: RCP/RIA


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 大同县| 澄城县| 且末县| 南开区| 楚雄市| 莎车县| 新营市| 高青县| 金溪县| 建瓯市| 宁乡县| 屯昌县| 四川省| 保康县| 新余市| 上栗县| 新河县| 北辰区| 封开县| 富阳市| 江城| 博兴县| 清水河县| 孟村| 田林县| 广宗县| 南昌市| 黄平县| 庄河市| 陆丰市| 耿马| 依兰县| 瑞昌市| 榕江县| 沁源县| 方山县| 遵化市| 汾西县| 麦盖提县| 淮安市| 灵寿县|