private void updateConstructorReference(ITypeBinding[] parameters, ParameterizedType type, CompilationUnitRewrite targetRewrite, ICompilationUnit cu, TextEditGroup group) throws CoreException { final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(type, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); TypeParameter parameter= null; for (int index= type.typeArguments().size(); index < parameters.length; index++) { parameter= targetRewrite.getRoot().getAST().newTypeParameter(); parameter.setName(targetRewrite.getRoot().getAST().newSimpleName(parameters[index].getName())); rewrite.insertLast(parameter, group); } if (type.getParent() instanceof ClassInstanceCreation) updateConstructorReference((ClassInstanceCreation) type.getParent(), targetRewrite, cu, group); }
private void updateConstructorReference(ITypeBinding[] parameters, ParameterizedType type, CompilationUnitRewrite targetRewrite, ICompilationUnit cu, TextEditGroup group) throws CoreException { final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(type, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); TypeParameter parameter= null; for (int index= type.typeArguments().size(); index < parameters.length; index++) { parameter= targetRewrite.getRoot().getAST().newTypeParameter(); parameter.setName(targetRewrite.getRoot().getAST().newSimpleName(parameters[index].getName())); rewrite.insertLast(parameter, group); } if (type.getParent() instanceof ClassInstanceCreation) updateConstructorReference((ClassInstanceCreation) type.getParent(), targetRewrite, cu, group); }
private void updateConstructorReference(ITypeBinding[] parameters, ParameterizedType type, CompilationUnitRewrite targetRewrite, ICompilationUnit cu, TextEditGroup group) throws CoreException { final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(type, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); TypeParameter parameter= null; for (int index= type.typeArguments().size(); index < parameters.length; index++) { parameter= targetRewrite.getRoot().getAST().newTypeParameter(); parameter.setName(targetRewrite.getRoot().getAST().newSimpleName(parameters[index].getName())); rewrite.insertLast(parameter, group); } if (type.getParent() instanceof ClassInstanceCreation) updateConstructorReference((ClassInstanceCreation) type.getParent(), targetRewrite, cu, group); }
private boolean updateParameterizedTypeReference(ITypeBinding[] parameters, ParameterizedType type, CompilationUnitRewrite targetRewrite, TextEditGroup group) { if (!(type.getParent() instanceof ClassInstanceCreation)) { final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(type, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); final AST ast= targetRewrite.getRoot().getAST(); Type simpleType= null; for (int index= type.typeArguments().size(); index < parameters.length; index++) { simpleType= ast.newSimpleType(ast.newSimpleName(parameters[index].getName())); rewrite.insertLast(simpleType, group); } } return true; }
private boolean updateParameterizedTypeReference(ITypeBinding[] parameters, ParameterizedType type, CompilationUnitRewrite targetRewrite, TextEditGroup group) { if (!(type.getParent() instanceof ClassInstanceCreation)) { final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(type, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); final AST ast= targetRewrite.getRoot().getAST(); Type simpleType= null; for (int index= type.typeArguments().size(); index < parameters.length; index++) { simpleType= ast.newSimpleType(ast.newSimpleName(parameters[index].getName())); rewrite.insertLast(simpleType, group); } } return true; }
private boolean updateParameterizedTypeReference(ITypeBinding[] parameters, ParameterizedType type, CompilationUnitRewrite targetRewrite, TextEditGroup group) { if (!(type.getParent() instanceof ClassInstanceCreation)) { final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(type, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); final AST ast= targetRewrite.getRoot().getAST(); Type simpleType= null; for (int index= type.typeArguments().size(); index < parameters.length; index++) { simpleType= ast.newSimpleType(ast.newSimpleName(parameters[index].getName())); rewrite.insertLast(simpleType, group); } } return true; }
/** * The selection corresponds to a ParameterizedType (return type of method) */ private String parameterizedTypeSelected(ParameterizedType pt) { ASTNode parent= pt.getParent(); if (parent.getNodeType() == ASTNode.METHOD_DECLARATION){ fMethodBinding= ((MethodDeclaration)parent).resolveBinding(); fParamIndex= -1; fEffectiveSelectionStart= pt.getStartPosition(); fEffectiveSelectionLength= pt.getLength(); setOriginalType(pt.resolveBinding()); } else if (parent.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION){ return singleVariableDeclarationSelected((SingleVariableDeclaration)parent); } else if (parent.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT){ return variableDeclarationStatementSelected((VariableDeclarationStatement)parent); } else if (parent.getNodeType() == ASTNode.FIELD_DECLARATION){ return fieldDeclarationSelected((FieldDeclaration)parent); } else { return nodeTypeNotSupported(); } return null; }
/** * The selection corresponds to a ParameterizedType (return type of method) * @param pt the type * @return the message */ private String parameterizedTypeSelected(ParameterizedType pt) { ASTNode parent= pt.getParent(); if (parent.getNodeType() == ASTNode.METHOD_DECLARATION){ fMethodBinding= ((MethodDeclaration)parent).resolveBinding(); fParamIndex= -1; fEffectiveSelectionStart= pt.getStartPosition(); fEffectiveSelectionLength= pt.getLength(); setOriginalType(pt.resolveBinding()); } else if (parent.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION){ return singleVariableDeclarationSelected((SingleVariableDeclaration)parent); } else if (parent.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT){ return variableDeclarationStatementSelected((VariableDeclarationStatement)parent); } else if (parent.getNodeType() == ASTNode.FIELD_DECLARATION){ return fieldDeclarationSelected((FieldDeclaration)parent); } else { return nodeTypeNotSupported(); } return null; }
/** * The selection corresponds to a ParameterizedType (return type of method) * @param pt the type * @return the message */ private String parameterizedTypeSelected(ParameterizedType pt) { ASTNode parent= pt.getParent(); if (parent.getNodeType() == ASTNode.METHOD_DECLARATION){ fMethodBinding= ((MethodDeclaration)parent).resolveBinding(); fParamIndex= -1; fEffectiveSelectionStart= pt.getStartPosition(); fEffectiveSelectionLength= pt.getLength(); setOriginalType(pt.resolveBinding()); } else if (parent.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION){ return singleVariableDeclarationSelected((SingleVariableDeclaration)parent); } else if (parent.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT){ return variableDeclarationStatementSelected((VariableDeclarationStatement)parent); } else if (parent.getNodeType() == ASTNode.FIELD_DECLARATION){ return fieldDeclarationSelected((FieldDeclaration)parent); } else { return nodeTypeNotSupported(); } return null; }
} else if (node instanceof ParameterizedType) { final ParameterizedType type = (ParameterizedType) node; final ASTNode parent = type.getParent(); if (parent instanceof ClassInstanceCreation) { final ClassInstanceCreation creation = (ClassInstanceCreation) parent;
else if (node instanceof ParameterizedType) { final ParameterizedType type= (ParameterizedType) node; final ASTNode parent= type.getParent(); if (parent instanceof ClassInstanceCreation) { final ClassInstanceCreation creation= (ClassInstanceCreation) parent;
else if (node instanceof ParameterizedType) { final ParameterizedType type= (ParameterizedType) node; final ASTNode parent= type.getParent(); if (parent instanceof ClassInstanceCreation) { final ClassInstanceCreation creation= (ClassInstanceCreation) parent;
else if (node instanceof ParameterizedType) { final ParameterizedType type= (ParameterizedType) node; final ASTNode parent= type.getParent(); if (parent instanceof ClassInstanceCreation) { final ClassInstanceCreation creation= (ClassInstanceCreation) parent;