Eclipse plugin menu item is not visible

谁说我不能喝 提交于 2019-12-20 05:59:07

问题


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?

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>

回答1:


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.



来源:https://stackoverflow.com/questions/9524270/eclipse-plugin-menu-item-is-not-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!