首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Eclipse代码格式化:有没有办法添加“剖面线”?

Eclipse代码格式化:有没有办法添加“剖面线”?
EN

Stack Overflow用户
提问于 2011-12-11 21:54:31
回答 1查看 210关注 0票数 1

我使用jalopy (免费版本)进行代码格式化,但我想转换为eclipse。虽然有两个jalopy特性,但是我非常喜欢,它们可以在eclipse中使用吗?

首先是创建像这样的部分的能力:

代码语言:javascript
复制
public final class Credit extends ArticleAccountingentry implements Serializable {

//~ Enumerations ---------------------------------------------------------------------------------------------------

public enum Status {CREATED, CANCELLED;
}

//~ Static fields/initializers -------------------------------------------------------------------------------------

private static final long serialVersionUID = 1L;

//~ Instance fields ------------------------------------------------------------------------------------------------

private final Invoice invoice;
private final ImmutableSet<StatusChange<Status>> statushistory;

//~ Constructors ---------------------------------------------------------------------------------------------------

public Credit() {
}

//~ Methods --------------------------------------------------------------------------------------------------------

public StatusChange<Status> getLatestStatusChange() {
}

第二个功能是自动将最后一个关键字添加到参数列表中。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-11 22:13:49

至少可以使用如下方式启用自动插入final关键字:

Window -> Preference -> Java -> Code Style -> Clean Up -> Edit -> Code Style

它会把你带到Variable Declarations -> Use final where possible

并在保存文件时执行这样的操作:

Window -> Preference -> Java -> Editor -> Save Action -> Edit

启用Perform the selected on save -> Additional Actions -> Configure -> Code Style

和以前一样。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8464464

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档