Java Code Examples for org.eclipse.jdt.internal.compiler.lookup.BlockScope#referenceContext()
The following examples show how to use
org.eclipse.jdt.internal.compiler.lookup.BlockScope#referenceContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Extractor.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public boolean visit(Argument argument, BlockScope scope) { Annotation[] annotations = argument.annotations; if (hasRelevantAnnotations(annotations)) { ReferenceContext referenceContext = scope.referenceContext(); if (referenceContext instanceof AbstractMethodDeclaration) { MethodBinding binding = ((AbstractMethodDeclaration) referenceContext).binding; ClassScope classScope = findClassScope(scope); if (classScope == null) { return false; } String fqn = getFqn(classScope); ClassKind kind = ClassKind.forType(classScope.referenceContext); Item item = ParameterItem.create( (AbstractMethodDeclaration) referenceContext, argument, fqn, kind, binding, argument.binding); if (item != null) { addItem(fqn, item); addAnnotations(annotations, item); } } } return false; }
Example 2
Source File: AnnotationDiscoveryVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean visit(Argument argument, BlockScope scope) { Annotation[] annotations = argument.annotations; ReferenceContext referenceContext = scope.referenceContext(); if (referenceContext instanceof AbstractMethodDeclaration) { MethodBinding binding = ((AbstractMethodDeclaration) referenceContext).binding; if (binding != null) { TypeDeclaration typeDeclaration = scope.referenceType(); typeDeclaration.binding.resolveTypesFor(binding); if (argument.binding != null) { argument.binding = new AptSourceLocalVariableBinding(argument.binding, binding); } } if (annotations != null) { this.resolveAnnotations( scope, annotations, argument.binding); } } return false; }
Example 3
Source File: VariableBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public IMethodBinding getDeclaringMethod() { if (!isField()) { ASTNode node = this.resolver.findDeclaringNode(this); while (true) { if (node == null) { if (this.binding instanceof LocalVariableBinding) { LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding; BlockScope blockScope = localVariableBinding.declaringScope; if (blockScope != null) { ReferenceContext referenceContext = blockScope.referenceContext(); if (referenceContext instanceof Initializer) { return null; } if (referenceContext instanceof AbstractMethodDeclaration) { return this.resolver.getMethodBinding(((AbstractMethodDeclaration) referenceContext).binding); } } } return null; } switch(node.getNodeType()) { case ASTNode.INITIALIZER : return null; case ASTNode.METHOD_DECLARATION : MethodDeclaration methodDeclaration = (MethodDeclaration) node; return methodDeclaration.resolveBinding(); default: node = node.getParent(); } } } return null; }