int res= context.findInContext(declaringTypeName, simpleName, kind); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return key;
private void annotateList(List annotations, IAnnotationBinding [] annotationBindings, AST ast, ImportRewriteContext context, TypeLocation location, ITypeBinding type) { if (context == null) context= this.defaultContext; annotationBindings = context.removeRedundantTypeAnnotations(annotationBindings, location, type); for (int i = 0; i< annotationBindings.length; i++) { Annotation annotation = addAnnotation(annotationBindings[i], ast, context); if (annotation != null) annotations.add(annotation); } }
int res= importRewrite.getDefaultImportRewriteContext().findInContext(containerName, simpleName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { fStatus= JavaUIStatus.createError(IStatus.ERROR, CodeGenerationMessages.AddImportsOperation_error_importclash, null);
int res= importRewrite.getDefaultImportRewriteContext().findInContext(containerName, simpleName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { fStatus= JavaUIStatus.createError(IStatus.ERROR, CodeGenerationMessages.AddImportsOperation_error_importclash, null);
int res= importRewrite.getDefaultImportRewriteContext().findInContext(containerName, simpleName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { fStatus= JavaUIStatus.createError(IStatus.ERROR, CodeGenerationMessages.AddImportsOperation_error_importclash, null);
public int findInContext(String qualifier, String name, int kind) { int defaultResult= fImportRewrite.getDefaultImportRewriteContext().findInContext(qualifier, name, kind); if (defaultResult != ImportRewriteContext.RES_NAME_UNKNOWN) return defaultResult;
return fImportRewrite.getDefaultImportRewriteContext().findInContext(qualifier, name, kind);
return fImportRewrite.getDefaultImportRewriteContext().findInContext(qualifier, name, kind);
int res= context.findInContext(declaringTypeName, simpleName, kind); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return key;
int res= context.findInContext(declaringTypeName, simpleName, kind); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return key;
int res= context.findInContext(declaringTypeName, simpleName, kind); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return key;
int res= context.findInContext(declaringTypeName, simpleName, kind); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return key;
int res= context.findInContext(declaringTypeName, simpleName, kind); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return key;
private String internalAddImport(String fullTypeName, ImportRewriteContext context) { int idx= fullTypeName.lastIndexOf('.'); String typeContainerName, typeName; if (idx != -1) { typeContainerName= fullTypeName.substring(0, idx); typeName= fullTypeName.substring(idx + 1); } else { typeContainerName= ""; //$NON-NLS-1$ typeName= fullTypeName; } if (typeContainerName.length() == 0 && PrimitiveType.toCode(typeName) != null) { return fullTypeName; } if (context == null) context= this.defaultContext; int res= context.findInContext(typeContainerName, typeName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return fullTypeName; } if (res == ImportRewriteContext.RES_NAME_UNKNOWN) { addEntry(NORMAL_PREFIX + fullTypeName); } if (res == ImportRewriteContext.RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT) { addEntry(NORMAL_PREFIX + fullTypeName); this.typeExplicitSimpleNames.add(typeName); } return typeName; }
private String internalAddImport(String fullTypeName, ImportRewriteContext context) { int idx= fullTypeName.lastIndexOf('.'); String typeContainerName, typeName; if (idx != -1) { typeContainerName= fullTypeName.substring(0, idx); typeName= fullTypeName.substring(idx + 1); } else { typeContainerName= ""; //$NON-NLS-1$ typeName= fullTypeName; } if (typeContainerName.length() == 0 && PrimitiveType.toCode(typeName) != null) { return fullTypeName; } if (context == null) context= this.defaultContext; int res= context.findInContext(typeContainerName, typeName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return fullTypeName; } if (res == ImportRewriteContext.RES_NAME_UNKNOWN) { addEntry(NORMAL_PREFIX + fullTypeName); } if (res == ImportRewriteContext.RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT) { addEntry(NORMAL_PREFIX + fullTypeName); this.typeExplicitSimpleNames.add(typeName); } return typeName; }
/** * Create a Type suitable as the creationType in a ClassInstanceCreation expression. * @param ast The AST to create the nodes for. * @param typeBinding binding representing the given class type * @param importRewrite the import rewrite to use * @param importContext the import context used to determine which (null) annotations to consider * @return a Type suitable as the creationType in a ClassInstanceCreation expression. */ public static Type newCreationType(AST ast, ITypeBinding typeBinding, ImportRewrite importRewrite, ImportRewriteContext importContext) { if (typeBinding.isParameterizedType()) { Type baseType= newCreationType(ast, typeBinding.getTypeDeclaration(), importRewrite, importContext); IAnnotationBinding[] typeAnnotations= importContext.removeRedundantTypeAnnotations(typeBinding.getTypeAnnotations(), TypeLocation.NEW, typeBinding); for (IAnnotationBinding typeAnnotation : typeAnnotations) { ((AnnotatableType)baseType).annotations().add(importRewrite.addAnnotation(typeAnnotation, ast, importContext)); } ParameterizedType parameterizedType= ast.newParameterizedType(baseType); for (ITypeBinding typeArgument : typeBinding.getTypeArguments()) { typeArgument= StubUtility2Core.replaceWildcardsAndCaptures(typeArgument); parameterizedType.typeArguments().add(importRewrite.addImport(typeArgument, ast, importContext, TypeLocation.TYPE_ARGUMENT)); } return parameterizedType; } else { return importRewrite.addImport(typeBinding, ast, importContext, TypeLocation.NEW); } } }
private String internalAddImport(String fullTypeName, ImportRewriteContext context) { int idx= fullTypeName.lastIndexOf('.'); String typeContainerName, typeName; if (idx != -1) { typeContainerName= fullTypeName.substring(0, idx); typeName= fullTypeName.substring(idx + 1); } else { typeContainerName= ""; //$NON-NLS-1$ typeName= fullTypeName; } if (typeContainerName.length() == 0 && PrimitiveType.toCode(typeName) != null) { return fullTypeName; } if (context == null) context= this.defaultContext; int res= context.findInContext(typeContainerName, typeName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return fullTypeName; } if (res == ImportRewriteContext.RES_NAME_UNKNOWN) { addEntry(NORMAL_PREFIX + fullTypeName); } return typeName; }
private String internalAddImport(String fullTypeName, ImportRewriteContext context) { int idx= fullTypeName.lastIndexOf('.'); String typeContainerName, typeName; if (idx != -1) { typeContainerName= fullTypeName.substring(0, idx); typeName= fullTypeName.substring(idx + 1); } else { typeContainerName= ""; //$NON-NLS-1$ typeName= fullTypeName; } if (typeContainerName.length() == 0 && PrimitiveType.toCode(typeName) != null) { return fullTypeName; } if (context == null) context= this.defaultContext; int res= context.findInContext(typeContainerName, typeName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return fullTypeName; } if (res == ImportRewriteContext.RES_NAME_UNKNOWN) { addEntry(NORMAL_PREFIX + fullTypeName); } if (res == ImportRewriteContext.RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT) { addEntry(NORMAL_PREFIX + fullTypeName); this.typeExplicitSimpleNames.add(typeName); } return typeName; }
private String internalAddImport(String fullTypeName, ImportRewriteContext context) { int idx= fullTypeName.lastIndexOf('.'); String typeContainerName, typeName; if (idx != -1) { typeContainerName= fullTypeName.substring(0, idx); typeName= fullTypeName.substring(idx + 1); } else { typeContainerName= ""; //$NON-NLS-1$ typeName= fullTypeName; } if (typeContainerName.length() == 0 && PrimitiveType.toCode(typeName) != null) { return fullTypeName; } if (context == null) context= this.defaultContext; int res= context.findInContext(typeContainerName, typeName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return fullTypeName; } if (res == ImportRewriteContext.RES_NAME_UNKNOWN) { addEntry(NORMAL_PREFIX + fullTypeName); } return typeName; }
private String internalAddImport(String fullTypeName, ImportRewriteContext context) { int idx= fullTypeName.lastIndexOf('.'); String typeContainerName, typeName; if (idx != -1) { typeContainerName= fullTypeName.substring(0, idx); typeName= fullTypeName.substring(idx + 1); } else { typeContainerName= ""; //$NON-NLS-1$ typeName= fullTypeName; } if (typeContainerName.length() == 0 && PrimitiveType.toCode(typeName) != null) { return fullTypeName; } if (context == null) context= this.defaultContext; int res= context.findInContext(typeContainerName, typeName, ImportRewriteContext.KIND_TYPE); if (res == ImportRewriteContext.RES_NAME_CONFLICT) { return fullTypeName; } if (res == ImportRewriteContext.RES_NAME_UNKNOWN) { addEntry(NORMAL_PREFIX + fullTypeName); } return typeName; }