2 little623 little623 于 2014.08.05 13:50 提问

开发eclipse插件遇到一个问题

我在开发一款eclipse插件,需要在package explorer、project explorer、navigator视图的右键菜单中添加一个菜单项,遇到一个问题是在package explorer和navigator视图中菜单项能显示出来并正常使用,但是在project explorer视图里却显示不出来。请问各位大神是什么原因?
action类的定义:

   public class DfbdExportFileAction extends Action implements IViewActionDelegate, IActionDelegate, IWorkbenchWindowActionDelegate

plugin.xml中扩展点定义:

    <!-- contexts -->
<extension
    point="org.eclipse.ui.popupMenus">
    <viewerContribution
        id="com.dfbd.exportfiles.contextmenu.PackageExplorer"
        targetID="org.eclipse.jdt.ui.PackageExplorer">
        <menu
            id="org.eclipse.jdt.ui.PackageExplorer.DfbdExportFile"
            label="aa">
        </menu>
        <action
            icon="icons/icon-1.png"
            label="DFBD Export Files"
            name="DFBD Export Files"
            menubarPath="org.eclipse.jdt.ui.PackageExplorer.DfbdExportFile"
            class="com.dfbd.exportfiles.contextmenu.DfbdExportFileAction"
            id="com.dfbd.exportfiles.contextmenu.DfbdExportFileAction.PackageExplorer"
            enablesFor="+">
        </action>
    </viewerContribution>
    <viewerContribution
        id="com.dfbd.exportfiles.contextmenu.ProjectExplorer"
        targetID="org.eclipse.ui.navigator.ProjectExplorer">
        <menu
            id="org.eclipse.ui.navigator.ProjectExplorer.DfbdExportFile"
            label="bb">
        </menu>
        <action
            icon="icons/icon-1.png"
            label="DFBD Export Files"
            name="DFBD Export Files"
            menubarPath="org.eclipse.ui.navigator.ProjectExplorer.DfbdExportFile"
            class="com.dfbd.exportfiles.contextmenu.DfbdExportFileAction"
            id="com.dfbd.exportfiles.contextmenu.DfbdExportFileAction.ProjectExplorer">
        </action>
    </viewerContribution>
    <!-- 这个也能正确显示 -->
    <viewerContribution
        id="com.dfbd.exportfiles.contextmenu.ResourceNavigator"
        targetID="org.eclipse.ui.views.ResourceNavigator">
        <menu
            id="org.eclipse.ui.views.ResourceNavigator.DfbdExportFile"
            label="cc">
        </menu>
        <action
            icon="icons/icon-1.png"
            label="DFBD Export Files"
            name="DFBD Export Files"
            menubarPath="org.eclipse.ui.views.ResourceNavigator.DfbdExportFile"
            class="com.dfbd.exportfiles.contextmenu.DfbdExportFileAction"
            id="com.dfbd.exportfiles.contextmenu.DfbdExportFileAction.ResourceNavigator"
            enablesFor="+">
        </action>
    </viewerContribution>
</extension>

1个回答

u011486648
u011486648   2014.08.05 17:04

路径问题,看看改成绝对路径试试

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!