wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse - include default header 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 "Eclipse - include default header" Watch "Eclipse - include default header" New topic
Author

Eclipse - include default header

Arijit Ghosh
Ranch Hand

Joined: Feb 01, 2002
Posts: 174
Hi,

How can I format my java files to include the copyright header for all files at the click of a button ?

Regards,
Arijit
Ben Poole
Ranch Hand

Joined: Jul 17, 2003
Posts: 33
Why not set up your template code headers in Eclipse?

Window / Preferences

Then, under "Java" select "Code Style" followed by "Code Templates" -- simply set up your "New Java files" template accordingly.
Arijit Ghosh
Ranch Hand

Joined: Feb 01, 2002
Posts: 174
right.. I did that.. I selected create new file... but it did not add any headers...

Also, what if the files already exust ? Say 50 files.. and I want Eclipse check and add if its not present...

Regards,
Arijit
Ben Poole
Ranch Hand

Joined: Jul 17, 2003
Posts: 33
OK, well once you've set up your template, when you create a new class that will get the headers you define. That works for sure.

As for retrospectively updating your source code, I reckon you need a code formatter of some sort, i.e. something more than plain ole' Eclipse. In fact, sounds like a task for Jalopy to me (Jalopy has an Eclipse plug-in too).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Eclipse - include default header