1、在工具栏上找到window,
点击 window->preference,然后在打开的界面中选择 General->Editors->Text Editors,
再选中右侧的Insert space for tabs

2、再点击 window->preference。
依次选择 java->code style ->formatter,点击New,新建一个Profile,并命名,名称随意,我这里给的是tab4。
然后点击OK,接着点击Edit。

3、这里将Tab policy选中为Spaces only。自动弹出Indentation size。此时点击右下角的Apply,保存即可。

本文详细介绍了如何在Eclipse中将Tab键设置为插入4个空格的方法,包括在General设置中更改Text Editors的Insert space for tabs选项,以及在Java Code Style Formatter中创建新的Profile并设置Tab policy为Spaces only。
359

被折叠的 条评论
为什么被折叠?



