The name of this is "Code Template", to create a go in Windows Prefences Java Editor Templates, to get to 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 class a Singleton.
Follow the code if you want to copy:
private static ${primary_type_name} instancia;
public static ${primary_type_name} getInstancia() {
if (instancia == null) instancia = new ${primary_type_name}();
return instancia;
}
Now in a newly created class, type the template name Ctrl + Space:
Then confirm with the Enter, your class will look like this:
Note that you can greatly increase your template power if you use variables, as for example in the above case I used the ${primary_type_name}
, that replaces the code part with the class name. By clicking "Insert Variable" you will have an extensive list of variables you can use.
has yes, see this link: http://www.devmedia.com.br/criando-shortcuts-no-eclipse/2150
– Pedro Laini
It’s almost what I wanted Peter, is there any way I can create my own commands? The ones available in Keys help, but for example, I thought of typing "functionOm" and Ctrl+Space and he would type the text for me corresponding to the function I want. I imagined that this is how it happened with "sysout", it just typed a text that corresponds to the function I want. So I could modify this text and make my own. But your link left me on the right track, thank you!
– Filipi Maciel