zoukankan      html  css  js  c++  java
  • RCP:为指定的导航器添加上下文菜单

    可以参考Eclipse的Help->Help Content下的:

    Platform Plug-in Developer Guide > Programmer's Guide > Plugging into the workbench > Basic workbench extension points using actions
     
    为了给Project Explorer的上下文菜单的new子菜单中添加一个新项目,我们使用到了org.eclipse.ui.popupMenus扩展点。
     
    定义如下:
    <extension
             point="org.eclipse.ui.popupMenus">
          <viewerContribution
                id="org.eclipse.ui.navigator.ProjectExplorer"
                targetID="org.eclipse.ui.navigator.ProjectExplorer#PopupMenu">
             <action
                   class="editor.test.TestAction"
                   definitionId="editor.test.TestAction"
                   id="editor.test.action1"
                   label="myLabel"
                   menubarPath="common.new.menu/additions"
                   overrideActionId="galaxy.ide.application.test.action1">
             </action>
          </viewerContribution>
       </extension>

    需要注意的项目有:

    1、viewerContribution,指定需要添加上下文菜单内容的视图id以及菜单id,这两个id可以在对应导航器上按下shift+alt+F1来获取,如图所示:

    2、action下的menubarPath,指定要添加的位置,这个位置我们可以通过快捷键shift+alt+F2来获取,如图所示:

    additions表示“附加”,即是action会出现在指定path的子菜单里。

    以上就实现了要求的效果。

    如下图所示:

  • 相关阅读:
    linux使用命令记录
    (转)如何连接远程桌面
    PLSQL将查询结果复制为insert语句
    用foxPro打开dbf文件
    (转)PLSQL新手使用教程
    CPN TOOL使用
    运行mongoDB
    PLSQL连接数据库
    剑指 Offer 10- II. 青蛙跳台阶问题(简单)
    剑指 Offer 10- I. 斐波那契数列(简单)
  • 原文地址:https://www.cnblogs.com/anrainie/p/3592278.html
Copyright © 2011-2022 走看看