Example usage for org.aspectj.ajdt.internal.compiler.ast InterTypeDeclaration getDeclaredSelector

List of usage examples for org.aspectj.ajdt.internal.compiler.ast InterTypeDeclaration getDeclaredSelector

Introduction

In this page you can find the example usage for org.aspectj.ajdt.internal.compiler.ast InterTypeDeclaration getDeclaredSelector.

Prototype

public char[] getDeclaredSelector() 

Source Link

Usage

From source file:org.eclipse.ajdt.core.parserbridge.AJCompilationUnitStructureRequestor.java

License:Open Source License

public void enterInterTypeDeclaration(int declarationStart, int modifiers, char[] returnType, char[] name,
        int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames,
        char[][] exceptionTypes, InterTypeDeclaration decl) {

    nameSourceEnd = nameSourceStart + decl.getDeclaredSelector().length - 1;

    Object parentInfo = this.infoStack.peek();
    JavaElement parentHandle = (JavaElement) this.handleStack.peek();
    IntertypeElement handle = null;// ww  w. j  a  va  2s. c o m

    // translate nulls to empty arrays
    if (parameterTypes == null) {
        parameterTypes = CharOperation.NO_CHAR_CHAR;
    }
    if (parameterNames == null) {
        parameterNames = CharOperation.NO_CHAR_CHAR;
    }
    if (exceptionTypes == null) {
        exceptionTypes = CharOperation.NO_CHAR_CHAR;
    }

    String nameString = concat(decl.getOnType().getTypeName()) + "." + new String(decl.getDeclaredSelector()); //$NON-NLS-1$

    String[] parameterTypeSigs = convertTypeNamesToSigsCopy(parameterTypes);
    handle = IntertypeElement.create(IntertypeElement.getJemDelimter(decl), parentHandle, nameString,
            parameterTypeSigs);

    resolveDuplicates(handle);

    IntertypeElementInfo info = new IntertypeElementInfo();

    if (decl instanceof InterTypeFieldDeclaration)
        info.setAJKind(IProgramElement.Kind.INTER_TYPE_FIELD);
    else if (decl instanceof InterTypeMethodDeclaration)
        info.setAJKind(IProgramElement.Kind.INTER_TYPE_METHOD);
    else if (decl instanceof InterTypeConstructorDeclaration)
        info.setAJKind(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR);
    else
        info.setAJKind(IProgramElement.Kind.INTER_TYPE_PARENT);

    // Fix for 116846 - incorrect icons for itds - use declaredModifiers instead
    info.setAJAccessibility(CompilationUnitTools.getAccessibilityFromModifierCode(decl.declaredModifiers));
    info.setAJModifiers(CompilationUnitTools.getModifiersFromModifierCode(decl.declaredModifiers));

    info.setSourceRangeStart(declarationStart);
    int flags = modifiers;
    info.setName(nameString.toCharArray());
    info.setNameSourceStart(nameSourceStart);
    info.setNameSourceEnd(nameSourceEnd);

    if (decl.getOnType() != null) {
        info.setTargetTypeStart(decl.getOnType().sourceStart);
        info.setTargetTypeEnd(decl.getOnType().sourceEnd + 1);
    }

    info.setTargetType(concat(decl.getOnType().getTypeName()).toCharArray());
    info.setFlags(flags);
    info.setDeclaredModifiers(decl.declaredModifiers);
    info.setArgumentNames(parameterNames);
    //info.setArgumentTypeNames(parameterTypes);
    info.setReturnType(returnType == null ? VOID : returnType);
    info.setExceptionTypeNames(exceptionTypes);
    try {
        info.setAnnotations(createJDTAnnotations(decl.annotations, info, handle));
    } catch (Exception e) {
        // ensure that this annotation handling code does not break existing functionality
        // catch and log the exception
    }

    addToChildren(parentInfo, handle);
    this.newElements.put(handle, info);
    this.infoStack.push(info);
    this.handleStack.push(handle);
}