posts - 36, comments - 30, trackbacks - 0, articles - 3
          擴(kuò)展點(diǎn):
          org.eclipse.ui.menus(確定菜單創(chuàng)建的區(qū)域)
          org.eclipse.ui.commands
          org.eclipse.ui.handlers(command的具體行為)
          org.eclipse.ui.commandImages(comand的圖片)

          擴(kuò)展點(diǎn)org.eclipse.ui.menus用來(lái)對(duì)菜單進(jìn)行擴(kuò)展,可以對(duì)主菜單,工具欄,上下文菜單進(jìn)行擴(kuò)展。

          示例代碼如下:
          <extension
                   
          point="org.eclipse.ui.menus">
                
          <menuContribution
                      
          allPopups="false"
                      locationURI
          ="menu:org.eclipse.ui.main.menu?after=additions">
                   
          <command
                         
          commandId="com.xxxx.test.command1"
                         style
          ="push">
                   
          </command>
                
          </menuContribution>
          </extension>

          其中l(wèi)ocationURI屬性指定菜單擴(kuò)展的位置,上述代碼是對(duì)主菜單進(jìn)行擴(kuò)展,如果要對(duì)工具欄和上下文菜單進(jìn)行擴(kuò)展,書寫格式如下:

          toolbar:org.eclipse.ui.main.toolbar?after=additions
          popup:org.eclipse.ui.popup.any?after=additions(上下文菜單在任何位置出現(xiàn))
          popup:org.eclipse.ui.views.ProblemView?after=additions(上下文菜單在問(wèn)題視圖中出現(xiàn))

          commandId屬性指定該menu對(duì)應(yīng)的command,一個(gè)menu可以對(duì)應(yīng)多個(gè)command。

          command可以通過(guò)擴(kuò)展點(diǎn)org.eclipse.ui.commands擴(kuò)展,示例代碼如下:

          <extension
                   
          point="org.eclipse.ui.commands">
          <category
                      
          id="com.xxxx.test.category1"
                      name
          ="MenuTest">
                
          </category>

                
          <command
          categoryId="="com.xxxx.test.category1"
                      id
          ="com.xxxx.test.command1"
                      name
          ="CommandA">
                
          </command>
           
          </extension>

          至于Command具體要做什么,需要通過(guò)擴(kuò)展點(diǎn)org.eclipse.ui.handlers來(lái)指定,示例代碼如下:

          <extension
                   
          point="org.eclipse.ui.handlers">
                
          <handler
                      
          class="com.xxxx.test.SampleHandler"
                      commandId
          ="com.xxxx.test.command1">
                
          </handler>
           
          </extension>

          還有擴(kuò)展點(diǎn)org.eclipse.ui.commandImages,可以指定Command對(duì)應(yīng)的圖標(biāo)。

           <extension
                   
          point="org.eclipse.ui.commandImages">
                
          <image
                      
          commandId="com.xxxx.test.command1"
                      icon
          ="icons/sample.gif">
                
          </image>
            
          </extension>

          主站蜘蛛池模板: 大关县| 九龙城区| 勃利县| 凌云县| 德兴市| 辽阳县| 疏勒县| 新晃| 泊头市| 伊金霍洛旗| 资中县| 伊吾县| 乃东县| 德保县| 延长县| 蓝田县| 古蔺县| 镇雄县| 广昌县| 北安市| 海原县| 汝南县| 沁源县| 望谟县| 乐平市| 墨竹工卡县| 永济市| 鹿邑县| 玉田县| 郴州市| 景泰县| 邵东县| 轮台县| 河津市| 芦溪县| 周宁县| 胶州市| 崇义县| 于都县| 石狮市| 淮南市|