Reputation: 572
Is there a possibility to prevent line wrapping for the some special cases in the Eclipse code style fromatter? I mean in particular the javafx property definition blocks. By default the code style are next:
private StringProperty name = new SimpleStringProperty();
public StringProperty nameProperty() {
return name;
}
public String getName() {
return name.get();
}
public void setName(String value) {
this.name.set(value);
}
I attempts provide more compact style without line wrapping:
private StringProperty name = new SimpleStringProperty();
public StringProperty nameProperty() { return name; }
public String getName() { return name.get(); }
public void setName(String value) { this.name.set(value); }
Upvotes: 3
Views: 88
Reputation: 3874
Yes, it is possible to prevent line wrapping. Like @Pshemo said, you can toggle the eclipse formatter. So your above code becomes:
// @formatter:off
private StringProperty name = new SimpleStringProperty();
public StringProperty nameProperty() { return name; }
public String getName() { return name.get(); }
public void setName(String value) { this.name.set(value); }
// @formatter:on
The comments turn the formatter off then on again to prevent the formatter from changing that code when you press ctrl + shift + f
.
Upvotes: 2