Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom command for Eclipse on current file

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).

like image 977
Nathan Avatar asked Dec 15 '08 22:12

Nathan


2 Answers

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.

like image 166
Stefan Teitge Avatar answered Oct 11 '22 15:10

Stefan Teitge


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} ).

like image 44
Günter Avatar answered Oct 11 '22 15:10

Günter