Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding license to new files when using Eclipse and the Copyright wizard plugin

I've just installed this Copyright wizard plugin for managing copyright disclaimers in my Eclipse projects. I discovered it thanks to this post.

I set it up and all works fine:

  1. I created my own copyright header
  2. I used the wizard to apply it to all files of an existing project

Now I have the following problem:

When I create a new file inside the project, the copyright isn't added by default. How can I solve this?

like image 865
Heisenbug Avatar asked Sep 03 '11 16:09

Heisenbug


1 Answers

It sounds like you're looking for Eclipse's Code Templates feature. In the version of Eclipse I have handy, it's found through Preferences -> Java -> Code Style -> Code Templates.

I have a feeling that you will be most interested in either the New Java files (found under Code) or Files (found under Comments) template.

There is corresponding functionality for XML files under Preferences -> XML -> XML Files -> Editor -> Templates (look at the xml declaration template), and for Ant files under Preferences -> Ant -> Editor -> Templates (Buildfile template). I am willing to bet that there are similar templates for pretty much every other language Eclipse can be used with.

like image 123
user Avatar answered Oct 01 '22 05:10

user