Project Explore已复制(重复)Package Explorer的弹出菜单项

时间:2015-08-31 10:03:38

标签: eclipse eclipse-rcp

我是eclipse中扩展创建的新手。我正在尝试将相同的上下文菜单添加到Project Explorer和Package Explorer。

XXX_label是菜单,XXX,YYY和ZZZ是命令。

对于Link中描述的项目资源管理器,我添加了项目浏览器和包资源管理器的条目。

的plugin.xml

<plugin>     
<extension
     point="org.eclipse.ui.menus">
  <menuContribution
        allPopups="false"
        locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?after=additions">
     <menu
           id="XXX_Project"
           label="XXX_label">
     </menu>
  </menuContribution>
  <menuContribution
        allPopups="false"
        locationURI="popup:XXX_Project?after=additions">
     <command
           commandId="demoeeeeeeeemenu.XXX"
           id="XXX"
           label="XXX"
           style="push">
        <visibleWhen>
           <with
                 variable="activeMenuSelection">
              <iterate
                    ifEmpty="true"
                    operator="or">
                 //Only option to get the Project instance in core expression is adapt type!!
                 <adapt
                       type="org.eclipse.core.internal.resources.Project">
                 </adapt>
              </iterate>
           </with>
        </visibleWhen>
     </command>
     <command
           commandId="demoeeeeeeeemenu.YYY"
           label="YYY"
           style="push">
     </command>
     <command
           commandId="demoeeeeeeeemenu.ZZZ"
           label="ZZZ"
           style="push">
     </command>
  </menuContribution>
  <menuContribution
        allPopups="false"
        locationURI="popup:popup:org.eclipse.jdt.ui.PackageExplorer#PopupMenu?after=additions">
     <menu
           id="XXX_package"
           label="XXX_label">
     </menu>
  </menuContribution>
  <menuContribution
        allPopups="false"
        locationURI="popup:XXX_package?after=additions">
     <command
           commandId="demoeeeeeeeemenu.XXX"
           label="XXX"
           style="push">
     </command>
     <command
           commandId="demoeeeeeeeemenu.YYY"
           label="YYY"
           style="push">
     </command>
     <command
           commandId="demoeeeeeeeemenu.ZZZ"
           label="ZZZ"
           style="push">
     </command>
  </menuContribution>
</extension>
<extension
     point="org.eclipse.ui.commands">
  <command
        id="demoeeeeeeeemenu.XXX"
        name="XXX">
  </command>
  <command
        id="demoeeeeeeeemenu.YYY"
        name="YYY">
  </command>
  <command
        id="demoeeeeeeeemenu.ZZZ"
        name="ZZZ">
  </command>
</extension>
</plugin>

如何消除package explorer完成的额外输入? 任何帮助都得到了赞赏。

编辑: 我认为最好使用locationURI =“popup:org.eclipse.ui.popup.any?after = additions”作为单个弹出条目,它将在包浏览器,Project Explorer和Navigator中添加菜单条目。

1 个答案:

答案 0 :(得分:1)

package explorer的位置URI是:snsClient.unsubscribe("sunbscription-arn");