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

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

Introduction

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

Prototype

public abstract int getKind();

Source Link

Document

Returns the constant kind of this variable declaration

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. j  a va 2 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 www  .  java2  s .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;
}