popup:org.eclipse.jdt.ui.PackageExplorer不可见 [英] popup:org.eclipse.jdt.ui.PackageExplorer not visible

查看:118
本文介绍了popup:org.eclipse.jdt.ui.PackageExplorer不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经遵循了我在几个论坛上发现的所有可能的解决方案(也是这样: Eclipse插件菜单项不可见)。但是,他们都没有解决我的问题。我也遵循本教程 http://www.vogella.com/tutorials/EclipsePlugIn /article.html 。无论如何,标签没有显示在菜单中。这是我的plugin.xml:

I've followed all the possible solutions that I found on several forum (also this: Eclipse plugin menu item is not visible). But, all of them didn't resolve my problem. I've also followed this tutorial http://www.vogella.com/tutorials/EclipsePlugIn/article.html. Anyway the label didn't show in the menu. This is my plugin.xml:

<extension
     point="org.eclipse.ui.commands">
  <command
        defaultHandler="pr.handlers.SampleHandler3"
        id="pr.commands.rightclick"
        name="Analyze">
  </command>
.....

 <menuContribution
        locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
     <command
           commandId="pr.commands.rightclick"
           label="Analyze"
           style="push">

           <visibleWhen>
  <with variable="activeMenuSelection">
     <iterate
            ifEmpty="false">
        <adapt type="org.eclipse.core.resources.IFile">
           <test property="org.eclipse.core.resources.name" value="*java" />
        </adapt>
     </iterate>
  </with>
   </visibleWhen>
         </command>
      </menuContribution>


推荐答案

似乎对于Java包中的Package Explorer没有为 org.eclipse.core.resources.IFile 定义适配器,但是有一个适用于 org.eclipse.core的适配器。资源.IResource 所以更改你的适应到那个应该工作。

It seems that for Java files in the packages section of the Package Explorer there is no adapter defined for org.eclipse.core.resources.IFile, there is however an adapter for org.eclipse.core.resources.IResource so changing your adapt to that should work.

由于匹配 IResource 也会匹配文件夹,您的测试将更好地检查内容类型ID:

Since matching IResource will also match folders your test would be better checking the content type id:

   <adapt type="org.eclipse.core.resources.IResource">
      <test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.jdt.core.javaSource" />
   </adapt>

这篇关于popup:org.eclipse.jdt.ui.PackageExplorer不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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