Search in sources :

Example 6 with PrimitiveType

use of org.eclipse.jdt.core.dom.PrimitiveType in project processing by processing.

the class CompletionGenerator method extracTypeInfo.

/**
   * Find the SimpleType from FD, SVD, VDS, etc
   *
   * @param node
   * @return
   */
public static SimpleType extracTypeInfo(ASTNode node) {
    if (node == null) {
        return null;
    }
    Type t = extracTypeInfo2(node);
    if (t instanceof PrimitiveType) {
        return null;
    } else if (t instanceof ArrayType) {
        ArrayType at = (ArrayType) t;
        log("ele type " + at.getElementType() + ", " + at.getElementType().getClass().getName());
        if (at.getElementType() instanceof PrimitiveType) {
            return null;
        } else if (at.getElementType() instanceof SimpleType) {
            return (SimpleType) at.getElementType();
        } else
            return null;
    } else if (t instanceof ParameterizedType) {
        ParameterizedType pmt = (ParameterizedType) t;
        log(pmt.getType() + ", " + pmt.getType().getClass());
        if (pmt.getType() instanceof SimpleType) {
            return (SimpleType) pmt.getType();
        } else
            return null;
    }
    return (SimpleType) t;
}
Also used : ArrayType(org.eclipse.jdt.core.dom.ArrayType) ParameterizedType(org.eclipse.jdt.core.dom.ParameterizedType) SimpleType(org.eclipse.jdt.core.dom.SimpleType) SimpleType(org.eclipse.jdt.core.dom.SimpleType) Type(org.eclipse.jdt.core.dom.Type) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType) ArrayType(org.eclipse.jdt.core.dom.ArrayType) ParameterizedType(org.eclipse.jdt.core.dom.ParameterizedType) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType)

Example 7 with PrimitiveType

use of org.eclipse.jdt.core.dom.PrimitiveType in project bndtools by bndtools.

the class AbstractBuildErrorDetailsHandler method createMethodMarkerData.

/**
     * Create a marker on a Java Method
     *
     * @param javaProject
     * @param className
     *            - the fully qualified class name (e.g java.lang.String)
     * @param methodName
     * @param methodSignature
     *            - signatures are in "internal form" e.g. (Ljava.lang.Integer;[Ljava/lang/String;Z)V
     * @param markerAttributes
     *            - attributes that should be included in the marker, typically a message. The start and end points for
     *            the marker are added by this method.
     * @param hasResolutions
     *            - true if the marker will have resolutions
     * @return Marker Data that can be used to create an {@link IMarker}, or null if no location can be found
     * @throws JavaModelException
     */
public static final MarkerData createMethodMarkerData(IJavaProject javaProject, final String className, final String methodName, final String methodSignature, final Map<String, Object> markerAttributes, boolean hasResolutions) throws JavaModelException {
    final CompilationUnit ast = createAST(javaProject, className);
    if (ast == null)
        return null;
    ast.accept(new ASTVisitor() {

        @Override
        public boolean visit(MethodDeclaration methodDecl) {
            if (matches(ast, methodDecl, methodName, methodSignature)) {
                // Create the marker attribs here
                markerAttributes.put(IMarker.CHAR_START, methodDecl.getStartPosition());
                markerAttributes.put(IMarker.CHAR_END, methodDecl.getStartPosition() + methodDecl.getLength());
            }
            return false;
        }

        private boolean matches(CompilationUnit ast, MethodDeclaration methodDecl, String methodName, String signature) {
            if ("<init>".equals(methodName)) {
                if (!methodDecl.isConstructor()) {
                    return false;
                }
            } else if (!methodDecl.getName().getIdentifier().equals(methodName)) {
                return false;
            }
            return getSignature(ast, methodDecl).equals(signature);
        }

        private String getSignature(CompilationUnit ast, MethodDeclaration methodDecl) {
            StringBuilder signatureBuilder = new StringBuilder("(");
            for (@SuppressWarnings("unchecked") Iterator<SingleVariableDeclaration> it = methodDecl.parameters().iterator(); it.hasNext(); ) {
                SingleVariableDeclaration decl = it.next();
                appendType(ast, signatureBuilder, decl.getType(), decl.getExtraDimensions());
            }
            signatureBuilder.append(")");
            appendType(ast, signatureBuilder, methodDecl.getReturnType2(), 0);
            return signatureBuilder.toString();
        }

        private void appendType(CompilationUnit ast, StringBuilder signatureBuilder, Type typeToAdd, int extraDimensions) {
            for (int i = 0; i < extraDimensions; i++) {
                signatureBuilder.append('[');
            }
            Type rovingType = typeToAdd;
            if (rovingType == null) {
                //A special return type for constructors, nice one Eclipse...
                signatureBuilder.append("V");
            } else {
                if (rovingType.isArrayType()) {
                    ArrayType type = (ArrayType) rovingType;
                    int depth = type.getDimensions();
                    for (int i = 0; i < depth; i++) {
                        signatureBuilder.append('[');
                    }
                    //We still need to add the array component type, which might be primitive or a reference
                    rovingType = type.getElementType();
                }
                // Type erasure means that we should ignore parameters
                if (rovingType.isParameterizedType()) {
                    rovingType = ((ParameterizedType) rovingType).getType();
                }
                if (rovingType.isPrimitiveType()) {
                    PrimitiveType type = (PrimitiveType) rovingType;
                    signatureBuilder.append(PRIMITIVES_TO_SIGNATURES.get(type.getPrimitiveTypeCode()));
                } else if (rovingType.isSimpleType()) {
                    SimpleType type = (SimpleType) rovingType;
                    String name;
                    if (type.getName().isQualifiedName()) {
                        name = type.getName().getFullyQualifiedName();
                    } else {
                        name = getFullyQualifiedNameForSimpleName(ast, type.getName());
                    }
                    name = name.replace('.', '/');
                    signatureBuilder.append("L").append(name).append(";");
                } else if (rovingType.isQualifiedType()) {
                    QualifiedType type = (QualifiedType) rovingType;
                    String name = type.getQualifier().toString().replace('.', '/') + '/' + type.getName().getFullyQualifiedName().replace('.', '/');
                    signatureBuilder.append("L").append(name).append(";");
                } else {
                    throw new IllegalArgumentException("We hit an unknown type " + rovingType);
                }
            }
        }

        private String getFullyQualifiedNameForSimpleName(CompilationUnit ast, Name typeName) {
            String name = typeName.getFullyQualifiedName();
            @SuppressWarnings("unchecked") List<ImportDeclaration> ids = ast.imports();
            for (ImportDeclaration id : ids) {
                if (id.isStatic())
                    continue;
                if (id.isOnDemand()) {
                    String packageName = id.getName().getFullyQualifiedName();
                    try {
                        if (ast.getJavaElement().getJavaProject().findType(packageName + "." + name) != null) {
                            name = packageName + '.' + name;
                        }
                    } catch (JavaModelException e) {
                    }
                } else {
                    String importName = id.getName().getFullyQualifiedName();
                    if (importName.endsWith("." + name)) {
                        name = importName;
                        break;
                    }
                }
            }
            if (name.indexOf('.') < 0) {
                try {
                    if (ast.getJavaElement().getJavaProject().findType(name) == null) {
                        name = "java.lang." + name;
                    }
                } catch (JavaModelException e) {
                }
            }
            return name;
        }
    });
    if (!markerAttributes.containsKey(IMarker.CHAR_START))
        return null;
    return new MarkerData(ast.getJavaElement().getResource(), markerAttributes, hasResolutions);
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) JavaModelException(org.eclipse.jdt.core.JavaModelException) MethodDeclaration(org.eclipse.jdt.core.dom.MethodDeclaration) SingleVariableDeclaration(org.eclipse.jdt.core.dom.SingleVariableDeclaration) ASTVisitor(org.eclipse.jdt.core.dom.ASTVisitor) SimpleName(org.eclipse.jdt.core.dom.SimpleName) Name(org.eclipse.jdt.core.dom.Name) ArrayType(org.eclipse.jdt.core.dom.ArrayType) ParameterizedType(org.eclipse.jdt.core.dom.ParameterizedType) SimpleType(org.eclipse.jdt.core.dom.SimpleType) SimpleType(org.eclipse.jdt.core.dom.SimpleType) Type(org.eclipse.jdt.core.dom.Type) IType(org.eclipse.jdt.core.IType) QualifiedType(org.eclipse.jdt.core.dom.QualifiedType) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType) ArrayType(org.eclipse.jdt.core.dom.ArrayType) ParameterizedType(org.eclipse.jdt.core.dom.ParameterizedType) QualifiedType(org.eclipse.jdt.core.dom.QualifiedType) Iterator(java.util.Iterator) ImportDeclaration(org.eclipse.jdt.core.dom.ImportDeclaration) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType) List(java.util.List)

Example 8 with PrimitiveType

use of org.eclipse.jdt.core.dom.PrimitiveType in project che by eclipse.

the class StubUtility2 method createImplementationStub.

public static MethodDeclaration createImplementationStub(ICompilationUnit unit, ASTRewrite rewrite, ImportRewrite imports, ImportRewriteContext context, IMethodBinding binding, String[] parameterNames, String type, CodeGenerationSettings settings, boolean inInterface) throws CoreException {
    Assert.isNotNull(imports);
    Assert.isNotNull(rewrite);
    AST ast = rewrite.getAST();
    MethodDeclaration decl = ast.newMethodDeclaration();
    decl.modifiers().addAll(getImplementationModifiers(ast, binding, inInterface, imports, context));
    decl.setName(ast.newSimpleName(binding.getName()));
    decl.setConstructor(false);
    ITypeBinding bindingReturnType = binding.getReturnType();
    if (bindingReturnType.isWildcardType()) {
        ITypeBinding bound = bindingReturnType.getBound();
        bindingReturnType = (bound != null) ? bound : bindingReturnType.getErasure();
    }
    IJavaProject javaProject = unit.getJavaProject();
    if (JavaModelUtil.is50OrHigher(javaProject)) {
        createTypeParameters(imports, context, ast, binding, decl);
    } else {
        bindingReturnType = bindingReturnType.getErasure();
    }
    decl.setReturnType2(imports.addImport(bindingReturnType, ast, context));
    List<SingleVariableDeclaration> parameters = createParameters(javaProject, imports, context, ast, binding, parameterNames, decl);
    createThrownExceptions(decl, binding, imports, context, ast);
    String delimiter = unit.findRecommendedLineSeparator();
    int modifiers = binding.getModifiers();
    if (!(inInterface && Modifier.isAbstract(modifiers))) {
        // generate a method body
        Map<String, String> options = javaProject.getOptions(true);
        Block body = ast.newBlock();
        decl.setBody(body);
        //$NON-NLS-1$
        String bodyStatement = "";
        if (Modifier.isAbstract(modifiers)) {
            Expression expression = ASTNodeFactory.newDefaultExpression(ast, decl.getReturnType2(), decl.getExtraDimensions());
            if (expression != null) {
                ReturnStatement returnStatement = ast.newReturnStatement();
                returnStatement.setExpression(expression);
                bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter, options);
            }
        } else {
            SuperMethodInvocation invocation = ast.newSuperMethodInvocation();
            ITypeBinding declaringType = binding.getDeclaringClass();
            if (declaringType.isInterface()) {
                String qualifier = imports.addImport(declaringType.getErasure(), context);
                Name name = ASTNodeFactory.newName(ast, qualifier);
                invocation.setQualifier(name);
            }
            invocation.setName(ast.newSimpleName(binding.getName()));
            SingleVariableDeclaration varDecl = null;
            for (Iterator<SingleVariableDeclaration> iterator = parameters.iterator(); iterator.hasNext(); ) {
                varDecl = iterator.next();
                invocation.arguments().add(ast.newSimpleName(varDecl.getName().getIdentifier()));
            }
            Expression expression = invocation;
            Type returnType = decl.getReturnType2();
            if (returnType instanceof PrimitiveType && ((PrimitiveType) returnType).getPrimitiveTypeCode().equals(PrimitiveType.VOID)) {
                bodyStatement = ASTNodes.asFormattedString(ast.newExpressionStatement(expression), 0, delimiter, options);
            } else {
                ReturnStatement returnStatement = ast.newReturnStatement();
                returnStatement.setExpression(expression);
                bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter, options);
            }
        }
        String placeHolder = CodeGeneration.getMethodBodyContent(unit, type, binding.getName(), false, bodyStatement, delimiter);
        if (placeHolder != null) {
            ReturnStatement todoNode = (ReturnStatement) rewrite.createStringPlaceholder(placeHolder, ASTNode.RETURN_STATEMENT);
            body.statements().add(todoNode);
        }
    }
    if (settings != null && settings.createComments) {
        String string = CodeGeneration.getMethodComment(unit, type, decl, binding, delimiter);
        if (string != null) {
            Javadoc javadoc = (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC);
            decl.setJavadoc(javadoc);
        }
    }
    if (settings != null && settings.overrideAnnotation && JavaModelUtil.is50OrHigher(javaProject)) {
        addOverrideAnnotation(javaProject, rewrite, decl, binding);
    }
    return decl;
}
Also used : AST(org.eclipse.jdt.core.dom.AST) MethodDeclaration(org.eclipse.jdt.core.dom.MethodDeclaration) SingleVariableDeclaration(org.eclipse.jdt.core.dom.SingleVariableDeclaration) Javadoc(org.eclipse.jdt.core.dom.Javadoc) SuperMethodInvocation(org.eclipse.jdt.core.dom.SuperMethodInvocation) Name(org.eclipse.jdt.core.dom.Name) ArrayType(org.eclipse.jdt.core.dom.ArrayType) Type(org.eclipse.jdt.core.dom.Type) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType) IJavaProject(org.eclipse.jdt.core.IJavaProject) Expression(org.eclipse.jdt.core.dom.Expression) ITypeBinding(org.eclipse.jdt.core.dom.ITypeBinding) ReturnStatement(org.eclipse.jdt.core.dom.ReturnStatement) Block(org.eclipse.jdt.core.dom.Block) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType)

Example 9 with PrimitiveType

use of org.eclipse.jdt.core.dom.PrimitiveType in project che by eclipse.

the class AbstractMethodCorrectionProposal method getStub.

private MethodDeclaration getStub(ASTRewrite rewrite, ASTNode targetTypeDecl) throws CoreException {
    AST ast = targetTypeDecl.getAST();
    MethodDeclaration decl = ast.newMethodDeclaration();
    SimpleName newNameNode = getNewName(rewrite);
    decl.setConstructor(isConstructor());
    addNewModifiers(rewrite, targetTypeDecl, decl.modifiers());
    ArrayList<String> takenNames = new ArrayList<String>();
    addNewTypeParameters(rewrite, takenNames, decl.typeParameters());
    decl.setName(newNameNode);
    IVariableBinding[] declaredFields = fSenderBinding.getDeclaredFields();
    for (int i = 0; i < declaredFields.length; i++) {
        // avoid to take parameter names that are equal to field names
        takenNames.add(declaredFields[i].getName());
    }
    //$NON-NLS-1$
    String bodyStatement = "";
    if (!isConstructor()) {
        Type returnType = getNewMethodType(rewrite);
        decl.setReturnType2(returnType);
        boolean isVoid = returnType instanceof PrimitiveType && PrimitiveType.VOID.equals(((PrimitiveType) returnType).getPrimitiveTypeCode());
        if (!fSenderBinding.isInterface() && !isVoid) {
            ReturnStatement returnStatement = ast.newReturnStatement();
            returnStatement.setExpression(ASTNodeFactory.newDefaultExpression(ast, returnType, 0));
            bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, String.valueOf('\n'), getCompilationUnit().getJavaProject().getOptions(true));
        }
    }
    addNewParameters(rewrite, takenNames, decl.parameters());
    addNewExceptions(rewrite, decl.thrownExceptionTypes());
    Block body = null;
    if (!fSenderBinding.isInterface()) {
        body = ast.newBlock();
        String placeHolder = CodeGeneration.getMethodBodyContent(getCompilationUnit(), fSenderBinding.getName(), newNameNode.getIdentifier(), isConstructor(), bodyStatement, String.valueOf('\n'));
        if (placeHolder != null) {
            ReturnStatement todoNode = (ReturnStatement) rewrite.createStringPlaceholder(placeHolder, ASTNode.RETURN_STATEMENT);
            body.statements().add(todoNode);
        }
    }
    decl.setBody(body);
    CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(getCompilationUnit().getJavaProject());
    if (settings.createComments && !fSenderBinding.isAnonymous()) {
        String string = CodeGeneration.getMethodComment(getCompilationUnit(), fSenderBinding.getName(), decl, null, String.valueOf('\n'));
        if (string != null) {
            Javadoc javadoc = (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC);
            decl.setJavadoc(javadoc);
        }
    }
    return decl;
}
Also used : AST(org.eclipse.jdt.core.dom.AST) CodeGenerationSettings(org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings) MethodDeclaration(org.eclipse.jdt.core.dom.MethodDeclaration) SimpleName(org.eclipse.jdt.core.dom.SimpleName) ArrayList(java.util.ArrayList) Javadoc(org.eclipse.jdt.core.dom.Javadoc) IVariableBinding(org.eclipse.jdt.core.dom.IVariableBinding) Type(org.eclipse.jdt.core.dom.Type) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType) ReturnStatement(org.eclipse.jdt.core.dom.ReturnStatement) Block(org.eclipse.jdt.core.dom.Block) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType)

Example 10 with PrimitiveType

use of org.eclipse.jdt.core.dom.PrimitiveType in project che by eclipse.

the class TypeChangeCorrectionProposal method getRewrite.

@Override
protected ASTRewrite getRewrite() throws CoreException {
    ASTNode boundNode = fAstRoot.findDeclaringNode(fBinding);
    ASTNode declNode = null;
    CompilationUnit newRoot = fAstRoot;
    if (boundNode != null) {
        // is same CU
        declNode = boundNode;
    } else {
        newRoot = ASTResolving.createQuickFixAST(getCompilationUnit(), null);
        declNode = newRoot.findDeclaringNode(fBinding.getKey());
    }
    if (declNode != null) {
        AST ast = declNode.getAST();
        ASTRewrite rewrite = ASTRewrite.create(ast);
        ImportRewrite imports = createImportRewrite(newRoot);
        ImportRewriteContext context = new ContextSensitiveImportRewriteContext(newRoot, declNode.getStartPosition(), imports);
        Type type = imports.addImport(fNewType, ast, context);
        if (declNode instanceof MethodDeclaration) {
            MethodDeclaration methodDecl = (MethodDeclaration) declNode;
            Type origReturnType = methodDecl.getReturnType2();
            rewrite.set(methodDecl, MethodDeclaration.RETURN_TYPE2_PROPERTY, type, null);
            DimensionRewrite.removeAllChildren(methodDecl, MethodDeclaration.EXTRA_DIMENSIONS2_PROPERTY, rewrite, null);
            // add javadoc tag
            Javadoc javadoc = methodDecl.getJavadoc();
            if (javadoc != null && origReturnType != null && origReturnType.isPrimitiveType() && ((PrimitiveType) origReturnType).getPrimitiveTypeCode() == PrimitiveType.VOID) {
                TagElement returnTag = JavadocTagsSubProcessor.findTag(javadoc, TagElement.TAG_RETURN, null);
                if (returnTag == null) {
                    returnTag = ast.newTagElement();
                    returnTag.setTagName(TagElement.TAG_RETURN);
                    TextElement commentStart = ast.newTextElement();
                    returnTag.fragments().add(commentStart);
                    //$NON-NLS-1$
                    addLinkedPosition(rewrite.track(commentStart), false, "comment_start");
                    ListRewrite tagsRewriter = rewrite.getListRewrite(javadoc, Javadoc.TAGS_PROPERTY);
                    JavadocTagsSubProcessor.insertTag(tagsRewriter, returnTag, null);
                }
            }
        } else if (declNode instanceof AnnotationTypeMemberDeclaration) {
            AnnotationTypeMemberDeclaration methodDecl = (AnnotationTypeMemberDeclaration) declNode;
            rewrite.set(methodDecl, AnnotationTypeMemberDeclaration.TYPE_PROPERTY, type, null);
        } else if (declNode instanceof VariableDeclarationFragment) {
            ASTNode parent = declNode.getParent();
            if (parent instanceof FieldDeclaration) {
                FieldDeclaration fieldDecl = (FieldDeclaration) parent;
                if (fieldDecl.fragments().size() > 1 && (fieldDecl.getParent() instanceof AbstractTypeDeclaration)) {
                    // split
                    VariableDeclarationFragment placeholder = (VariableDeclarationFragment) rewrite.createMoveTarget(declNode);
                    FieldDeclaration newField = ast.newFieldDeclaration(placeholder);
                    newField.setType(type);
                    AbstractTypeDeclaration typeDecl = (AbstractTypeDeclaration) fieldDecl.getParent();
                    ListRewrite listRewrite = rewrite.getListRewrite(typeDecl, typeDecl.getBodyDeclarationsProperty());
                    if (fieldDecl.fragments().indexOf(declNode) == 0) {
                        // if it as the first in the list-> insert before
                        listRewrite.insertBefore(newField, parent, null);
                    } else {
                        listRewrite.insertAfter(newField, parent, null);
                    }
                } else {
                    rewrite.set(fieldDecl, FieldDeclaration.TYPE_PROPERTY, type, null);
                    DimensionRewrite.removeAllChildren(declNode, VariableDeclarationFragment.EXTRA_DIMENSIONS2_PROPERTY, rewrite, null);
                }
            } else if (parent instanceof VariableDeclarationStatement) {
                VariableDeclarationStatement varDecl = (VariableDeclarationStatement) parent;
                if (varDecl.fragments().size() > 1 && (varDecl.getParent() instanceof Block)) {
                    // split
                    VariableDeclarationFragment placeholder = (VariableDeclarationFragment) rewrite.createMoveTarget(declNode);
                    VariableDeclarationStatement newStat = ast.newVariableDeclarationStatement(placeholder);
                    newStat.setType(type);
                    ListRewrite listRewrite = rewrite.getListRewrite(varDecl.getParent(), Block.STATEMENTS_PROPERTY);
                    if (varDecl.fragments().indexOf(declNode) == 0) {
                        // if it as the first in the list-> insert before
                        listRewrite.insertBefore(newStat, parent, null);
                    } else {
                        listRewrite.insertAfter(newStat, parent, null);
                    }
                } else {
                    rewrite.set(varDecl, VariableDeclarationStatement.TYPE_PROPERTY, type, null);
                    DimensionRewrite.removeAllChildren(declNode, VariableDeclarationFragment.EXTRA_DIMENSIONS2_PROPERTY, rewrite, null);
                }
            } else if (parent instanceof VariableDeclarationExpression) {
                VariableDeclarationExpression varDecl = (VariableDeclarationExpression) parent;
                rewrite.set(varDecl, VariableDeclarationExpression.TYPE_PROPERTY, type, null);
                DimensionRewrite.removeAllChildren(declNode, VariableDeclarationFragment.EXTRA_DIMENSIONS2_PROPERTY, rewrite, null);
            }
        } else if (declNode instanceof SingleVariableDeclaration) {
            SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) declNode;
            rewrite.set(variableDeclaration, SingleVariableDeclaration.TYPE_PROPERTY, type, null);
            DimensionRewrite.removeAllChildren(declNode, SingleVariableDeclaration.EXTRA_DIMENSIONS2_PROPERTY, rewrite, null);
        }
        // set up linked mode
        //$NON-NLS-1$
        final String KEY_TYPE = "type";
        addLinkedPosition(rewrite.track(type), true, KEY_TYPE);
        if (fTypeProposals != null) {
            for (int i = 0; i < fTypeProposals.length; i++) {
                addLinkedPositionProposal(KEY_TYPE, fTypeProposals[i]);
            }
        }
        return rewrite;
    }
    return null;
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) AST(org.eclipse.jdt.core.dom.AST) ImportRewrite(org.eclipse.jdt.core.dom.rewrite.ImportRewrite) MethodDeclaration(org.eclipse.jdt.core.dom.MethodDeclaration) SingleVariableDeclaration(org.eclipse.jdt.core.dom.SingleVariableDeclaration) VariableDeclarationExpression(org.eclipse.jdt.core.dom.VariableDeclarationExpression) Javadoc(org.eclipse.jdt.core.dom.Javadoc) ListRewrite(org.eclipse.jdt.core.dom.rewrite.ListRewrite) FieldDeclaration(org.eclipse.jdt.core.dom.FieldDeclaration) ContextSensitiveImportRewriteContext(org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext) Type(org.eclipse.jdt.core.dom.Type) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType) TextElement(org.eclipse.jdt.core.dom.TextElement) ImportRewriteContext(org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext) ContextSensitiveImportRewriteContext(org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext) AnnotationTypeMemberDeclaration(org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration) VariableDeclarationFragment(org.eclipse.jdt.core.dom.VariableDeclarationFragment) ASTNode(org.eclipse.jdt.core.dom.ASTNode) ASTRewrite(org.eclipse.jdt.core.dom.rewrite.ASTRewrite) TagElement(org.eclipse.jdt.core.dom.TagElement) VariableDeclarationStatement(org.eclipse.jdt.core.dom.VariableDeclarationStatement) Block(org.eclipse.jdt.core.dom.Block) PrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType) AbstractTypeDeclaration(org.eclipse.jdt.core.dom.AbstractTypeDeclaration)

Aggregations

PrimitiveType (org.eclipse.jdt.core.dom.PrimitiveType)13 Type (org.eclipse.jdt.core.dom.Type)10 ArrayType (org.eclipse.jdt.core.dom.ArrayType)7 MethodDeclaration (org.eclipse.jdt.core.dom.MethodDeclaration)5 ParameterizedType (org.eclipse.jdt.core.dom.ParameterizedType)5 IType (org.eclipse.jdt.core.IType)4 QualifiedType (org.eclipse.jdt.core.dom.QualifiedType)4 ReturnStatement (org.eclipse.jdt.core.dom.ReturnStatement)4 SimpleName (org.eclipse.jdt.core.dom.SimpleName)4 SimpleType (org.eclipse.jdt.core.dom.SimpleType)4 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)3 AST (org.eclipse.jdt.core.dom.AST)3 ASTNode (org.eclipse.jdt.core.dom.ASTNode)3 Block (org.eclipse.jdt.core.dom.Block)3 CompilationUnit (org.eclipse.jdt.core.dom.CompilationUnit)3 Javadoc (org.eclipse.jdt.core.dom.Javadoc)3 Name (org.eclipse.jdt.core.dom.Name)3 NameQualifiedType (org.eclipse.jdt.core.dom.NameQualifiedType)3 SingleVariableDeclaration (org.eclipse.jdt.core.dom.SingleVariableDeclaration)3 ArrayList (java.util.ArrayList)2