Use template in eclipse myeclipse

Source: Internet
Author: User

1. Set Alt +/
There is one of the most basic things in the widely circulated version on the Internet that I haven't said, that is, ALT +/. What should I do if the template cannot be inserted?
The reason is that the commands pointed to by eclipse or myeclipse Alt +/are not correct. The following is a detailed description:
Choose toolbar> WINDOW> preferences> General> keys. For example:

The modification is correct:

Myeclipse6.5 or above:

Click Remove binding to reset binding
2. Create a static template
The following is an entry-level template. Other complicated templates can be found everywhere on the Internet. The entry-level templates are the most basic:
Create a template named strconstant to insert the code public final static string at the cursor.
Choose toolbar> WINDOW> preferences> JAVA> editor> templates. For example:

I have already created this template as follows:

What is the role of automatically insert in? You can try it yourself. If you select this option, the corresponding template code will automatically Insert the cursor position when the template is applied. If you do not select this option, the following will appear:

3. Application Template
In many places on the internet, enter the Template Name in the appropriate place, and then Alt +/after the Template Name /. In fact, the template is a replacement of code, where do you want to put it. This is the case where automatically insert is not selected.

The result is:

Note: you cannot select strconstant and then Alt +/. In this way, the template will not be called !!
For example:

4. Create a template with parameters.
This is amazing! As described earlier, the Template Name Is sqlconstant.

The template is applied as follows:


Note that the color of name is amazing. After you click the 1st name, you can enter a value to change the word "name", just like inputting a parameter, the remaining two names will change, for example, I change "name" to "test ",

~ End ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.