createImportRewrite(fAstRoot); } else { CompilationUnit newRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null); declNode= newRoot.findDeclaringNode(fBinding.getKey()); createImportRewrite(newRoot); if (fBounds != null && fBounds.length > 0) { List<Type> typeBounds= newTypeParam.typeBounds(); ImportRewriteContext importRewriteContext= new ContextSensitiveImportRewriteContext(declNode, getImportRewrite()); for (int i= 0; i < fBounds.length; i++) { Type newBound= getImportRewrite().addImport(fBounds[i], ast, importRewriteContext, TypeLocation.TYPE_BOUND); typeBounds.add(newBound);
public AddTypeParameterProposal(ICompilationUnit targetCU, IBinding binding, CompilationUnit astRoot, String name, ITypeBinding[] bounds, int relevance) { super("", targetCU, null, relevance, JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC)); //$NON-NLS-1$ Assert.isTrue(binding != null && Bindings.isDeclarationBinding(binding)); Assert.isTrue(binding instanceof IMethodBinding || binding instanceof ITypeBinding); fBinding= binding; fAstRoot= astRoot; fTypeParamName= name; fBounds= bounds; if (binding instanceof IMethodBinding) { String[] args= { BasicElementLabels.getJavaElementName(fTypeParamName), ASTResolving.getMethodSignature((IMethodBinding) binding) }; setDisplayName(Messages.format(CorrectionMessages.AddTypeParameterProposal_method_label, args)); } else { String[] args= { BasicElementLabels.getJavaElementName(fTypeParamName), ASTResolving.getTypeSignature((ITypeBinding) binding) }; setDisplayName(Messages.format(CorrectionMessages.AddTypeParameterProposal_type_label, args)); } }
AddTypeParameterProposal proposal= new AddTypeParameterProposal(cu, binding, root, name, null, rel); proposals.add(proposal);
AddTypeParameterProposal proposal= new AddTypeParameterProposal(cu, binding, root, name, null, rel); proposals.add(proposal);
createImportRewrite(fAstRoot); } else { CompilationUnit newRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null); declNode= newRoot.findDeclaringNode(fBinding.getKey()); createImportRewrite(newRoot); if (fBounds != null && fBounds.length > 0) { List<Type> typeBounds= newTypeParam.typeBounds(); ImportRewriteContext importRewriteContext= new ContextSensitiveImportRewriteContext(declNode, getImportRewrite()); for (int i= 0; i < fBounds.length; i++) { Type newBound= getImportRewrite().addImport(fBounds[i], ast, importRewriteContext); typeBounds.add(newBound);
public AddTypeParameterProposal(ICompilationUnit targetCU, IBinding binding, CompilationUnit astRoot, String name, ITypeBinding[] bounds, int relevance) { super("", targetCU, null, relevance, JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC)); //$NON-NLS-1$ Assert.isTrue(binding != null && Bindings.isDeclarationBinding(binding)); Assert.isTrue(binding instanceof IMethodBinding || binding instanceof ITypeBinding); fBinding= binding; fAstRoot= astRoot; fTypeParamName= name; fBounds= bounds; if (binding instanceof IMethodBinding) { String[] args= { BasicElementLabels.getJavaElementName(fTypeParamName), org.eclipse.jdt.internal.ui.text.correction.ASTResolving.getMethodSignature((IMethodBinding) binding) }; setDisplayName(Messages.format(CorrectionMessages.AddTypeParameterProposal_method_label, args)); } else { String[] args= { BasicElementLabels.getJavaElementName(fTypeParamName), org.eclipse.jdt.internal.ui.text.correction.ASTResolving.getTypeSignature((ITypeBinding) binding) }; setDisplayName(Messages.format(CorrectionMessages.AddTypeParameterProposal_type_label, args)); } }