我一直在研究如何创建自己的Eclipse编辑器模板或自定义代码模板以满足我的需要,但无济于事。
这是我的要求:
我需要这种脚本。
${class} ${classname:newName(class)} = new ${class}();
${classname}.toString();
所以当我尝试使用这个时。我只需在代码的${class}
部分输入“MyClass”即可自动生成以下代码
MyClass myClass = new MyClass();
myClass.toString();
但只是使用该脚本。当我输入类名“MyClass”
时,无法自动生成“myClass”所以,例如,我将
MyClass classname = new MyClass();
classname.toString();
我找到了这些资源,但它对我没有帮助。任何人都可以指出我正确的方向,因为我似乎找不到解决这个问题的方法。
Can you define your own template variables in Eclipse
Is there a Eclipse template variable for short version of enclosing type name
或者,有没有办法创建我自己的Eclipse“Generate Getters and Setters ..”,
这可以实现我右键点击任何eclipse源文件 - >来源 - > “生成Getters和Setters”
答案 0 :(得分:0)
这是迄今为止我发现的最好的:https://marketplace.eclipse.org/content/fast-code-eclipse-plugin
它完全符合我的要求,但缺乏润色和文档。我也让它崩溃了,我需要重新安装它。
但到目前为止,它仍然是我发现的最好的。