如何使用“org.eclipse.debug.ui.launchShortcuts”? [英] How do I use "org.eclipse.debug.ui.launchShortcuts"?

查看:686
本文介绍了如何使用“org.eclipse.debug.ui.launchShortcuts”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中编写了一个自定义启动程序,我可以通过工具栏上的运行方式和调试为菜单选项进行访问。我也希望能够通过包浏览器启动,并通过右键点击要启动的文件的编辑器。我按照教程这里添加快捷方式,但没有任何反应,它不会输入我的处理代码,也不会抱怨扩展点的配置。



这是一个我的 plugin.xml的代码片段

 < extension point =org.eclipse.debug.ui.launchShortcuts> 
<捷径
id =org.mylauncher.launchCalcShortcut
class =org.mylauncher.LaunchCalcShortcut
description =执行计算
icon =图标/ launch_16_16.png
label =Calculate
modes =run,debug>
< configurationType id =org.mylauncher.launchCalc/>
< / shortcut>



我也玩过删除(可选)图标属性,并单独验证图标的路径。



我已经修改了这个配置了几个小时,没有很好的结果,这是不可能的调试,因为它不是在我自己的代码中运行。



谢谢。

解决方案

似乎这个问题的正确答案是指定上下文启动快捷方式。这是我的工作配置:

 < extension 
point =org.eclipse.debug.ui.launchShortcuts >

<捷径
class =com.xxxx.CalcLaunchShortcut
icon =calc.png
id =com.xxxx.CalcLaunchShortcut
label =Calc
modes =run,debug>
< contextualLaunch>
< contextLabel mode =runlabel =运行计算器/>
< contextLabel mode =debuglabel =Debug Calculator/>
< enablement>
< with variable =selection>
< count value =1/>
< iterate>
< adapt type =org.eclipse.core.resources.IResource>
<和>
< test property =org.eclipse.core.resources.namevalue =*。calc/>
< /和>
< / adapt>
< / iterate>
< / with>
< / enablement>
< / contextualLaunch>
< / shortcut>


I have written a custom launcher in Eclipse which I can access via the "Run As" and "Debug As" menu options on the toolbar. I also want to be able to launch via the package explorer and via right clicking on the editor of a file to be launched. I followed the tutorial here to add the shortcut but nothing happens, it does not enter my handling code, nor does it complain regarding the configuration of the extension point.

Here is a snippet from my plugin.xml

<extension point="org.eclipse.debug.ui.launchShortcuts">
  <shortcut
        id     = "org.mylauncher.launchCalcShortcut"
        class  = "org.mylauncher.LaunchCalcShortcut"
        description="Execute calculations"
        icon="icons/launch_16_16.png"
        label="Calculate"
        modes="run, debug" >
        <configurationType id="org.mylauncher.launchCalc"/>
  </shortcut>

I have also played with removing the (optional) icon attribute, and have separately validated the path of the icon.

I've been modifying this configuration for hours now with no good result and it is impossible to debug as it is not running in my own code at all.

Thanks.

解决方案

It seems that the correct answer to this problem is to specify a contextual launch shortcut. Here is my working configuration:

   <extension
     point="org.eclipse.debug.ui.launchShortcuts">

  <shortcut
        class="com.xxxx.CalcLaunchShortcut"
        icon="calc.png"
        id="com.xxxx.CalcLaunchShortcut"
        label="Calc"
        modes="run, debug">
    <contextualLaunch>
         <contextLabel mode="run" label="Run Calculator" />
         <contextLabel mode="debug" label="Debug Calculator" />
         <enablement >
           <with variable="selection">
           <count value="1"/>
          <iterate>
            <adapt type="org.eclipse.core.resources.IResource">
                <and>
                <test property="org.eclipse.core.resources.name" value="*.calc"/>
            </and>
        </adapt>
          </iterate>
           </with>
       </enablement>
     </contextualLaunch>
  </shortcut>

这篇关于如何使用“org.eclipse.debug.ui.launchShortcuts”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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