Eclipse插件菜单项不可见 [英] Eclipse plugin menu item is not visible

查看:193
本文介绍了Eclipse插件菜单项不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试添加一个菜单项来打包资源管理器的右键菜单。但是当我运行我的插件时,我的菜单项不可见。我没有错过?

I tried to add a menu item to package explorer's right click menu. But my menu item is not visible when i run my plugin. what am i missing?

这是我的plugin.xml:

here is my plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
         <command
               commandId="kodsayici.counter"
               label="Count"
               style="push">
            <visibleWhen
                  checkEnabled="false">
               <with
                     variable="menuSelection">
                  <iterate
                        ifEmpty="false"
                        operator="or">
                     <adapt
                           type="org.eclipse.jdt.core.ICompilationUnit">
                     </adapt>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="kodsayici.Counter"
            id="kodsayici.counter"
            name="Count">
      </command>
   </extension>

</plugin>


推荐答案

我解决了我的问题。 menuSelection 是一个错误的变量名。这些变量名是预定义的( Command_Core_Expressions )。如果将menuSelection更改为 activeMenuSelection ,我的插件可以工作。

I solved my problem. menuSelection is a wrong variable name. These variable names are predefined (Command_Core_Expressions). If change menuSelection to activeMenuSelection, my plugin works.

这篇关于Eclipse插件菜单项不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆