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的子菜单里。

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

    如下图所示:

  • 相关阅读:
    常用字段类型
    触发事件中的sender
    $符号基本用法$() ${} $(())
    expect语法
    apt 和 apt-get的区别
    python字符串中 r'', b'', u'', f'' 的含义
    linux正则表达式
    Linux下apt-get命令详解(安装、卸载、更新、查询软件包)
    创建linux service服务
    Ubuntu下deb包的解包、打包
  • 原文地址:https://www.cnblogs.com/anrainie/p/3592278.html
Copyright © 2011-2022 走看看