eclipse插件:在快捷方式中弃用了透视图

时间:2015-06-28 21:08:05

标签: java eclipse eclipse-plugin

我想在我的plugin.xml文件中修复最后一个警告,必须引起它,因为我按照一些较旧帖子的教程。警告说:元素透视图已弃用,在以下扩展名中:

<extension
     point="org.eclipse.debug.ui.launchShortcuts">
  <shortcut
        class="my.launch.MyLaunchShortcut"
        icon="icons/my_icon.gif"
        id="my.run.shortcut"
        label="my Workflow"
        modes="run, debug">
     <perspective     <---here is the warning
           id="my.perspective">
     </perspective>
     <configurationType
           id="my.run">
     </configurationType>
     <contextualLaunch>
        <enablement>
           <with
                 variable="selection">
              <count
                    value="1">
              </count>
              <iterate>
                 <or>
                    <instanceof
                          value="org.eclipse.core.resources.IProject">
                    </instanceof>
                 </or>
              </iterate>
           </with>
        </enablement>
     </contextualLaunch>
  </shortcut>

我尝试删除透视元素并在<test>中添加<contextualLaunch>,但我的所有尝试都没有成功。那我怎么解决呢?

顺便说一句。它工作正常。我可以在Run as - &gt;中看到我自己的上下文子菜单。运行我的项目。但只要我删除了<perspective>元素,无论我在<contextualLaunch>中添加了什么,子菜单都不会出现。

1 个答案:

答案 0 :(得分:1)

只有选择了一个项目时,<contextualLaunch>元素才会显示快捷方式。以下内容将显示任何资源:

 <contextualLaunch>
    <enablement>
       <with
             variable="selection">
          <count
                value="1">
          </count>
          <iterate>
             <or>
                <instanceof
                      value="org.eclipse.core.resources.IResource">
                </instanceof>
             </or>
          </iterate>
       </with>
    </enablement>
 </contextualLaunch>

您可能还需要指定<contextLabel> - 以下是Ant插件使用的条目:

<contextualLaunch>
   <enablement>
     <with variable="selection">
       <count value="1"/>
       <iterate>
         <or>
           <instanceof value="org.eclipse.ant.internal.ui.model.AntElementNode"/>
           <test property="org.eclipse.debug.ui.matchesContentType" value="org.eclipse.ant.core.antBuildFile"/>
         </or>
       </iterate>
     </with>
   </enablement>
   <contextLabel
          mode="run"
          label="%AntLaunchShortcut.label"/>
   <contextLabel
          mode="debug"
          label="%AntLaunchShortcut.label"/>
</contextualLaunch>
相关问题