简体   繁体   中英

Eclipse shortcut to format a method call

Is there any shortcut in Eclipse IDE (Indigo here) to convert from this statement

myObject.callMethod(param1, "param2", param3);

into this ? :

myObject.callMethod(
   param1, 
   "param2", 
   param3
);

Ctrl-Shift-F is default combination, you can change one via Window -> Preferences -> General -> Keys. Check setting at Java -> Code Style also.

在窗口->首选项-> Java->代码样式->代码模板中更新代码模板

Ctrl+Shift+F

You can see the setting for the formatting under Window->Preferences->Java->Code style->Formatter

You can use Ctrl+Shift+F to format the code.

However in case you want any specific formatting type like spaces instead of tabs then you need to incorporate code formatter from Project > Properties > Java Code Style > Formatter. It allows you to define a formatting scheme, export in XML and can be imported on any other machine as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM