Examples of InfixExpression


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

        } else {
            rightHand = (Expression) ASTNode.copySubtree(ast, rightHand);

            if (isSpecial && type.getName().equals(String.class.getName())
                    && !type.equals(rightHandType)) {
                InfixExpression extraPlus = ast.newInfixExpression();
                extraPlus.setLeftOperand(ast.newStringLiteral());
                extraPlus.setOperator(InfixExpression.Operator.PLUS);
                extraPlus.setRightOperand(rightHand);
                rightHand = extraPlus;
            }
        }

        invocation.arguments().add(rightHand);
View Full Code Here

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

  boolean isStringContant(Expression arg) {
    if(arg instanceof StringLiteral) {
      return true;
    } else
    if(arg instanceof InfixExpression) {
      InfixExpression infixExpr = (InfixExpression) arg;
      if(!isStringContant(infixExpr.getLeftOperand())) return false;
      if(!isStringContant(infixExpr.getRightOperand())) return false;
           
      for(Iterator iter2 = infixExpr.extendedOperands().iterator(); iter2.hasNext(); ) {
        if(!isStringContant((Expression) iter2.next())) {
          return false;
        }
      }
      return true;
View Full Code Here

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

     */
    public static boolean isStringContant(Expression arg, CompilationUnit unit, IResource resource) {
        if (arg instanceof StringLiteral) {
            return true;
        } else if (arg instanceof InfixExpression) {
            InfixExpression infixExpr = (InfixExpression) arg;
            if (!isStringContant(infixExpr.getLeftOperand(), unit, resource)) return false;
            if (!isStringContant(infixExpr.getRightOperand(), unit, resource)) return false;
            for (Iterator iter2 = infixExpr.extendedOperands().iterator(); iter2.hasNext();) {
                if (!isStringContant((Expression) iter2.next(), unit, resource)) {
                    return false;
                }
            }
            return true;
View Full Code Here

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

    } else
//    if(arg instanceof SimpleName) {
//      // find out if the name is final...
//    } else
    if(arg instanceof InfixExpression) {
      InfixExpression infixExpr = (InfixExpression) arg;
      if(!isStringContant(infixExpr.getLeftOperand(), cu, resource)) return false;
      if(!isStringContant(infixExpr.getRightOperand(), cu, resource)) return false;
           
      for(Iterator iter2 = infixExpr.extendedOperands().iterator(); iter2.hasNext(); ) {
        if(!isStringContant((Expression) iter2.next(), cu, resource)) {
          return false;
        }
      }
      return true;
View Full Code Here

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

    } else
    if ( e instanceof InfixExpression && ( ((InfixExpression)e).getOperator() == InfixExpression.Operator.PLUS ) ) {
      /**
       * Follow arguments of a string concatenation.
       * */
      InfixExpression ie   = (InfixExpression) e;
      Expression leftExpr  = ie.getLeftOperand();
      Expression rightExpr = ie.getRightOperand();
      HistoryDefinitionLocation concatDL;
      if(!first){
      concatDL = new HistoryDefinitionLocation(
          e.toString(),
          resource,
          cu.getLineNumber(e.getStartPosition()),
          e,
          parent, HistoryDefinitionLocation.STRING_CONCAT);
      }
      else
      concatDL=parent;
     
      if(registerExpansion(concatDL)) {
        processExpression(concatDL, leftExpr,  cu, resource, stack, monitor, HistoryDefinitionLocation.COPY,false);
        processExpression(concatDL, rightExpr, cu, resource, stack, monitor, HistoryDefinitionLocation.COPY,false);
        if(ie.extendedOperands() != null) {
            for(Iterator iter = ie.extendedOperands().iterator(); iter.hasNext(); ) {
                Expression ext_e = (Expression) iter.next();
               
                processExpression(concatDL, ext_e, cu, resource, stack, monitor, HistoryDefinitionLocation.COPY,false);                     
            }
        }
View Full Code Here

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

     
      // finish the job       
      monitor.done();
      }
    else if(covering instanceof InfixExpression){
      InfixExpression infixExpr = (InfixExpression) covering;
      HistoryDefinitionLocation dl = new HistoryDefinitionLocation(
          infixExpr.toString(),
          (IFile)resource,
          unit.getLineNumber(0),
          covering,null, HistoryDefinitionLocation.STRING_CONCAT);
     
      processExpression(dl, infixExpr, unit, resource, new LinkedList<MethodInvocation>(), monitor, HistoryDefinitionLocation.INITIAL,true);
View Full Code Here

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

     */
    public static boolean isStringContant(Expression arg, CompilationUnit unit, IResource resource) {
        if (arg instanceof StringLiteral) {
            return true;
        } else if (arg instanceof InfixExpression) {
            InfixExpression infixExpr = (InfixExpression) arg;
            if (!isStringContant(infixExpr.getLeftOperand(), unit, resource)) return false;
            if (!isStringContant(infixExpr.getRightOperand(), unit, resource)) return false;
            for (Iterator iter2 = infixExpr.extendedOperands().iterator(); iter2.hasNext();) {
                if (!isStringContant((Expression) iter2.next(), unit, resource)) {
                    return false;
                }
            }
            return true;
View Full Code Here

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

  private void rewriteExpressions(CompilationUnit node, SearchMatch match,
      RefactoringStatus status, ASTRewrite astRewrite,
      ImportRewrite importRewrite) {
    final ASTNode result = NodeFinder.perform(node, match.getOffset(),
        match.getLength());
    final InfixExpression ie = Util.getInfixExpression(result);
    if (ie == null) // there is none.
      return;
    else if (Util.inNeedOfTransformation(ie.getOperator())) {
      // Get the fully qualified type name.
      final String fqn = this.getFullyQualifiedName(((Name) result)
          .resolveBinding().getJavaElement());
      this.rewriteInfixExpression(astRewrite, importRewrite, ie, fqn);
    }
View Full Code Here

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

      }
      break;
    }

    case ASTNode.INFIX_EXPRESSION: {
      final InfixExpression iexp = (InfixExpression) node;
      final InfixExpression.Operator op = iexp.getOperator();
      if (Util.isLegalInfixOperator(op)) {
        if (Util.inNeedOfTransformation(op)) {
          final ISourceRange range = new SourceRange(iexp
              .getStartPosition(), iexp.getLength());
          this.legalEncounteredInfixExpressionSourceLocations
              .add(range);
        }
        this.processExpression(iexp.getLeftOperand());
        this.processExpression(iexp.getRightOperand());
      }

      else if (!Util.isSuspiciousInfixOperator(op))
        throw new DefinitelyNotEnumerizableOperationException(
            Messages.ASTNodeProcessor_IllegalInfixExpression, op, node);
View Full Code Here

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

      }
      break;
    }

    case ASTNode.INFIX_EXPRESSION: {
      final InfixExpression ie = (InfixExpression) node;
      final InfixExpression.Operator op = ie.getOperator();
      if (Util.isLegalInfixOperator(op)) {
        if (Util.inNeedOfTransformation(op)) {
          final ISourceRange range = new SourceRange(ie
              .getStartPosition(), ie.getLength());
          this.legalEncounteredInfixExpressionSourceLocations
              .add(range);
        }
        this.processExpression(ie.getLeftOperand());
        this.processExpression(ie.getRightOperand());
      }

      else if (!Util.isSuspiciousInfixOperator(op))
        throw new DefinitelyNotEnumerizableOperationException(
            Messages.ASTNodeProcessor_IllegalInfixExpression, op, node);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.