Question

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>
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top