Author - StudySection Post Views - 48 views

Custom Code Templates – Eclipse

How to create custom code templates in Eclipse editor?


We can create our own custom code templates and assign a short name to use it. This can be helpful for us as a developer to code fast if we need to use any particular block of code repeatedly in our application.


This can be done using any programming language. But here I am giving an example to create a new code template for an empty class using PHP.
Following are the steps:

  1. Go to Window->preferences->PHP->Editor->Templates and Click New button.
  2. Write the structure of your custom template as shown below:


  3. Give a particular name to use this template, I have used the keyword “class” in the Name section to use this template.
  4. We can use the Insert Variable button to use different variables like I have inserted the variable “cursor” to specify the position of the cursor.
  5. Now, we can use this class templates in our application code by just typing the keyword “class”. When we type this keyword, the editor will show us the related templates matching the keywords we are typing, as shown below:


  6. So we can select the required template and it will be used in just a single click. See the result shown below:


jQuery allows the user to create powerful and dynamic webpages that run without any hiccup. With StudySection, you have the liberty to choose among beginner or expert level jQuery certification exams to help you excel in this career field.

Leave a Reply

Your email address will not be published. Required fields are marked *