Example usage for org.eclipse.jdt.core JavaConventions validateCompilationUnitName

List of usage examples for org.eclipse.jdt.core JavaConventions validateCompilationUnitName

Introduction

In this page you can find the example usage for org.eclipse.jdt.core JavaConventions validateCompilationUnitName.

Prototype

public static IStatus validateCompilationUnitName(String name) 

Source Link

Document

Validate the given compilation unit name.

Usage

From source file:org.ect.codegen.ea.ui.CaCodeGenerator.java

License:Open Source License

public IStatus validateGenModel(IGenModel genModel) {
    // Extract genModel properties.
    String basePackage = genModel.getProperty(PROPERTY_BASE_PACKAGE);
    String javaClass = genModel.getProperty(PROPERTY_CONNECTOR_CLASS);

    // Check whether the class file name is ok.
    IStatus status = JavaConventions.validateCompilationUnitName(javaClass + ".java");
    if (!status.isOK())
        return status;

    // Check whether the class name is not according to the conventions.
    // This includes a check for capital letter at the beginning.
    status = JavaConventions.validateJavaTypeName(javaClass);
    if (!status.isOK())
        return status;

    // Validate the package name.
    status = JavaConventions.validatePackageName(basePackage);
    if (!status.isOK())
        return status;

    return Status.OK_STATUS;
}