Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse - include default header

 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic