zoukankan      html  css  js  c++  java
  • RCP学习:增加菜单项

    1、增加菜单项,需要扩展org.eclipse.ui.actionSets,该扩展点的说明如下:

    This extension point is used to add menus, menu items and toolbar buttons to the common areas in the Workbench window. These contributions are collectively known as an action set and appear within the Workbench window by the user customizing a perspective.

    本扩展点是用来在工作台窗口的“常用区域”中添加菜单、菜单项以及工具条按钮。这些增加的项被称为“action set”,他们会出现在用户定义的工作台窗口位置。

    2、actionSets下创建actionSet,设置actionSet的ID。

    3、actionSet下创建menu,menu的id需要唯一,label为展示的字符串。menu下可以创建separate和groupMaker

    4、actionSet下创建action,注意action的menubarPath决定了该action在menu中的位置,action的toolbarPath决定该action在toolbar中位置(格式:menu_id/separator_name)。

    5、创建子菜单,和创建menu的流程一致,但子菜单的path应该为父菜单_id/separate_name。需要添加到子菜单的action的path属性则不需要写父菜单的separate。

        <extension
    point="org.eclipse.ui.actionSets">
    <actionSet
    label="tool"
    visible
    ="true"
    id
    ="com.anrainie.ide.workbench.actionSet">
    <menu
    id="toolmenu"
    label
    ="%Tool.title"
    >
    <separator
    name="slot1">
    </separator>
    <separator
    name="slot2">
    </separator>
    </menu>

    <menu
    id="exportdoc"
    label
    ="%Tool.exportDocumentTool"
    path
    ="toolmenu/slot1">
    <separator
    name="slot3">
    </separator>
    </menu>
    <action
    class="com.anrainie.ide.workbench.actions.ExportTrdAction"
    icon
    ="icons/trd.gif"
    id
    ="com.anrainie.ide.workbench.actions.ExportTrdAction"
    label
    ="%Tool.exportDocumentTool.Trd"
    menubarPath
    ="toolmenu/exportdoc/slot3"
    tooltip
    ="%Tool.exportDocumentTool.Trd">
    </action>
    <action
    class="com.anrainie.ide.workbench.actions.ExportTwfAction"
    icon
    ="icons/twf.gif"
    id
    ="com.anrainie.ide.workbench.actions.ExportTwfAction"
    label
    ="%Tool.exportDocumentTool.Twf"
    menubarPath
    ="toolmenu/exportdoc/slot3"
    tooltip
    ="%Tool.exportDocumentTool.Trd">
    </action>
    <action
    class="com.anrainie.ide.workbench.actions.ExportBcdAction"
    icon
    ="icons/bcd.gif"
    id
    ="com.anrainie.ide.workbench.actions.ExportBcdAction"
    label
    ="%Tool.exportDocumentTool.Bcd"
    menubarPath
    ="toolmenu/exportdoc/slot3"
    style
    ="push"
    tooltip
    ="%Tool.exportDocumentTool.Bcd">
    </action>
    <action
    class="com.anrainie.ide.workbench.actions.ExportTcdAction"
    icon
    ="icons/tcd.gif"
    id
    ="com.anrainie.ide.workbench.actions.ExportTcdAction"
    label
    ="%Tool.exportDocumentTool.Tcd"
    menubarPath
    ="toolmenu/exportdoc/slot3"
    style
    ="push"
    tooltip
    ="%Tool.exportDocumentTool.Bcd">
    </action>

    </actionSet>

    这是一份相对完整的,包含多级菜单的actionSet。



  • 相关阅读:
    可能是全网最详细的express--middleware
    带你学Node系列之express-CRUD
    简单聊聊ES6-Promise和Async
    Node学习图文教程之express重写留言本案例
    Node.js学习(第四章:初见express)
    彻底弄懂ES6中的Map和Set
    全网最easy的better-scroll实现上拉加载和下拉刷新
    Node中require第三方模块的规则
    canvas实现酷炫气泡效果
    Node.js实现用户评论社区(体验前后端开发的乐趣)
  • 原文地址:https://www.cnblogs.com/anrainie/p/2383867.html
Copyright © 2011-2022 走看看