且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Eclipse中显示方法名称和参数值的模板

更新时间:2023-11-29 22:15:34

我做了一个小插件,添加了很好的格式化变量: / p>

http:// code。 google.com/p/eclipse-log-param/



Eclipse不提供有关参数类型的任何信息,因此没有Arrays.toString(.. 。)


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?

I've made small plugin that adds nicely formatted variable:

http://code.google.com/p/eclipse-log-param/

Eclipse doesnt provide any information about parameter type, so there is no Arrays.toString(...)