File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Tidy Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Tidy Code" Watch "Tidy Code" New topic
Author

Tidy Code

Joe Cummins
Greenhorn

Joined: Mar 11, 2008
Posts: 3
Hi everyone.
I�m looking for a tool a little like HTML Tidy that indents and separates your code to the standard. I know it�s lazy but when you�re dipping in and out of code all day it gets a bit tedious. I know eclipse will format your code but it can�t seem to distinguish gaps in methods or between them. Any help would be great appreciated
Regards
Jez
Anubhav Anand
Ranch Hand

Joined: May 18, 2007
Posts: 341

Joe Cummins,
Welcome to JavaRanch.

I know eclipse will format your code but it can�t seem to distinguish gaps in methods or between them.


You can modify the inbuilt formatter of eclipse as per your convenience.

GOTO Window-->Prefrences-->Java-->Editor-->Save Actions
Check the box "Perform selected actions on save".
Now, click on formatter.
On the window click on New and write your custom formatter name anad choose any of the inbuilt formatters to start and say save.

Now, edit your formatter as per will.
Joe Cummins
Greenhorn

Joined: Mar 11, 2008
Posts: 3
Thank you for the welcome Anubhav and for the responce. Is there any kind of standard when it comes to java code or id it per coders prefrence?

Regards
Jez
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Joe Cummins:
...Is there any kind of standard when it comes to java code or id it per coders prefrence? ...

It depends on who you ask.

Sun has documented the following: Code Conventions for the Java Programming Language.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
They ought to update that conventions document; it is dated 1999. Most of it is easy to read, but there are a few bits, like ANSI constants, and "what you would put in a struct if Java had structs" which people posting on this forum can't be expected to understand.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
They actually have made some changes since then - I found an old copy I'd made in 2003 which showed some differences. But I agree, talk of ANSI constants and structs is not so helpful to newer programmers today.


"I'm not back." - Bill Harding, Twister
Joe Cummins
Greenhorn

Joined: Mar 11, 2008
Posts: 3
Cheers guys, most informative.
Regards
Jez
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tidy Code