Eclipse插件开发:在eclipse中添加插件后没有出现右键菜单

时间:2016-07-26 13:26:49

标签: java eclipse-plugin eclipse-rcp

我编写了一个Eclipse插件并在eclipse中添加了它。该插件可以正常使用快捷方式,但右键单击该文件后,菜单不会出现。如果我在Runtime-Eclipse中运行这个插件,一切正常。有没有人知道什么是错的?

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.commands">
      <category
            id="testMenu.commands.category"
            name="Sample Category">
      </category>
      <command
            categoryId="testMenu.commands.category"
            id="testMenu.commands.sampleCommand"
            name="Sample Menu">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.handlers">
      <handler
            class="test.plugin.MenuHandler"
            commandId="testMenu.commands.sampleCommand">
      </handler>
   </extension>
   <extension
         point="org.eclipse.ui.bindings">
      <key
            commandId="testMenu.commands.sampleCommand"
            contextId="org.eclipse.ui.contexts.window"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M1+6">
      </key>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
         <menu
               id="testMenu.menus.sampleMenu"
               label="Menu"
               mnemonic="M">
            <command
                  commandId="testMenu.commands.sampleCommand"
                  id="testMenu.menus.sampleCommand"
                  mnemonic="S">
                    <visibleWhen>
                           <with variable="activeMenuSelection">
                            <iterate
                                 ifEmpty="false">
                                  <or>
                             <adapt type="org.eclipse.core.resources.IResource">
                              <or>
                               <test property="org.eclipse.core.resources.name" value="*.java" />
                                 <test property="org.eclipse.core.resources.name" value="*.xml" />
                                 </or>
                             </adapt>
                               </or>
                            </iterate>
                           </with>
                    </visibleWhen>
            </command>
             </menu>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.startup">
      <startup
            class="test.plugin.TaskManager"></startup>
   </extension>
</plugin>

这是我的plugin.xml文件。

提前谢谢。

0 个答案:

没有答案