Example usage for org.eclipse.jdt.internal.compiler.env ISourceType getDeclarationSourceStart

List of usage examples for org.eclipse.jdt.internal.compiler.env ISourceType getDeclarationSourceStart

Introduction

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

Prototype

int getDeclarationSourceStart();

Source Link

Document

Answer the source start position of the type's declaration.

Usage

From source file:org.eclipse.ajdt.core.javaelements.ITDAwareSourceTypeInfo.java

License:Open Source License

public ITDAwareSourceTypeInfo(ISourceType toCopy, SourceType type) {
    this.handle = createITDAwareType(type, this);

    this.setFlags(toCopy.getModifiers());
    this.setSuperclassName(toCopy.getSuperclassName());
    this.setSuperInterfaceNames(toCopy.getInterfaceNames());
    this.setNameSourceEnd(toCopy.getNameSourceEnd());
    this.setNameSourceStart(toCopy.getNameSourceStart());
    this.setSourceRangeEnd(toCopy.getDeclarationSourceEnd());
    this.setSourceRangeStart(toCopy.getDeclarationSourceStart());
    try {// ww  w .ja  v  a  2 s.c om
        ITypeParameter[] parameters = type.getTypeParameters();
        if (parameters != null) {
            this.typeParameters = new ITypeParameter[parameters.length];
            System.arraycopy(parameters, 0, this.typeParameters, 0, parameters.length);
        }
    } catch (JavaModelException e) {
    }

    IJavaElement[] children = augmentChildrenAndHierarchy(type);
    if (children != null) {
        this.setChildren(children);
    }

    try {
        // this ensures that itd aware content assist 
        // still works when there are large numbers ofannotations
        Object info = ((JavaElement) handle.getCompilationUnit()).getElementInfo();
        if (info != null && info instanceof CompilationUnitElementInfo) {
            ((CompilationUnitElementInfo) info).annotationNumber = 0;
        }
    } catch (JavaModelException e) {
    }
}