views:

70

answers:

1

Is there any way to have a template (Java -> Editor -> Templates) in Eclipse that generate something like this

debug("methodName arg1=" + arg1 + " arg2=" + arg2 + " arg3=" + arg3);

When used in a method. For instance:

public void setImage(long rowId, long contactId, String thinggy) {
   // invoking the template here, produces this:
   debug("setImage rowId=" + rowId + " contactId=" + contactId + " thinggy=" + thinggy);
}

I couldn't find a way to do that with the standard template UI, maybe there exists a plugin to do this kinds of things?

+4  A: 

This is a start:

debug("${enclosing_method_arguments}: ", ${enclosing_method_arguments});

which produces the following:

debug("arg1, arg2, arg3: ", arg1, arg2, arg3);

I haven't found a way to separate out each argument. I found this page that ran into the same problem.

For other Eclipse template stuff, look at this question.

Kelly French