Example usage for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration LOCAL_VARIABLE

List of usage examples for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration LOCAL_VARIABLE

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration LOCAL_VARIABLE.

Prototype

int LOCAL_VARIABLE

To view the source code for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration LOCAL_VARIABLE.

Click Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.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).
 *///from   w w w.  ja  va2 s.c o  m
protected IJavaElement createHandle(AbstractVariableDeclaration variableDeclaration, IJavaElement parent) {
    switch (variableDeclaration.getKind()) {
    case AbstractVariableDeclaration.LOCAL_VARIABLE:
        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, false);
        }
        break;
    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, true);
        }
        break;
    case AbstractVariableDeclaration.TYPE_PARAMETER:
        return new org.eclipse.jdt.internal.core.TypeParameter((JavaElement) parent,
                new String(variableDeclaration.name));
    }
    return null;
}

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).
*//*from   ww  w .  ja  v  a  2s.c o m*/
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;
}