Example usage for org.eclipse.jdt.internal.core BinaryType BinaryType

List of usage examples for org.eclipse.jdt.internal.core BinaryType BinaryType

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core BinaryType BinaryType.

Prototype

protected BinaryType(JavaElement parent, String name) 

Source Link

Usage

From source file:org.eclipse.jdt.internal.core.SourceMapper.java

License:Open Source License

/**
 * Returns the type with the given <code>typeName</code>.  Returns inner classes
 * as well.//from   w  w w.ja v  a 2s. c  o m
 */
protected IType getType(String typeName) {
    if (typeName.length() == 0) {
        IJavaElement classFile = this.binaryType.getParent();
        String classFileName = classFile.getElementName();
        StringBuffer newClassFileName = new StringBuffer();
        int lastDollar = classFileName.lastIndexOf('$');
        for (int i = 0; i <= lastDollar; i++)
            newClassFileName.append(classFileName.charAt(i));
        newClassFileName.append(Integer.toString(this.anonymousCounter));
        PackageFragment pkg = (PackageFragment) classFile.getParent();
        return new BinaryType(new ClassFile(pkg, newClassFileName.toString()), typeName);
    } else if (this.binaryType.getElementName().equals(typeName))
        return this.binaryType;
    else
        return this.binaryType.getType(typeName);
}