ASTNode typeDecl= ASTResolving.findParentType(invocationNode); if (typeDecl instanceof TypeDeclaration) { binding= ((TypeDeclaration) typeDecl).resolveBinding(); } else { binding= ((AnonymousClassDeclaration) typeDecl).resolveBinding(); }
binding= ASTResolving.getBindingOfParentType(invocationNode);
	public static void getMethodProposals(ProblemPosition problemPos, boolean needsNewName, ArrayList proposals) throws CoreException {		ICompilationUnit cu= problemPos.getCompilationUnit();				CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);		ASTNode selectedNode= ASTResolving.findCoveringNode(astRoot, problemPos.getOffset(), problemPos.getLength());				if (!(selectedNode instanceof SimpleName)) {			return;		}		SimpleName nameNode= (SimpleName) selectedNode;		List arguments;		Expression sender;		boolean isSuperInvocation;				ASTNode invocationNode= nameNode.getParent();		if (invocationNode instanceof MethodInvocation) {			MethodInvocation methodImpl= (MethodInvocation) invocationNode;			arguments= methodImpl.arguments();			sender= methodImpl.getExpression();			isSuperInvocation= false;		} else if (invocationNode instanceof SuperMethodInvocation) {			SuperMethodInvocation methodImpl= (SuperMethodInvocation) invocationNode;			arguments= methodImpl.arguments();			sender= methodImpl.getQualifier();			isSuperInvocation= true;		} else {			return;		}				String methodName= nameNode.getIdentifier();				// corrections		SimilarElement[] elements= SimilarElementsRequestor.findSimilarElement(cu, nameNode, SimilarElementsRequestor.METHODS);		for (int i= 0; i < elements.length; i++) {			String curr= elements[i].getName();			if (curr.equals(methodName) && needsNewName) {				continue;			}						String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.changemethod.description", curr); //$NON-NLS-1$			proposals.add(new ReplaceCorrectionProposal(label, problemPos, curr, 2));		}				// new method		ITypeBinding binding= null;		if (sender != null) {			binding= sender.resolveTypeBinding();		} else {			ASTNode typeDecl= ASTResolving.findParentType(invocationNode);			if (typeDecl instanceof TypeDeclaration) {				binding= ((TypeDeclaration) typeDecl).resolveBinding();			} else {				binding= ((AnonymousClassDeclaration) typeDecl).resolveBinding();			}			if (isSuperInvocation && binding != null) {				binding= binding.getSuperclass();			}						}		if (binding != null && binding.isFromSource()) {			ICompilationUnit targetCU= getCompilationUnit(binding, cu, astRoot);			if (targetCU != null) {							String label;				Image image;				if (cu.equals(targetCU)) {					label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createmethod.description", methodName); //$NON-NLS-1$					image= JavaPluginImages.get(JavaPluginImages.IMG_MISC_PRIVATE);				} else {					label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createmethod.other.description", new Object[] { methodName, targetCU.getElementName() } ); //$NON-NLS-1$					image= JavaPluginImages.get(JavaPluginImages.IMG_MISC_PUBLIC);				}				proposals.add(new NewMethodCompletionProposal(label, targetCU, invocationNode, arguments, binding, 1, image));			}		}	}