org.eclipse.ui.actionSets擴充點(zz自javaeye hoodman的部落格)

來源:互聯網
上載者:User

用於添加菜單、功能表項目、工具列按鈕。包含menu和action元素。

menu元素的label若為中文,添加捷徑為"檔案(&F)"括弧內位快速鍵;path為菜單添加的位置(從根目錄開始插入菜單的位置,若省略,則預設將菜單加入additions命名組;
action元素相當於功能表項目,label為功能表項目名"(建立(&N)";menuPath指定功能表列中該操作的位置,以'/'定界路徑,如help/helpEnd,在help菜單的最後位置添加action,若省略了該選項,此操作將不會出現在功能表列。toolbarPath指定工具列中此操作的位置,以以'/'定界路徑,第一個標記表示工具列標識(Normal表示是預設的工具列),第二個標記為工具列內的命名組,若不存在改組,則會建立。省略該選項,action將不會出現在工具列。style控制功能表的樣式,有radio(帶點),toggle(帶鉤),push(普通)pulldown,初始狀態由state選項指定。

1建立獨立菜單的功能表項目:
  <menu
               path="additions">
               id="menu1"
            <separator
                  name="separator1">
            </separator>
            <separator
                  name="separator2">
            </separator>
    </menu>

 <action
               label="建立(&amp;N)"
               menubarPath="menu1/seperator1"
               toolbarPath="save.group"
  </action>

2建立獨立菜單的二級菜單

  <menu
               path="additions">
               id="menu1"
            <separator
                  name="separator1">
            </separator>
            <separator
                  name="separator2">
            </separator>
    </menu>
  <menu
               path="menu1/additions">
               id="menu2"
            <separator
                  name="separator1">
            </separator>
            <separator
                  name="separator2">
            </separator>
    </menu>
 <action
               label="建立(&amp;N)"
               menubarPath="menu1/menu2/seperator1"
               toolbarPath="save.group"
  </action>
3建立現有工作台菜單的功能表項目及二級功能表項目同上,只是將路徑設定為現有的菜單。標準工作台提供的菜單插入點有file,edit,navigate,project,window,help。每個菜單內部的每個功能表項目都是插入點,以file菜單為例,包含的插入點有:FileStart,New,Close,CloseAll,Save等等。

4工具列上的位置由工具列標識符(org.eclipse.ui.workbench.file,org.eclipse.ui.workbench.navigate,org.eclipse.ui.workbench.launchActionSet/Normal)和工具列群組識別碼(new.group,save.group,pin.group)組成,如org.eclipse.ui.workbench.file/new.group在建立按鈕前添加工具,最常用的設定為Normal/additions

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.