我在eclipse中写了这段代码
protected void createTables(SQLiteDatabase db) {
db.execSQL(
"create table " + CUSTOMERS_TABLE +" (" +
CustomerId + " text primary key," +
FirstName + " text," +
MiddleName + " text," +
LastName + " text," +
Portrait + " BLOB," +
Gender + " integer," +
Age + " integer," +
Passed + " integer"+
");"
但是当我使用source->格式化我的代码时,eclipse使它们像这样
protected void createTables(SQLiteDatabase db) {
db.execSQL("create table " + CUSTOMERS_TABLE + " (" + CustomerId
+ " text primary key," + FirstName + " text," + MiddleName
+ " text," + LastName + " text," + Portrait + " BLOB," + Gender
+ " integer," + Age + " integer,"
+ Passed
+ " integer" +");"
我希望eclipse格式化程序保留我的代码。我应该设置哪些设置?
答案 0 :(得分:4)
将您不希望eclipse的行包含在// @formatter:off
和// @formatter:on
之间重新格式化:
protected void createTables(SQLiteDatabase db) {
// @formatter:off
db.execSQL(
"create table " + CUSTOMERS_TABLE +" (" +
CustomerId + " text primary key," +
FirstName + " text," +
MiddleName + " text," +
LastName + " text," +
Portrait + " BLOB," +
Gender + " integer," +
Age + " integer," +
Passed + " integer"+
");"
// @formatter:on