文件1:check.xml
<project name="checkstyle" default="checkstyle.checkstyle" basedir="../">
<property file="build/build.properties" />
<!-- set global properties for this build -->
<property name="target.dir" value="${basedir}/checkstyle" />
<property name="version" value="6.13" />
<property name="checkstyle.dir" value="src/checkstyle/com/puppycrawl/tools/checkstyle" />
<property name="project" value="sccms" />
<path id="run.classpath">
<pathelement location="${target.dir}/checkstyle-${version}-all.jar" />
</path>
<path id="project.libs.path">
<fileset dir="${libs.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="project.tomcat.path">
<fileset dir="${tomcat.home}/lib">
<include name="*.jar" />
</fileset>
</path>
<target name="checkstyle.checkstyle" description="Runs checkstyle against it's own sources">
<taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask">
<classpath refid="run.classpath" />
</taskdef>
<delete file="${target.dir}/cachefile" />
<property name="checkstyle.pattern.todo" value="NOTHingWillMatCH_-" />
<property name="check.config" location="${target.dir}/chances_checkstyle.xml" />
<checkstyle config="${check.config}" failOnViolation="false" failureProperty="checkstyle.failure.property">
<fileset dir="${publishtask.dir}" includes="**/*.java" />
<fileset dir="${chances.commons.dir}" includes="**/*.java" />
<fileset dir="${chances.webui.dir}" includes="**/*.java" />
<fileset dir="${content.dir}" includes="**/*.java" />
<fileset dir="${template.dir}" includes="**/*.java" />
<fileset dir="${commons.dir}" includes="**/*.java" />
<fileset dir="${biz.dir}" includes="**/*.java" />
<fileset dir="${system.dir}" includes="**/*.java" />
<fileset dir="${entity.dir}" includes="**/*.java" />
<fileset dir="${search.dir}" includes="**/*.java" />
<fileset dir="${collect.dir}" includes="**/*.java" />
<formatter type="plain" />
<formatter type="xml" toFile="${target.dir}/checkstyle_${project}.xml" />
<classpath refid="run.classpath" />
<classpath refid="project.libs.path" />
<classpath refid="project.tomcat.path" />
<property key="checkstyle.cache.file" file="${target.dir}/cachefile" />
<property key="checkstyle.header.file" file="${target.dir}/java.header" />
<property key="checkstyle.regexp.header.file" file="${target.dir}/java_regexp.header" />
<property key="checkstyle.importcontrol.file" file="${target.dir}/import-control.xml" />
<property key="checkstyle.suppressions.file" file="${target.dir}/suppressions.xml" />
</checkstyle>
<xslt in="${target.dir}/checkstyle_${project}.xml" out="${target.dir}/checkstyle_${project}.html" style="${target.dir}/contrib/checkstyle-simple.xsl" />
<fail if="checkstyle.failure.property" message="Checkstyle failed: ${checkstyle.failure.property}" />
</target>
</project>
文件2:checkstyle_sccms.xml
其中一个文件检查结果
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="6.13">
<file name="D:\workspace\sctv_cms4.0\src\core\publishtask\chances\cms\publish\dao\AbstractEpgDaoImpl.java">
<error line="0" severity="warning" message="File does not end with a newline." source="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck"/>
<error line="13" severity="warning" message="Wrong order for 'chances.cms.entity.biz.Album' import." source="com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck"/>
<error line="24" severity="warning" message="First sentence should end with a period." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<error line="36" column="29" severity="warning" message="Variable 'epgDaoFactory' must be private and have accessor methods." source="com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck"/>
<error line="39" column="22" severity="warning" message="Variable 'cmsDao' must be private and have accessor methods." source="com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck"/>
<error line="42" column="26" severity="warning" message="Variable 'previewSqlSession' must be private and have accessor methods." source="com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck"/>
<error line="44" column="26" severity="warning" message="Variable 'releaseSqlSession' must be private and have accessor methods." source="com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck"/>
<error line="46" column="36" severity="warning" message="Variable 'publishableValidator' must be private and have accessor methods." source="com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck"/>
<error line="48" severity="warning" message="First sentence should end with a period." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<error line="56" severity="warning" message="Expected an @return tag." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="56" column="74" severity="warning" message="Expected @param tag for 'task'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="57" column="30" severity="warning" message="Expected @param tag for 'taskItem'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="58" column="32" severity="warning" message="Expected @param tag for 'client'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="60" severity="warning" message="First sentence should end with a period." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<error line="67" severity="warning" message="Expected an @return tag." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="67" column="57" severity="warning" message="Parameter contentCode should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="67" column="64" severity="warning" message="Expected @param tag for 'contentCode'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="68" column="29" severity="warning" message="Variable 'ibatisContexts' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="73" severity="warning" message="First sentence should end with a period." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<error line="81" severity="warning" message="Expected an @return tag." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="81" column="54" severity="warning" message="Parameter task should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="81" column="66" severity="warning" message="Expected @param tag for 'task'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="82" column="21" severity="warning" message="Parameter taskItem should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="82" column="30" severity="warning" message="Expected @param tag for 'taskItem'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="83" column="21" severity="warning" message="Parameter client should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="83" column="32" severity="warning" message="Expected @param tag for 'client'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="87" severity="warning" message="First sentence should end with a period." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<error line="95" severity="warning" message="Expected an @return tag." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="95" column="75" severity="warning" message="Expected @param tag for 'task'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="96" column="30" severity="warning" message="Expected @param tag for 'taskItem'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="97" column="32" severity="warning" message="Expected @param tag for 'client'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="99" severity="warning" message="First sentence should end with a period." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<error line="107" severity="warning" message="Expected an @return tag." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="108" column="21" severity="warning" message="Parameter contentCode should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="108" column="28" severity="warning" message="Expected @param tag for 'contentCode'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="109" column="21" severity="warning" message="Parameter contentType should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="109" column="28" severity="warning" message="Expected @param tag for 'contentType'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="109" column="41" severity="warning" message="Parameter client should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="109" column="52" severity="warning" message="Expected @param tag for 'client'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="110" column="21" severity="warning" message="Parameter publish2Release should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="110" column="29" severity="warning" message="Expected @param tag for 'publish2Release'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="111" column="29" severity="warning" message="Variable 'ibatisContexts' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="116" column="16" severity="warning" message="Variable 'dao' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="117" column="28" severity="warning" message="Variable 'daoImpl' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="118" column="21" severity="warning" message="Variable 'task' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="124" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="124" column="26" severity="warning" message="Parameter client should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="124" column="45" severity="warning" message="Parameter contexts should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="132" column="39" severity="warning" message="The String " object:" appears 2 times in the file." source="com.puppycrawl.tools.checkstyle.checks.coding.MultipleStringLiteralsCheck"/>
<error line="137" severity="warning" message="Line is longer than 80 characters (found 81)." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/>
<error line="150" severity="warning" message="First sentence should end with a period." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<error line="155" column="25" severity="warning" message="Parameter contexts should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="155" column="45" severity="warning" message="Expected @param tag for 'contexts'." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="156" column="28" severity="warning" message="Variable 'result' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="169" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="169" column="31" severity="warning" message="Parameter objType should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="170" column="18" severity="warning" message="Variable 'needPublishs' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="171" severity="warning" message="'array initialization' child have incorrect indentation level 24, expected level should be one of the following: 12, 46, 49." source="com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck"/>
<error line="172" severity="warning" message="'array initialization' child have incorrect indentation level 24, expected level should be one of the following: 12, 46, 49." source="com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck"/>
<error line="173" severity="warning" message="'array initialization' child have incorrect indentation level 24, expected level should be one of the following: 12, 46, 49." source="com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck"/>
<error line="174" severity="warning" message="'array initialization' child have incorrect indentation level 24, expected level should be one of the following: 12, 46, 49." source="com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck"/>
<error line="175" severity="warning" message="'array initialization' child have incorrect indentation level 24, expected level should be one of the following: 12, 46, 49." source="com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck"/>
<error line="175" severity="warning" message="Array should contain trailing comma." source="com.puppycrawl.tools.checkstyle.checks.coding.ArrayTrailingCommaCheck"/>
<error line="179" column="34" severity="warning" message="The String "objType:" appears 2 times in the file." source="com.puppycrawl.tools.checkstyle.checks.coding.MultipleStringLiteralsCheck"/>
<error line="190" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="190" column="5" severity="warning" message="Return count is 8 (max allowed is 3)." source="com.puppycrawl.tools.checkstyle.checks.coding.ReturnCountCheck"/>
<error line="190" column="32" severity="warning" message="Parameter code should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="190" column="45" severity="warning" message="Parameter type should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="198" column="19" severity="warning" message="Variable 'album' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="201" column="21" severity="warning" message="Variable 'channel' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="204" column="22" severity="warning" message="Variable 'schedule' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="207" column="20" severity="warning" message="Variable 'series' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="210" column="21" severity="warning" message="Variable 'subject' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="213" column="21" severity="warning" message="Variable 'pro' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="220" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
<error line="220" column="26" severity="warning" message="Parameter task should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="220" column="44" severity="warning" message="Parameter taskItems should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="221" column="21" severity="warning" message="Parameter client should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="228" column="29" severity="warning" message="Variable 'contexts' should be declared final." source="com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck"/>
<error line="238" severity="warning" message="Line is longer than 80 characters (found 82)." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/>
<error line="247" severity="warning" message="Line is longer than 80 characters (found 83)." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/>
<error line="260" column="27" severity="warning" message="Parameter task should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="260" column="45" severity="warning" message="Parameter taskItems should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="269" column="31" severity="warning" message="Parameter task should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
<error line="269" column="49" severity="warning" message="Parameter taskItems should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
</file>
</checkstyle>
文件3:解析代码
CheckStyleErrorParse.java
package chances.com.cn.dom4j;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import org.apache.commons.digester3.Digester;
import org.xml.sax.SAXException;
import chances.com.cn.dom4j.entity.CheckFile;
import chances.com.cn.dom4j.entity.CheckStyle;
import chances.com.cn.dom4j.entity.FileError;
import com.mysql.jdbc.PreparedStatement;
public class CheckStyleErrorParse {
public static final String TABLE_NAME = "checkstyle_error";
public static final String ID = "id";
public static final String FILENAME = "file_name";
public static final String COLUMN = "ccolumn";
public static final String LINE = "line";
public static final String SEVERITY = "severity";
public static final String MESSAGE = "message";
public static final String SOURCE = "source";
public static final String PROJECT = "project";
public static final String PROJECT_NAME = "sccms";
public static Connection conn = null;
public static Statement stmt = null;
private static final String INSERT_SQL = "insert into " + TABLE_NAME + "("
+ FILENAME + "," + COLUMN + "," + LINE + "," + SEVERITY
+ ","+ MESSAGE + "," + SOURCE + "," + PROJECT
+ ")values(?,?,?,?,?,?,?)";
public static void main(String[] args) throws IOException, SAXException {
Digester digester = new Digester();
String checkstyle = "checkstyle";
String checkFile = checkstyle + "/file";
String Error = checkFile + "/error";
// 设置解析规则
digester.setValidating(false);
digester.addObjectCreate(checkstyle, CheckStyle.class);
digester.addSetProperties(checkstyle);
digester.addObjectCreate(checkFile, CheckFile.class);
digester.addSetProperties(checkFile);
digester.addObjectCreate(Error, FileError.class);
digester.addSetProperties(Error);
digester.addSetNext(Error, "addFileError");
digester.addSetNext(checkFile, "addCheckFile");
try {
// 解析XML文件,并得到ROOT元素
CheckStyle checkStyle = (CheckStyle) digester
.parse(CheckStyleErrorParse.class
.getResourceAsStream("checkstyle_"
+ PROJECT_NAME
+ ".xml"));
System.out.println(" CheckStyle 的版本: " + checkStyle.getVersion());
System.out.println(" 共有多少个文件: "
+ checkStyle.getCheckFileList().size());
System.out.println(" ***************************** ");
Connection conn = getConnection(); // 获取连接
PreparedStatement stm = (PreparedStatement) conn
.prepareStatement(INSERT_SQL);
for (CheckFile checkFile1 : checkStyle.getCheckFileList()) {
System.out.println(" 共有多少个错误: "
+ checkFile1.getFileErrorList().size());
for (FileError CheckStyleError : checkFile1.getFileErrorList()) {
stm.setString(1, checkFile1.getName());
stm.setString(2, CheckStyleError.getColumn());
stm.setString(3, CheckStyleError.getLine());
stm.setString(4, CheckStyleError.getSeverity());
stm.setString(5, CheckStyleError.getMessage());
stm.setString(6, CheckStyleError.getSource());
stm.setString(7, PROJECT_NAME);
stm.addBatch();
}
stm.executeBatch();
}
stm.close(); // 关闭连接
System.out.println("插入数据库已结束");
}
catch (Exception e) {
e.printStackTrace();
}
try {
conn.close();
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static Connection getConnection() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
// 建立到MySQL的连接
conn = DriverManager.getConnection(
"jdbc:mysql://192.168.220.126:3306/qingqian2015",
"user",
"pwd");
}
catch (InstantiationException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
catch (IllegalAccessException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
catch (ClassNotFoundException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return conn;
}
}
实体类CheckStyle.java
package chances.com.cn.dom4j.entity;
import java.util.ArrayList;
import java.util.List;
public class CheckStyle {
private String version;
private List<CheckFile> checkFileList = new ArrayList<CheckFile>();
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public List<CheckFile> getCheckFileList() {
return checkFileList;
}
public void addCheckFile(CheckFile checkFile){
checkFileList.add(checkFile);
}
}
实体类CheckFile.java
package chances.com.cn.dom4j.entity;
import java.util.ArrayList;
import java.util.List;
public class CheckFile {
private String name;
private List<FileError> fileErrorList = new ArrayList<FileError>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<FileError> getFileErrorList() {
return fileErrorList;
}
public void addFileError(FileError fileError) {
fileErrorList.add(fileError);
}
}
实体类FileError.java
package chances.com.cn.dom4j.entity;
public class FileError {
private String line;
private String severity;
private String column;
private String message;
private String source;
public String getLine() {
return line;
}
public void setLine(String line) {
this.line = line;
}
public String getSeverity() {
return severity;
}
public void setSeverity(String severity) {
this.severity = severity;
}
public String getColumn() {
return column;
}
public void setColumn(String column) {
this.column = column;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}
文件:cleanup.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="2">
<profile kind="CleanUpProfile" name="chances" version="2">
<setting id="cleanup.format_source_code" value="true"/>
<setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="false"/>
<setting id="cleanup.remove_unused_private_types" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_generated_serial_version_id" value="true"/>
<setting id="cleanup.make_variable_declarations_final" value="true"/>
<setting id="cleanup.add_missing_methods" value="true"/>
<setting id="cleanup.always_use_this_for_non_static_field_access" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
<setting id="cleanup.correct_indentation" value="false"/>
<setting id="cleanup.never_use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.add_serial_version_id" value="true"/>
<setting id="cleanup.remove_unused_private_methods" value="true"/>
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
<setting id="cleanup.remove_unused_private_members" value="false"/>
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
<setting id="cleanup.always_use_this_for_non_static_method_access" value="true"/>
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
<setting id="cleanup.format_source_code_changes_only" value="false"/>
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_missing_nls_tags" value="false"/>
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="false"/>
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.remove_unused_private_fields" value="true"/>
<setting id="cleanup.make_parameters_final" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces" value="false"/>
<setting id="cleanup.remove_unused_imports" value="true"/>
<setting id="cleanup.organize_imports" value="true"/>
<setting id="cleanup.sort_members" value="true"/>
<setting id="cleanup.remove_private_constructors" value="true"/>
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
<setting id="cleanup.always_use_blocks" value="true"/>
<setting id="cleanup.never_use_blocks" value="false"/>
<setting id="cleanup.always_use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
<setting id="cleanup.remove_unused_local_variables" value="false"/>
<setting id="cleanup.make_private_fields_final" value="true"/>
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
<setting id="cleanup.add_default_serial_version_id" value="false"/>
<setting id="cleanup.sort_members_all" value="false"/>
<setting id="cleanup.use_blocks" value="true"/>
<setting id="cleanup.add_missing_override_annotations" value="true"/>
<setting id="cleanup.make_local_variable_final" value="false"/>
</profile>
<profile kind="CleanUpProfile" name="eclipse-cs sctv_cms4.0" version="2">
<setting id="cleanup.format_source_code" value="false"/>
<setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
<setting id="cleanup.remove_unused_private_types" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
<setting id="cleanup.make_variable_declarations_final" value="false"/>
<setting id="cleanup.add_missing_methods" value="false"/>
<setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
<setting id="cleanup.correct_indentation" value="false"/>
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.add_serial_version_id" value="false"/>
<setting id="cleanup.remove_unused_private_methods" value="true"/>
<setting id="cleanup.use_this_for_non_static_field_access" value="false"/>
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
<setting id="cleanup.remove_unused_private_members" value="false"/>
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
<setting id="cleanup.format_source_code_changes_only" value="false"/>
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_missing_nls_tags" value="false"/>
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
<setting id="cleanup.use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.remove_unused_private_fields" value="true"/>
<setting id="cleanup.make_parameters_final" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces" value="false"/>
<setting id="cleanup.remove_unused_imports" value="true"/>
<setting id="cleanup.organize_imports" value="true"/>
<setting id="cleanup.sort_members" value="false"/>
<setting id="cleanup.remove_private_constructors" value="true"/>
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
<setting id="cleanup.always_use_blocks" value="true"/>
<setting id="cleanup.never_use_blocks" value="false"/>
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.use_this_for_non_static_method_access" value="false"/>
<setting id="cleanup.remove_unused_local_variables" value="false"/>
<setting id="cleanup.make_private_fields_final" value="true"/>
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
<setting id="cleanup.add_default_serial_version_id" value="true"/>
<setting id="cleanup.sort_members_all" value="false"/>
<setting id="cleanup.use_blocks" value="true"/>
<setting id="cleanup.add_missing_override_annotations" value="true"/>
<setting id="cleanup.make_local_variable_final" value="true"/>
</profile>
<profile kind="CleanUpProfile" name="eclipse-cs sctv_epg4.0" version="2">
<setting id="cleanup.format_source_code" value="false"/>
<setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
<setting id="cleanup.remove_unused_private_types" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
<setting id="cleanup.make_variable_declarations_final" value="true"/>
<setting id="cleanup.add_missing_methods" value="false"/>
<setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
<setting id="cleanup.correct_indentation" value="false"/>
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.add_serial_version_id" value="false"/>
<setting id="cleanup.remove_unused_private_methods" value="true"/>
<setting id="cleanup.use_this_for_non_static_field_access" value="false"/>
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
<setting id="cleanup.remove_unused_private_members" value="false"/>
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
<setting id="cleanup.format_source_code_changes_only" value="false"/>
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_missing_nls_tags" value="false"/>
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
<setting id="cleanup.use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.remove_unused_private_fields" value="true"/>
<setting id="cleanup.make_parameters_final" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces" value="false"/>
<setting id="cleanup.remove_unused_imports" value="true"/>
<setting id="cleanup.organize_imports" value="true"/>
<setting id="cleanup.sort_members" value="false"/>
<setting id="cleanup.remove_private_constructors" value="true"/>
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
<setting id="cleanup.always_use_blocks" value="true"/>
<setting id="cleanup.never_use_blocks" value="false"/>
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.use_this_for_non_static_method_access" value="false"/>
<setting id="cleanup.remove_unused_local_variables" value="false"/>
<setting id="cleanup.make_private_fields_final" value="true"/>
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
<setting id="cleanup.add_default_serial_version_id" value="true"/>
<setting id="cleanup.sort_members_all" value="false"/>
<setting id="cleanup.use_blocks" value="true"/>
<setting id="cleanup.add_missing_override_annotations" value="true"/>
<setting id="cleanup.make_local_variable_final" value="true"/>
</profile>
</profiles>
文件:codeTemplates.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
* @return the ${bare_field_name}
*/</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
*/</template><template autoinsert="false" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
* Creates a new instance of ${enclosing_type}.
*
* ${tags}
*/
</template><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
* Project Name:${project_name}
* File Name:${file_name}
* Package Name:${package_name}
* Date:${date}${time}
* Copyright (c) ${year}, chances.com.cn All Rights Reserved.
*
*/</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
* ClassName: ${type_name} <br/>
* Function: ${todo} ADD FUNCTION. <br/>
* Reason: ${todo} ADD REASON(可选). <br/>
* date: ${date} ${time} <br/>
*
* @author ${user}
* @version ${enclosing_type}${tags}
*/
</template><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**
* ${field}:${todo}(用一句话描述这个变量表示什么).
*/</template><template autoinsert="false" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
* ${enclosing_method}:(这里用一句话描述这个方法的作用). <br/>
* ${todo}(这里描述这个方法适用条件 – 可选).<br/>
* ${todo}(这里描述这个方法的执行流程 – 可选).<br/>
*
* @author ${user}
* ${tags}
*/
</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc)
* ${see_to_overridden}
*/</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert="false" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">/**
* Project Name:${project_name}
* File Name:${file_name}
* Package Name:${package_name}
* Date:${date}${time}
* Copyright (c) ${year}, chanes.com.cn All Rights Reserved.
*
*/
${filecomment}
${package_declaration}
/**
* ClassName:${type_name} <br/>
* Function: ${todo} ADD FUNCTION. <br/>
* Reason: ${todo} ADD REASON. <br/>
* Date: ${date} ${time} <br/>
* @author ${user}
* @version
* @see
*/
${typecomment}
${type_declaration}
</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub
${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>