问题描述
我有一个旧的Eclipse项目,并且代码格式不正确。我想根据Eclipse中的设置来格式化所有 .java
文件。我不想使用 + + 编辑每个文件。有没有一种格式化我所有文件的方法?
I have an old Eclipse project and the code is not well formatted. I'd like to format all the .java
files according to the settings in Eclipse. I don't want to edit every individual file with ++. Is there a way to format all my files? Perhaps an Eclipse plugin?
推荐答案
右键单击项目根目录,然后选择Source-> Format。这应该至少适用于3.8.1版本。
Right click on the project root and select Source -> Format. This should work for at least version 3.8.1. and above.
如果上述方法不起作用,则可能是您使用了较旧的Eclipse版本。在这种情况下,您可以在按住CTRL键的同时单击源文件夹来选择它们,然后从右键菜单中选择源->格式。如果您不想格式化整个项目,也可以使用程序包文件夹和类文件。
If the above does not work, you're probably using an older Eclipse-version. In such case you can select your Source Folders by clicking on them while holding down CTRL, then select Source -> Format from the right-click -menu. Works with package-folders and class files also, in case you don't want to format the entire project.
这篇关于如何一次格式化Eclipse项目中的所有Java文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!