Example usage for org.eclipse.jdt.internal.compiler.env ICompilationUnit getPackageName

List of usage examples for org.eclipse.jdt.internal.compiler.env ICompilationUnit getPackageName

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.env ICompilationUnit getPackageName.

Prototype

char[][] getPackageName();

Source Link

Document

Answer the name of the package according to the directory structure or null if package consistency checks should be ignored.

Usage

From source file:org.conqat.engine.java.ecj.EcjUtils.java

License:Apache License

/**
 * Get the fully qualified main type name of a compilation unit.
 *///from   w  w w.  ja  v  a 2s  .c o m
public static String getMainTypeName(ICompilationUnit compilationUnit) {
    String name;

    if (compilationUnit.getPackageName() == null) {
        // default package
        name = StringUtils.EMPTY_STRING;
    } else {
        name = String.valueOf(compilationUnit.getPackageName()) + ".";
    }

    return name + String.valueOf(compilationUnit.getMainTypeName());
}