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

Source Code formatting

ganesh roti
Greenhorn

Joined: May 16, 2010
Posts: 17
Hi,
Some of my team members uses Netbeans and rest others uses Eclipse as an IDE to checkout and check in projects from/to cvs. So there is a problem of having any standard xml to format the code before checking in. Is there any way to format the code irrespective of the IDE's that are using it? Please let me know your thoughts. I mean is there any way that we can use the same formatting template bopth in eclipse and in netbeans
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

"javad freakr", please see your private messages for an important administrative matter.


JBoss In Action
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Jalopy might work. Or just set up each IDE with the same formatting and export the config into the project (I don't know if NetBeans allows export of just the code formatting preferences).
ganesh roti
Greenhorn

Joined: May 16, 2010
Posts: 17
NetBeans allows export/import of fomrats but it is in zip file while eclipse uses import/export in xml. So i guess these ides are not in sync with regard to formatting
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's not the point: you'll never be able to keep them exactly in sync (unless you write a convertor/diff tool that understand both formats). The best you can do is configure them the same and provide both config files. If it's a company-wide thing it shouldn't change much over time anyway.
ganesh roti
Greenhorn

Joined: May 16, 2010
Posts: 17
Thanks. So instead of hooking into net it is better to write own formatter then.
Meanwhile just to update i tried to isntall the Jalopy Netbeans plugin but it does not work correctly in case of NetBeans.
ganesh roti
Greenhorn

Joined: May 16, 2010
Posts: 17
Well as an alternative way can we then format the code itself in the CVS side before it checks in or commit? IS it possible?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Sure, use Jalopy and a commit hook. Or use Jalopy inside either IDE. Or just configure both IDEs the same and live with the rare "Oh I have to update [whichever IDE isn't updated] because we made a slight, rare tweak to our coding standards."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Source Code formatting
 
Similar Threads
Eclipse and format entire codebase/package
Which IDE: netbeans or eclipse?
Any good JSP formatting tools?
Seeking for a JSP/HTML auto alignment tool
How to format code (Eclipse)