简体   繁体   English

Eclipse类模板

[英]Eclipse class template

I want each class of a given package in Eclipse to be filled with: 我希望在Eclipse中给定包的每个类都被填充:

import java.io.*;
import java.util.*;

public class MainJWSPLIN {
    public static void main(String[] args){
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    }
}

...I mean when I create a new class I want it to have those contents already. ...我的意思是,当我创建一个新类时,我希望它已经具有这些内容。

One option you have is to do it with Editor Templates . 您必须选择的一种方法是使用编辑器模板 But in this case you will have to manually type the short alias (eg, buffreader) to insert this text. 但是在这种情况下,您将必须手动键入短别名(例如buffreader)以插入此文本。

编辑器模板

The other option is to use Code Templates which is more related to your question as you can associate them to action such as creating a new class by the New Class wizards to generate code. 另一个选择是使用与您的问题更相关的代码模板 ,因为您可以将它们与操作关联,例如通过“新建类”向导创建新类以生成代码。

代码模板

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM