private Type evaluateType(AST ast) throws CoreException { ITypeBinding[] proposals= ASTResolving.getRelaxingTypes(ast, fTypeBinding); for (int i= 0; i < proposals.length; i++) { addLinkedPositionProposal(KEY_TYPE, proposals[i]); } return getImportRewrite().addImport(fTypeBinding, ast); }
private Type evaluateType(AST ast, ASTNode nodeToAssign, ITypeBinding typeBinding, String groupID) { ITypeBinding[] proposals= ASTResolving.getRelaxingTypes(ast, typeBinding); for (int i= 0; i < proposals.length; i++) { addLinkedPositionProposal(groupID, proposals[i]); } ImportRewrite importRewrite= getImportRewrite(); CompilationUnit cuNode= (CompilationUnit) nodeToAssign.getRoot(); ImportRewriteContext context= new ContextSensitiveImportRewriteContext(cuNode, nodeToAssign.getStartPosition(), importRewrite); return importRewrite.addImport(typeBinding, ast, context); }
private Type evaluateParameterType(AST ast, Expression elem, String key) throws CoreException { ITypeBinding binding= Bindings.normalizeTypeBinding(elem.resolveTypeBinding()); if (binding != null && binding.isWildcardType()) { binding= ASTResolving.normalizeWildcardType(binding, true, ast); } if (binding != null) { ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < typeProposals.length; i++) { addLinkedPositionProposal(key, typeProposals[i]); } return getImportRewrite().addImport(binding, ast); } return ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ }
private Type evaluateParameterType(AST ast, Expression elem, String key, ImportRewriteContext context) { ITypeBinding binding= Bindings.normalizeTypeBinding(elem.resolveTypeBinding()); if (binding != null && binding.isWildcardType()) { binding= ASTResolving.normalizeWildcardType(binding, true, ast); } if (binding != null) { ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < typeProposals.length; i++) { addLinkedPositionProposal(key, typeProposals[i]); } return getImportRewrite().addImport(binding, ast, context); } return ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ }
ITypeBinding[] bindings= ASTResolving.getRelaxingTypes(ast, desc.type); for (int k= 0; k < bindings.length; k++) { addLinkedPositionProposal(typeKey, bindings[k]);
ITypeBinding[] bindings= ASTResolving.getRelaxingTypes(ast, desc.type); for (int k= 0; k < bindings.length; k++) { addLinkedPositionProposal(typeKey, bindings[k]);
addLinkedPosition(rewrite.track(type), true, KEY_TYPE); if (fOfferSuperTypeProposals) { ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, fNewType); for (int i= 0; i < typeProposals.length; i++) { addLinkedPositionProposal(KEY_TYPE, typeProposals[i]);
ITypeBinding[] bindings= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < bindings.length; i++) { proposal.addLinkedPositionProposal(key, bindings[i]);
proposal.addLinkedPosition(rewrite.track(type), true, key); if (typeBinding != null) { ITypeBinding[] bindings= ASTResolving.getRelaxingTypes(ast, typeBinding); for (int i= 0; i < bindings.length; i++) { proposal.addLinkedPositionProposal(key, bindings[i]);
ITypeBinding[] bindings= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < bindings.length; i++) { proposal.addLinkedPositionProposal(key, bindings[i]);
public TypeChangeCorrectionProposal(ICompilationUnit targetCU, IBinding binding, CompilationUnit astRoot, ITypeBinding newType, boolean offerSuperTypeProposals, int relevance) { super("", targetCU, null, relevance, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE)); //$NON-NLS-1$ Assert.isTrue(binding != null && (binding.getKind() == IBinding.METHOD || binding.getKind() == IBinding.VARIABLE) && Bindings.isDeclarationBinding(binding)); fBinding= binding; // must be generic method or (generic) variable fAstRoot= astRoot; if (offerSuperTypeProposals) { fTypeProposals= ASTResolving.getRelaxingTypes(astRoot.getAST(), newType); sortTypes(fTypeProposals); fNewType= fTypeProposals[0]; } else { fNewType= newType; fTypeProposals= null; } String typeName= BindingLabelProvider.getBindingLabel(fNewType, JavaElementLabels.ALL_DEFAULT); if (binding.getKind() == IBinding.VARIABLE) { IVariableBinding varBinding= (IVariableBinding) binding; String[] args= { BasicElementLabels.getJavaElementName(varBinding.getName()), BasicElementLabels.getJavaElementName(typeName)}; if (varBinding.isField()) { setDisplayName(Messages.format(CorrectionMessages.TypeChangeCompletionProposal_field_name, args)); } else if (astRoot.findDeclaringNode(binding) instanceof SingleVariableDeclaration) { setDisplayName(Messages.format(CorrectionMessages.TypeChangeCompletionProposal_param_name, args)); } else { setDisplayName(Messages.format(CorrectionMessages.TypeChangeCompletionProposal_variable_name, args)); } } else { String[] args= { binding.getName(), typeName }; setDisplayName(Messages.format(CorrectionMessages.TypeChangeCompletionProposal_method_name, args)); } }
proposal.addLinkedPosition(rewrite.track(type), true, key); if (typeBinding != null) { ITypeBinding[] bindings= ASTResolving.getRelaxingTypes(ast, typeBinding); for (int i= 0; i < bindings.length; i++) { proposal.addLinkedPositionProposal(key, bindings[i]);
ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < typeProposals.length; i++) { addLinkedPositionProposal(KEY_TYPE, typeProposals[i]);
ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < typeProposals.length; i++) { addLinkedPositionProposal(KEY_TYPE, typeProposals[i]);
ITypeBinding[] typeSuggestions= ASTResolving.getRelaxingTypes(ast, currBinding); for (int i= 0; i < typeSuggestions.length; i++) { proposal.addLinkedPositionProposal(returnKey, typeSuggestions[i]);
ITypeBinding[] typeSuggestions= ASTResolving.getRelaxingTypes(ast, currBinding); for (int i= 0; i < typeSuggestions.length; i++) { proposal.addLinkedPositionProposal(returnKey, typeSuggestions[i]);