org.eclipse.ui.menus擴展點學習

Eclipse菜單:eclipse

menu:help?after=addtions編輯器

menu:navigate?after=open.ext2ide

menu:window?after=newEditor工具

menu:file?after=open.ext佈局

 

org.eclipse.ui.menus屬性ui

  1.  locationURI  ----------  標識用戶界面中與該菜單項關聯的命令將要出現的位置。

locationURI="[scheme]:[identifier]?[argument-list]"spa

locationURI屬性被分解爲三個清晰的部分:模式(scheme)、標識符(identifier)和參數列表(argument list)code

scheme標識添加項將要添加至的UI對象的類型。它能夠是如下值的其中這一:orm

  • menu———程序主菜單或視圖下拉菜單
  • popup———視圖或編輯器的上下文菜單
  • toolbar———程序主工具欄或視圖中的工具欄

identifier定義了將要添加至的菜單、彈出項或工具欄的惟一標識符。一些經常使用的標識符包括:對象

  • org.eclipse.ui.main.menu———Eclipse主菜單的標識符
  • org.eclipse.ui.main.toolbar———Eclipse主工具欄的標識符
  • org.eclipse.ui.popup.any———任意上下文菜單的標識符。

agrument list。參數列表由能夠是"before"或"after"的佈局,一個等號(「=」),以及菜單 、彈出項或工具欄的一些項的標識符組成。標識符也能夠是「additions」,表示元素應當被放置於給定菜單、彈出項或工具欄的默認位置 ("="等號後面能夠接着一個acitonID,這樣子就佈局到這個action的後面,實現分組佈局)

 

實例

   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
         <toolbar
               id="cn.com.agree.ide.afa.navigation.saveToolbar">
            <command
                  commandId="org.eclipse.ui.file.save"
                  icon="icons/save_edit.gif"
                  label="Save"
                  style="push"
                  tooltip="Save">
            </command>
            <command
                  commandId="org.eclipse.ui.file.saveAll"
                  icon="icons/saveall_edit.gif"
                  label="Save All"
                  style="push"
                  tooltip="Save All">
            </command>
         </toolbar>
      </menuContribution>
      <menuContribution
            allPopups="false" locationURI="toolbar:org.eclipse.ui.main.toolbar?after=cn.com.agree.ide.afa.navigation.saveToolbar"> <toolbar id="cn.com.agree.ide.afa.workbench.searchToolbar"> <command commandId="org.eclipse.search.ui.openSearchDialog" icon="icons/search.gif" label="Search" style="pulldown" tooltip="Search"> </command> </toolbar> </menuContribution> <menuContribution allPopups="true" locationURI="menu:org.eclipse.search.ui.openSearchDialog"> <command commandId="org.eclipse.search.ui.openFileSearchPage" icon="icons/search.gif" label="File Search" style="push" tooltip="File Search"> </command> </menuContribution>

 

紅色代碼是較好的org.eclipse.ui.menus應用實例,效果圖以下

 

 

快捷鍵

M1--------Ctrl

M2--------Shift

M3--------Alt

 

 

org.eclipse.ui.actionSets擴展點

toolbarPath指定工具欄中此操做的位置,以'/'定界路徑,第一個標記表示工具欄標識(Normal表示是缺省的工具欄),第二個標記爲工具欄內的命名組(也能夠是工具欄上的separator,這樣就能實現和org.eclipse.ui.menus整合佈局),若不存在改組,則會建立。省略該選項,action將不會出如今工具欄。

相關文章
相關標籤/搜索