1 11 package org.eclipse.jdt.internal.codeassist.select; 12 13 33 34 import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; 35 import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; 36 import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; 37 import org.eclipse.jdt.internal.compiler.lookup.Binding; 38 import org.eclipse.jdt.internal.compiler.lookup.BlockScope; 39 import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; 40 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; 41 42 public class SelectionOnQualifiedAllocationExpression extends QualifiedAllocationExpression { 43 44 public SelectionOnQualifiedAllocationExpression() { 45 } 47 48 public SelectionOnQualifiedAllocationExpression(TypeDeclaration anonymous) { 49 super(anonymous); 50 } 51 52 public StringBuffer printExpression(int indent, StringBuffer output) { 53 if (this.enclosingInstance == null) 54 output.append("<SelectOnAllocationExpression:"); else 56 output.append("<SelectOnQualifiedAllocationExpression:"); 58 return super.printExpression(indent, output).append('>'); 59 } 60 61 public TypeBinding resolveType(BlockScope scope) { 62 super.resolveType(scope); 63 64 if (binding == null || 66 !(binding.isValidBinding() || 67 binding.problemId() == ProblemReasons.NotVisible)) 68 throw new SelectionNodeFound(); 69 if (anonymousType == null) 70 throw new SelectionNodeFound(binding); 71 72 if (anonymousType.binding.superInterfaces == Binding.NO_SUPERINTERFACES) { 76 ConstructorDeclaration constructor = (ConstructorDeclaration) anonymousType.declarationOf(binding.original()); 78 throw new SelectionNodeFound(constructor.constructorCall.binding); 79 } else { 80 throw new SelectionNodeFound(anonymousType.binding.superInterfaces[0]); 82 } 83 } 84 } 85 | Popular Tags |