List of usage examples for org.eclipse.jdt.internal.codeassist.select SelectionNodeFound SelectionNodeFound
public SelectionNodeFound(Binding binding)
From source file:com.codenvy.ide.ext.java.server.internal.codeassist.SelectionEngine.java
License:Open Source License
private void selectLocalDeclaration(ASTNode node) { // the selected identifier is not identical to the parser one (equals but not identical), // for traversing the parse tree, the parser assist identifier is necessary for identitiy checks final char[] assistIdentifier = getParser().assistIdentifier(); if (assistIdentifier == null) return;/*from ww w.j a v a 2 s. com*/ class Visitor extends ASTVisitor { public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) { if (constructorDeclaration.selector == assistIdentifier) { if (constructorDeclaration.binding != null) { throw new SelectionNodeFound(constructorDeclaration.binding); } else { if (constructorDeclaration.scope != null) { throw new SelectionNodeFound(new MethodBinding(constructorDeclaration.modifiers, constructorDeclaration.selector, null, null, null, constructorDeclaration.scope.referenceType().binding)); } } } return true; } public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) { if (fieldDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(fieldDeclaration.binding); } return true; } public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) { if (localTypeDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(localTypeDeclaration.binding); } return true; } public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) { if (memberTypeDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(memberTypeDeclaration.binding); } return true; } public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { if (methodDeclaration.selector == assistIdentifier) { if (methodDeclaration.binding != null) { throw new SelectionNodeFound(methodDeclaration.binding); } else { if (methodDeclaration.scope != null) { throw new SelectionNodeFound( new MethodBinding(methodDeclaration.modifiers, methodDeclaration.selector, null, null, null, methodDeclaration.scope.referenceType().binding)); } } } return true; } public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { if (typeDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(typeDeclaration.binding); } return true; } public boolean visit(TypeParameter typeParameter, BlockScope scope) { if (typeParameter.name == assistIdentifier) { throw new SelectionNodeFound(typeParameter.binding); } return true; } public boolean visit(TypeParameter typeParameter, ClassScope scope) { if (typeParameter.name == assistIdentifier) { throw new SelectionNodeFound(typeParameter.binding); } return true; } } if (node instanceof AbstractMethodDeclaration) { ((AbstractMethodDeclaration) node).traverse(new Visitor(), (ClassScope) null); } else { ((FieldDeclaration) node).traverse(new Visitor(), (MethodScope) null); } }
From source file:org.eclipse.objectteams.otdt.internal.codeassist.select.SelectionOnBaseAllocationExpression.java
License:Open Source License
@Override public TypeBinding resolveType(BlockScope scope) { super.resolveType(scope); if (this.expression instanceof AllocationExpression) throw new SelectionNodeFound(((AllocationExpression) this.expression).binding); else/*w ww .jav a 2s. c o m*/ throw new SelectionNodeFound(); // see super method on how we can get here. }
From source file:org.eclipse.objectteams.otdt.internal.codeassist.SelectionOnCallinMapping.java
License:Open Source License
@Override public void resolveMethodSpecs(RoleModel role, ReferenceBinding baseType, boolean resolveBaseMethods) { super.resolveMethodSpecs(role, baseType, resolveBaseMethods); // FIXME(SH): checking throw new SelectionNodeFound(this.binding); }
From source file:org.eclipse.objectteams.otdt.internal.codeassist.SelectionOnParameterMapping.java
License:Open Source License
@Override protected void argumentsResolved(MethodSpec spec) { super.argumentsResolved(spec); if (this.ident.binding != null) throw new SelectionNodeFound(this.ident.binding); }
From source file:org.eclipse.objectteams.otdt.internal.codeassist.SelectionOnTSuperMessageSend.java
License:Open Source License
@Override protected TypeBinding findMethodBinding(BlockScope scope) { super.findMethodBinding(scope); throw new SelectionNodeFound(this.binding); }