Custom command for Eclipse on current file

不想你离开。 提交于 2019-11-30 06:38:11

问题


I would like to enhance Eclipse so that when I press a custom key combo--say Ctrl + Shift + E--then it will run a command on the current file (if my current buffer is foo.c then it will run `mycommand foo.c' in foo.c's directory).


回答1:


Open the External Tools Configuration dialog from the Run menu. Create a new configuration with the following settings.

Location: c:\mycommand.exe (alter to your needs)

Working directory: ${container_loc}

Arguments: ${resource_loc}

Under Prefrences->General->Keys you can setup a shortcut for "Run last launched external tool".

This should solve your problem.




回答2:


Also, make sure that your "resource" (foo.c) is selected. It happened to me that when testing the external tool and horizontally scrolling the output pane, the resource gets deselected. When you run the external tool again after probably having made changes to its configuration, Eclipse will pop up an error box about "empty variable" (e.g. ${resource_loc} ).



来源:https://stackoverflow.com/questions/369983/custom-command-for-eclipse-on-current-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!