This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Source Code formatting

 
ganesh roti
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"javad freakr", please see your private messages for an important administrative matter.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic