Skip to content

fpirola/java-formatter-eclipse-mars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-formatter-eclipse-mars

Java formatter for eclipse mars (version 4.5). This formatter is also tested for eclipse Juno (version 3.8.1) and could be imported into IntelliJ IDEA.

In short the Java formatter:

  • indent 4 spaces
  • use space instead of the tab character
  • split every row @ 80 characters per line
  • format the Javadoc
  • don't format comment
  • try to be compliance with the Java and Google conventions
  • pass verify of checkstyle
  • possible to turn off/on Java formatter with the following strings:
    • //CHECKSTYLE:OFF
    • //CHECKSTYLE:ON

In "test-project" directory you can find a test project in order to verify the Java formatter.


Instructions:

  1. Clone git repository or download the Java formatter

  2. Start eclipse

  3. Click on Window --> Preferences

  4. Search "formatter" in filter text input bar and then select Java --> Code Style --> Formatter

  5. Click on "Import..." button and select the Java formatter, previously downloaded

  6. Verify that "Java and Google Conventions - pirola.org" is the Active profile and click on "Apply"

  7. Click and "OK"

That's all!!!

You can format your code in different ways:

  • All classes

    1. Click with the right mouse button on src/main/java, if you use maven, or on root project an select "Source" --> "Format"
  • Single class

    1. Select all your Java code class - Shortcut: Right Ctrl + A

    2. Format the code - Shortcut: Right Ctrl + Right Shift + F

Happy coding ;)

About

Java formatter for eclipse mars

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages