Thoughts about software development

Eclipse tip: context-dependent launches

This feature has probably been in Eclipse for a while but I only recently
discovered it, and I’ve found it quite useful already: Eclipse lets you
define launch configurations that depend on the current selection.

Consider the simple following program that prints out the parameter passed on
the command line:

5 Comments

Hi Cedric,
Earlier today, “discovered” that my code templates include the enclosing_method variable. We’re adding logging to our code and having a template that can use variables is cool.
But I wish that Eclipse has the macro capability of Visual Studio/Emacs that would make life more easier.
BR,
~A

At some point I’ve used “current project location” variable to share external tools config for Ant xdoclet target between several projects.
Anjan, it is not quite macros, but also could be quite powerful. http://eclipseexeditor.sourceforge.net/
Hey, Cedric, do you fancy to add support of the groovy/baeanshell/javascript into this plugin?

Cedric, I took your challenge and played around with some of the other variables. Here are some I really liked…
The ${file_prompt} variable is really neat, because you can then write a simple command line program that expects a fully qualified filename of some input file to process as the first argument. Use ${file_prompt} when you run it, and bingo, up pops a nice GUI dialog to let you select the file. When you click OK on the dialog, off your program goes with the fully qualified filename as args[0].
The ${folder_prompt} variable works the same way, but brings up a folder selection dialog.
${string_prompt} is even more generic, in that it brings up a plain vanilla dialog and lets you enter any text you want into it. If you enter “a b c” into the dialog then hit the OK, you will get args[0]=a, args[1]=b, etc. If you want args[0] to return the entire string, just enclose ${string_prompt} in quotes.