1 11 package org.eclipse.jdt.internal.codeassist.select; 12 13 24 import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; 25 import org.eclipse.jdt.internal.compiler.lookup.Binding; 26 import org.eclipse.jdt.internal.compiler.lookup.BlockScope; 27 import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; 28 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; 29 import org.eclipse.jdt.internal.compiler.lookup.Scope; 30 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; 31 32 public class SelectionOnSingleTypeReference extends SingleTypeReference { 33 public SelectionOnSingleTypeReference(char[] source, long pos) { 34 super(source, pos); 35 } 36 public void aboutToResolve(Scope scope) { 37 getTypeBinding(scope.parent); } 39 protected TypeBinding getTypeBinding(Scope scope) { 40 Binding binding = scope.getTypeOrPackage(new char[][] {token}); 42 if (!binding.isValidBinding()) { 43 scope.problemReporter().invalidType(this, (TypeBinding) binding); 44 throw new SelectionNodeFound(); 45 } 46 throw new SelectionNodeFound(binding); 47 } 48 public StringBuffer printExpression(int indent, StringBuffer output) { 49 50 return output.append("<SelectOnType:").append(token).append('>');} 52 public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) { 53 super.resolveTypeEnclosing(scope, enclosingType); 54 55 if (this.resolvedType == null || 57 !(this.resolvedType.isValidBinding() || 58 this.resolvedType.problemId() == ProblemReasons.NotVisible)) 59 throw new SelectionNodeFound(); 60 else 61 throw new SelectionNodeFound(this.resolvedType); 62 } 63 } 64 | Popular Tags |