Header for every program in eclipse
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ashwin_kumar
Posted On:   Monday, January 15, 2007 01:46 PM

Hi,
How do i add header for every source file/file created in

eclipse which consists of author,date,email

In netbeans i cud find template manager where we

can edit the header....

In eclipse is there any way to go about it ??

If yes does it work for plugins for python,Ruby apart

from java





Thanks,

Ashwin

(Stay Hungry Stay Foolish)

Re: Header for every program in eclipse

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, January 15, 2007 05:23 PM

yes it's there in the preferences. I know where it is under WSAD 5.1.1 (Eclipse 2.1) but I'm not sure if it's exactly the same under eclipse 3.X......



just browse around in there, you should find a place for defining/changing the new file template (which should work for non-Java files too?), another for the new Java class template, still more for the new java method template, etc. etc. (new constructor template, new getter/setter template, new implemented method from an interface, new overridden method, etc.) all sorts of places you can customize the auto-generation of java code and/or comments.



There are even more things you can customize for fields in comments (e.g. "@author" expanding out to your preferred way of giving your own name/email address), and you can even add your own completely new code generation templates (I once added an "ourJdbcTryCatchFinally", which inserted a whole block of boilerplate code, opening a 'try', getting a connection, preparedstatement, resultset, doing our error log thing in the 'catch', and closing them all in the 'finally'), if I type "ourJ" and control-space for completion etc.).


Presumably your python, ruby etc. plugins, if they are well-behaved Eclipse plugins, should add their own preference options to the overall ones, so you should find them there too.



Also you can import and export these preferences/templates to various xml files, from the preferences pages where you define/edit them. I get like 3 or 4 different xml files, when I export from all the places that have 'export/import' buttons, e.g. my various collected customizations and templates, in old WSAD/Eclipse 2.1. I'm sure it's even spiffier now, in Eclipse 3.2.X or whatever...
About | Sitemap | Contact