如何使用“org.eclipse.debug.ui.launchShortcuts”?

Chr*_*ris 5 eclipse-pde eclipse-plugin

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

这是我的一个片段 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>
Run Code Online (Sandbox Code Playgroud)

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

我已经修改了这个配置几个小时了,但没有很好的结果,并且无法调试,因为它根本没有在我自己的代码中运行。

谢谢。

Chr*_*ris 5

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

   <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>
Run Code Online (Sandbox Code Playgroud)