Eclipse – 如何将键shourtcut命令分配给启动types(运行types)

在属性 – >常规 – >键的Eclipse IDE中
用户可以为大多数命令分配键绑定。

我想将Ctrl + R绑定到(例如)Run As – > Node应用程序,但是在列表中找不到它(有Run Java Application,使用Alt + Shift + X运行Maven Build ,一些键绑定)

如果需要启动types不在列表中,如何在插件项目源中configuration它?

(是的,我可以用Ctrl + F11重新启动,但左手不方便,不会启动当前编辑器)

更新: 如何在eclipse中映射一个键来运行项目运行configuration? build议Alt + R,S,1太长。

更新2:

所有相关的build议有点不同的解决scheme:

  • Eclipse Maven构build和testing一个button
  • eclipse:在特定的启动configuration上放置键盘快捷键
  • 如何在Eclipse中将特定键绑定到不同的启动configuration?

什么plugin.xml应该有该用户可以分配密钥绑定?

尝试使用实际macros选项

只需从eclipse更新站点安装即可

http://puremvcnotificationviewer.googlecode.com/svn/trunk/PracticallyMacroGoogleUpdateSite

安装并重新启动eclipse之后。 转到Windows – >首选项 – >实际macros选项 – >编辑器macrosDefenitions

点击“新build”,在“可用命令”中select“编辑器macros脚本(Beanshell)”,然后点击“添加”

使用以下脚本

 import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.ui.DebugUITools; try { // Terminate process if it already exists from a previous launch org.eclipse.debug.core.ILaunch[] allLaunches=DebugPlugin.getDefault().getLaunchManager().getLaunches(); for (ILaunch l : allLaunches) { if (l.getLaunchConfiguration().getName().equals("YOUR CONFIG NAME")) { console.write("terminating launch: " ); console.writeln(l.getLaunchConfiguration().getName()); l.terminate(); break; } } org.eclipse.debug.core.ILaunchConfiguration[] allConfigurations=DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); for (ILaunchConfiguration config : allConfigurations) { if (config.getName().equals("YOUR CONFIG NAME")) { DebugUITools.launch(config, "debug"); break; } } } catch (CoreException e) { e.printStackTrace(); } finally{} 

笔记:

  1. 用你想要的任何东西replace你的configuration名称
  2. DebugUITools.launch可以更改为运行或debugging
  3. 在“macros信息”部分中指定一个macros名称
  4. 分配一个以1开头的标识符。如果你想在标准的Eclipse键绑定对话框中看到这个macros

现在点击“确定”

转到Windows – >首选项 – >常规 – >键

select您的macros名称,并将其分配给您想要的任何键。

最后别忘了重新启动你的eclipse!

获得更多帮助:

http://sourceforge.net/p/practicalmacro/discussion/878739/thread/891ddd13