0

I accidentally removed the entire end of lines of all the XML and JAVA files present in my project (more than 1200 files), causing them to convert the entire line back to one line.

So I was looking for a tool to reformat all those files.

For XML files: Adds end of lines, the indentation is TAB (NOT 4 spaces), keeping the spacing type of value in the XML tag.

ForJava files: Adds end of lines, the indentation is TAB (NOT 4 spaces), keeping the structure of the file intact.

Tool: Support working many files at the same time, including files in subfolder.

I would be grateful for your reply if it helped me right now.

Thanks.

7
  • Every IDE should have a code formatter – Thomas Weller Apr 29 at 18:39
  • Lesson learned: use a version control system like Git and you could undo all the changes. – Thomas Weller Apr 29 at 18:50
  • @ThomasWeller I use Eclipse, no code formatter. The project source code of the work, I am not allowed to make it public! – Tần Quảng Apr 29 at 19:48
  • Before we have a misunderstanding: I don't want you to make any source code public. You can use Git locally on your machine only. It's free. Nobody would even notice that you are using a version control system. Really do some investigation of what a version control system does for you. It's a backup and much more than that. It's made by developers for developers and optimized to track changes in text files like source code or XML. 100% suitable for you, trust me. – Thomas Weller Apr 29 at 20:19
  • That said, be sure to have a backup before messing around with the code even more. Eclipse has a built-in code formatter. I haven't use Eclipse for quite a while, but try this: right click the project in the package explorer and choose "Source/Format" from the context menu. This should format all Java files according to the source conventions set in the options. – Thomas Weller Apr 29 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.