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:

(I use ${:import ...} to add proper imports along with templates)

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: * Form Events, * Page Life Cycle, * Page Rendering

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:

   1     /**Tapestry page lifecycle method. Called when the page is instantiated and added to the page pool.
   2      * Initialize components, and resources that are not request specific.*/
   3     @PageLoaded
   4     public void pageLoaded() {
   5         
   6     }

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:

   1 /**Tapestry page lifecycle method. Called when the page is instantiated and added to the page pool.
   2  * Initialize components, and resources that are not request specific.*/
   3 @PageLoaded public void pageLoaded(){
   4         ${cursor}
   5 }
   6 ${: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 click here

t5f - form event templates (for more info click here)
t5_code_tpl_screen_form.jpg

t5i - inject templates
t5_code_tpl_screen_inject.jpg

t5p - page lifecycle templates. (for more info click here)
t5_code_tpl_screen_page.jpg

t5r - render phase method templates. (for more info click here)
t5_code_tpl_screen_render.jpg

Tapestry5HowToEclipseCodeTemplates (last edited 2011-01-18 11:13:53 by BobHarner)