The name of this is "Code Template", to create a go in Window → Prefences → Java → Editor → Templates, to arrive at the following screen:
Click"New" to create your template code. As an example, I created a template to automate the creation of an attribute and a method to make a Singleton class.
Followthecodeifyouwanttocopy:
privatestatic${primary_type_name}instancia;publicstatic${primary_type_name}getInstancia(){if(instancia==null)instancia=new${primary_type_name}();returninstancia;}
Nowinanewlycreatedclass,enterthenameofthetemplatepressCtrl+Space:
ThenconfirmwithEnter,yourclasswilllooklikethis:
Notethatyoucanincreaseyourtemplatepowerverymuchifyouusevariables,suchasintheabovecaseIused${primary_type_name}
,whichreplacesthepartofthecodewiththeclassname.Byclickingon"Insert Variable" you will have an extensive list of variables that you can use.