Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ClassInstanceCreation.arguments()


    public NewInstanceBuilder newInstanceFromString(String type, String value) {
        ClassInstanceCreation create = getAST().newClassInstanceCreation();
        create.setType(createType(type));
        StringLiteral literal = getAST().newStringLiteral();
        literal.setLiteralValue(value);
        create.arguments().add(literal);
        return new NewInstanceBuilder(this, create);
    }

    /**
     * Build new instance creator of a simple type using a constructor that takes a pair of string values.
View Full Code Here


    public NewInstanceBuilder newInstanceFromStrings(String type, String value1, String value2) {
        ClassInstanceCreation create = getAST().newClassInstanceCreation();
        create.setType(createType(type));
        StringLiteral literal = getAST().newStringLiteral();
        literal.setLiteralValue(value1);
        create.arguments().add(literal);
        literal = getAST().newStringLiteral();
        literal.setLiteralValue(value2);
        create.arguments().add(literal);
        return new NewInstanceBuilder(this, create);
    }
View Full Code Here

        StringLiteral literal = getAST().newStringLiteral();
        literal.setLiteralValue(value1);
        create.arguments().add(literal);
        literal = getAST().newStringLiteral();
        literal.setLiteralValue(value2);
        create.arguments().add(literal);
        return new NewInstanceBuilder(this, create);
    }

    /**
     * Add field declaration.
View Full Code Here

     */
    public void addThrowException(String type, String text) {
        ThrowStatement thrwstmt = m_ast.newThrowStatement();
        ClassInstanceCreation exexpr = m_ast.newClassInstanceCreation();
        exexpr.setType(m_ast.newSimpleType(m_ast.newSimpleName(type)));
        exexpr.arguments().add(stringLiteral(text));
        thrwstmt.setExpression(exexpr);
        m_block.statements().add(thrwstmt);
    }
   
    /**
 
View Full Code Here

     */
    public void addThrowException(String type, ExpressionBuilderBase expr) {
        ThrowStatement thrwstmt = m_ast.newThrowStatement();
        ClassInstanceCreation exexpr = m_ast.newClassInstanceCreation();
        exexpr.setType(m_ast.newSimpleType(m_ast.newSimpleName(type)));
        exexpr.arguments().add(expr.getExpression());
        thrwstmt.setExpression(exexpr);
        m_block.statements().add(thrwstmt);
    }
   
    /**
 
View Full Code Here

  private Icon parseIcon(Icon oldValue, Expression arg) {
    if (oldValue != null && !(oldValue instanceof ResourceIcon)) {
      Icon icon = (Icon) oldValue;
      if (arg instanceof ClassInstanceCreation) {
        ClassInstanceCreation instanceCreation = (ClassInstanceCreation) arg;
        List args = instanceCreation.arguments();
        arg = (Expression) args.get(0);
        if (arg instanceof MethodInvocation) {
          MethodInvocation mi = (MethodInvocation) arg;
          args = mi.arguments();
          arg = (Expression) args.get(0);
View Full Code Here

        } else {
          Type typeName = cic.getType();
          if (typeName instanceof SimpleType) {
            SimpleType simpleType = (SimpleType) typeName;
            className = simpleType.getName().getFullyQualifiedName();
            List args = cic.arguments();
            if (args != null && args.size() > 0) {
              StringBuilder builder = new StringBuilder();
              for (int i = 0; i < args.size(); i++) {
                Object para = args.get(i);
                if (i != 0)
View Full Code Here

    if (oldValue != null && !(oldValue instanceof ResourceIcon)) {
      Icon icon = (Icon) oldValue;
      Expression arg = (Expression) args.get(0);
      if (arg instanceof ClassInstanceCreation) {
        ClassInstanceCreation instanceCreation = (ClassInstanceCreation) arg;
        args = instanceCreation.arguments();
        arg = (Expression) args.get(0);
        if (arg instanceof MethodInvocation) {
          MethodInvocation mi = (MethodInvocation) arg;
          args = mi.arguments();
          arg = (Expression) args.get(0);
View Full Code Here

        fragment.setName(ast.newSimpleName(CHECKPOINT_NAME));

        ClassInstanceCreation checkpoint = ast.newClassInstanceCreation();
        String typeName = getClassName(Checkpoint.class, state, root);
        checkpoint.setType(ast.newSimpleType(createName(ast, typeName)));
        checkpoint.arguments().add(ast.newThisExpression());
        fragment.setInitializer(checkpoint);

        FieldDeclaration checkpointField = ast.newFieldDeclaration(fragment);
        checkpointField.setType(createType(ast, typeName));
View Full Code Here

        // Create the initializer, and use the number of dimensions as its
        // argument.
        ClassInstanceCreation initializer = ast.newClassInstanceCreation();
        initializer.setType(ast.newSimpleType(createName(ast, typeName)));
        initializer.arguments().add(
                ast.newNumberLiteral(Integer.toString(dimensions)));
        fragment.setInitializer(initializer);

        // The field declaration.
        FieldDeclaration field = ast.newFieldDeclaration(fragment);
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.