private static final String DATABASE_CREATE = "create table " + TABLE_TOGO + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_TITLE + " text not null, " + COLUMN_DESCRIPTION + " text not null" + ");";變成
private static final String DATABASE_CREATE = "create table " + TABLE_TOGO + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_TITLE + " text not null, " + COLUMN_DESCRIPTION + " text not null" + ");";真是糟糕透了!!!相信這個狀況大家都曾遇過,在下小弟我就提供一下解決方法囉!
開啟 Formatter
Window --> Preferences --> Java --> Code Style --> Formatter
然後將 Enable Off/On tags 的選項勾起來,並且修改 Profile name 後,按下 OK 就可以了!
使用方式
使用方式很簡單,將程式碼的前後,分別用 @formatter:off 與 @formatter:on 的註解包起來就可以了,如下:
// @formatter:off private static final String DATABASE_CREATE = "create table " + TABLE_TOGO + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_TITLE + " text not null, " + COLUMN_DESCRIPTION + " text not null" + ");"; // @formatter:on
如此一來,就算使用自動整理,也不會被自作聰明的 Formatter 弄亂囉!
沒有留言:
張貼留言