To help in everyday writing of code I've made more than few code templates. You can import them all by going to Window->Preferences->Java->Editor->Templates and import this xml file:
- for eclipse 3.4.M2 and later use this: t5_eclipse_code_templates3.xml
(I use ${:import ...} to add proper imports along with templates)
- for eclipse before 3.4 M2 use: t5_eclipse_code_templates_before_E3.4.M2.xml
To use them just type t5 and press CTRL+SPACE
I took some time to make them usable (they add imports automatically). They are named by numbers so it is easier to access a group of templates, and then by reading description selecting desired one.
For more info on code in these templates:
Page lifecycle methods and render phase methods are both named by convention and marked with the according annotation. So for example if you choose t5page1 (PageLoaded) you'll get:
/**Tapestry page lifecycle method. Called when the page is instantiated and added to the page pool. * Initialize components, and resources that are not request specific.*/ @PageLoaded public void pageLoaded() { }
you can either remove the annotation or rename method to something meaningfull. !Notice: org.apache.tapestry.annotations.PageLoaded will be added to imports automaticaly.
The mentioned template looks like this:
/**Tapestry page lifecycle method. Called when the page is instantiated and added to the page pool. * Initialize components, and resources that are not request specific.*/ @PageLoaded public void pageLoaded(){ ${cursor} } ${:import(org.apache.tapestry.annotations.PageLoaded)}
After you import the templates, you can modify them to suit your needs.
here are screenshots to see it in action
t5 - all templates t5_code_tpl_screen_all.jpg
t5f - form event templates (for more info click here)
t5i - inject templates
t5p - page lifecycle templates. (for more info click here)
t5r - render phase method templates. (for more info click here)