Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ITypeBinding


      //search for the semantic action within the method proposal list
      for(int i=0; i<methods.size();i++){
        if(methods.get(i).getName().equals(action.getName())){
          //proposal has been found
          IMethodBinding b = methods.get(i).getBinding();
          ITypeBinding type = b.getReturnType();
         
          if(arrayLevel > type.getDimensions()){
            //the number of array parameters written at the operation has exceeded the actual array dimension of this type
            return null;
          }
          while (arrayLevel > 0){
            //get the containing element of the array
            type = type.getComponentType();
            arrayLevel--;
          }
         
          //if the return type of the method is void, ignore this Method
          if(!type.getName().equals("void")){
            completionProposals =  calculateSemanticFieldsAndMethds(type);
            if(iteration == size){
              //end of Statement has been reached, return the calculated proposals
              return completionProposals;
            }
            else{
              //calculate the semantic proposals for the next iteration
              completionProposals = calculateSemanticFieldsAndMethods(iteration+1, semanticActions, extractFields(completionProposals), extractMethods(completionProposals));
              if(completionProposals!=null){
                return completionProposals;
              }
            }
          }
        }
      }
    }
    else{ // if action is a Variable
      //search for the semantic action within the variable proposal list
      for(int i=0; i<fields.size(); i++){
        if(fields.get(i).getName().equals(action.getName())){
          //proposal has been found
          IVariableBinding b = fields.get(i).getBinding();
          ITypeBinding type = b.getType();
          if(arrayLevel > type.getDimensions()){
            //the number of array parameters written at the operation has exceeded the actual array dimension of this type
            return null;
          }
          while (arrayLevel > 0){
            //get the containing element of the array
            type = type.getComponentType();
            arrayLevel--;
          }
          //calculate the proposals based on the Type of the found variable
          completionProposals = calculateSemanticFieldsAndMethds(type);
         
View Full Code Here


        .getJavaElement();
    if (meth == null && ctorCall.getAnonymousClassDeclaration() != null) {
      // most likely an anonymous class.
      final AnonymousClassDeclaration acd = ctorCall
          .getAnonymousClassDeclaration();
      final ITypeBinding binding = acd.resolveBinding();
      final ITypeBinding superBinding = binding.getSuperclass();
      for (final Iterator it = Arrays.asList(
          superBinding.getDeclaredMethods()).iterator(); it.hasNext();) {
        final IMethodBinding imb = (IMethodBinding) it.next();
        if (imb.isConstructor()) {
          final ITypeBinding[] itb = imb.getParameterTypes();
          if (itb.length > paramNumber) {
            final ITypeBinding ithParamType = itb[paramNumber];
            if (ithParamType.isEqualTo(((Expression) ctorCall
                .arguments().get(paramNumber))
                .resolveTypeBinding())) {
              meth = (IMethod) imb.getJavaElement();
              break;
            }
View Full Code Here

     * Resolved the object/class receiving the call.
     */
    protected void resolveObjectIdentifier() {
        if (!isObjectIDResolved()) {
            if (((MethodInvocation) getASTNode()).getExpression() != null) {
                ITypeBinding lTBinding = ((MethodInvocation) getASTNode()).getExpression().resolveTypeBinding();
                String classID = "";
                // Why the additional check? Can we not use the jdt binding.
                // if ((lTBinding != null)
                // && lTBinding.toString().contains(((MethodInvocation) getASTNode()).getExpression().toString())) {
                // // System.err.println("ObjectID: " + getASTNode().toString());
View Full Code Here

    protected void resolveArguments() {
        for (Expression expression : getResolvedArguments().keySet()) {
            if (getResolvedArguments().get(expression).equals(AbstractASTNodeHandler.UNDEFINED_BINDING)) {
                String argumentType = AbstractASTNodeHandler.UNDEFINED_BINDING;

                ITypeBinding expressionBinding = expression.resolveTypeBinding();
                if (expressionBinding != null) {
                    argumentType =
                            getInvocationHandler().convertParameterTypeBindingForMethodSignature(expressionBinding);
                } else if (expression instanceof Name) {
                    // manually resolving the type of the argument
                    Name castedName = (Name) expression;
                    IBinding binding = castedName.resolveBinding();
                    if ((binding != null) && (binding.getKind() == IBinding.VARIABLE)) {
                        IVariableBinding varBinding = (IVariableBinding) binding;
                        ITypeBinding varTypeBinding = varBinding.getType();
                        argumentType = getInvocationHandler().convert(varTypeBinding);
                    }
                    if (argumentType.equals(AbstractASTNodeHandler.UNDEFINED_BINDING)) {
                        argumentType = resolveTypeBinding(expression);
                    }
View Full Code Here

        StringBuffer lMethodID = new StringBuffer();
        if (getMethodBinding() == null) {
            lMethodID.append(AbstractASTNodeHandler.UNDEFINED_BINDING);
            sLogger.warn("FamixMethod binding is null");
        } else {
            ITypeBinding lTypeBinding = getMethodBinding().getDeclaringClass();
            FamixClass lDeclaringClass = getClass(lTypeBinding, null, lTypeBinding.isAnonymous());

            lMethodID.append(lDeclaringClass.getUniqueName());
            lMethodID.append(AbstractFamixEntity.NAME_DELIMITER);
            if (getMethodBinding().isConstructor()) {
                lMethodID.append(AbstractFamixEntity.CONSTRUCTOR_PREFIX);
View Full Code Here

        return false;
    }

    private void initDataType() {
        if (getDataType() == null) {
            ITypeBinding pBinding = getASTNode().getType().resolveBinding();
            setDataType(getClass(pBinding, getASTNode().getType(), false));
            getModel().addElement(getDataType());
        }
    }
View Full Code Here

     */
    @Override
    protected void initDataType() {
        if (getDataType() == null) {
            IVariableBinding lVariableBinding = getASTNode().resolveBinding();
            ITypeBinding lTypeBinding = null;
            if (lVariableBinding != null) {
                lTypeBinding = lVariableBinding.getType();
            }
            FamixClass lDataType = getClass(lTypeBinding, getASTNode().getType(), false);
            lDataType = (FamixClass) getModel().addElement(lDataType);
View Full Code Here

    @Override
    public boolean visit(ASTNode castExpression) {
        boolean visitChildren = true;
       
        setASTNode(castExpression);
        ITypeBinding lBinding = getASTNode().resolveTypeBinding();

        try {
            FamixClass lClass = getClass(lBinding, getASTNode().getType(), false);
            lClass = (FamixClass) getModel().addElement(lClass);
            FamixAssociation castTo = getFactory().createCastTo(getCurrMethod(), lClass);
View Full Code Here

            } else {
                sLogger.warn("Parent of this variable declaration statement currently not supported " + getASTNode());
            }
        }

        ITypeBinding lTypeBinding = null;
        if (declType != null) {
            lTypeBinding = declType.resolveBinding();
        }
        FamixClass lDataType = getClass(lTypeBinding, declType, false);
        lDataType = (FamixClass) getModel().addElement(lDataType);
View Full Code Here

    /**
     * Computes and sets the return type class of a method declaration.
     */
    private void handleMethodReturnType() {
        if (!getASTNode().isConstructor()) {
            ITypeBinding returnTypeBinding = getASTNode().getReturnType2().resolveBinding();
            FamixClass lReturnType = getClass(returnTypeBinding, getASTNode().getReturnType2(), false);
            lReturnType = (FamixClass) getModel().addElement(lReturnType);
            getCurrMethod().setDeclaredReturnClass(lReturnType);
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.ITypeBinding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.