【问题标题】:Eclipse Advanced code templateEclipse 高级代码模板
【发布时间】:2014-10-16 19:57:57
【问题描述】:

我一直在研究如何创建自己的 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();

我找到了这些资源,但对我没有帮助。谁能指出我正确的方向,因为我似乎无法找到解决这个问题的方法。

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcodestyle%2Fref-preferences-code-templates.htm

Can you define your own template variables in Eclipse

Is there a Eclipse template variable for short version of enclosing type name

或者,有没有办法创建我自己的 Eclipse 的“生成 Getters 和 Setters..”,

这可以通过我右键单击任何 Eclipse 源 file -> Source -> "Generate Getters and Setters" 来实现

【问题讨论】:

    标签: java eclipse templates editor customization


    【解决方案1】:

    这是迄今为止我发现的最好的:https://marketplace.eclipse.org/content/fast-code-eclipse-plugin

    它完全符合我的要求,但缺少润色和文档。我也让它崩溃到我需要重新安装它的地步。

    但它仍然是迄今为止我发现的最好的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-31
      • 1970-01-01
      • 1970-01-01
      • 2016-06-17
      • 2011-02-06
      • 2012-02-13
      相关资源
      最近更新 更多