質問

i use jalopy (the free version) to do my code-formatting, but i would like to convert to eclipse. There are two jalopy features, though, i like very much, is it possible to have them in eclipse?

First is the ability to create sections like this:

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() {
}

The second feature is that is automatically add the final keyword to argument lists.

役に立ちましたか?

解決

At least it is possible to enable auto inserting final keyword using as follows:

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

It will lead you to Variable Declarations -> Use final where possible

And to perform such operation if while saving a file:

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

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

Same as before.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top