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

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

Introduction

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

Prototype

public LocalVariable(JavaElement parent, String name, int declarationSourceStart, int declarationSourceEnd,
            int nameStart, int nameEnd, String typeSignature,
            org.eclipse.jdt.internal.compiler.ast.Annotation[] astAnnotations, int flags, boolean isParameter,
            org.eclipse.jdt.internal.compiler.ast.Annotation[][] astAnnotationsOnDimensions) 

Source Link

Usage

From source file:org.eclipse.che.jdt.internal.core.search.matching.MatchLocator.java

License:Open Source License

/**
* Create an handle for a local variable declaration (may be a local variable or type parameter).
*///w ww.j a  va2  s  .  c  om
protected IJavaElement createHandle(AbstractVariableDeclaration variableDeclaration, IJavaElement parent) {
    boolean isParameter = true;
    switch (variableDeclaration.getKind()) {
    case AbstractVariableDeclaration.LOCAL_VARIABLE:
        isParameter = false;
        //$FALL-THROUGH$
    case AbstractVariableDeclaration.PARAMETER:
        if (variableDeclaration.type.resolvedType != null) {
            return new LocalVariable((JavaElement) parent, new String(variableDeclaration.name),
                    variableDeclaration.declarationSourceStart, variableDeclaration.declarationSourceEnd,
                    variableDeclaration.sourceStart, variableDeclaration.sourceEnd,
                    new String(variableDeclaration.type.resolvedType.signature()),
                    variableDeclaration.annotations, variableDeclaration.modifiers, isParameter,
                    variableDeclaration.type.getAnnotationsOnDimensions());
        }
        break;
    case AbstractVariableDeclaration.TYPE_PARAMETER:
        return new org.eclipse.jdt.internal.core.TypeParameter((JavaElement) parent,
                new String(variableDeclaration.name));
    }
    return null;
}