Package org.eclipse.jdt.core.dom

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


        VariableDeclarationFragment fragment = ast
                .newVariableDeclarationFragment();
        fragment.setName(ast.newSimpleName(CHECKPOINT_RECORD_NAME));

        ClassInstanceCreation creation = ast.newClassInstanceCreation();
        String typeName = getClassName(CheckpointRecord.class, state, root);
        creation.setType(ast.newSimpleType(createName(ast, typeName)));
        fragment.setInitializer(creation);

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


                .newVariableDeclarationFragment();
        fragment.setName(ast.newSimpleName(recordName));

        // 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

     @return The expression that evaluates to a {@link Rollbackable} object
     *   at run-time.
     */
    private Expression _createRollbackableObject(AST ast, boolean isAnonymous) {
        if (isAnonymous) {
            ClassInstanceCreation proxy = ast.newClassInstanceCreation();
            proxy
                    .setType(ast.newSimpleType(ast
                            .newSimpleName(_getProxyName())));
            return proxy;
        } else {
            return ast.newThisExpression();
View Full Code Here

            MethodInvocation addInvocation = ast.newMethodInvocation();
            addInvocation.setExpression(ast.newSimpleName(CHECKPOINT_NAME));
            addInvocation.setName(ast.newSimpleName("addObject"));

            ClassInstanceCreation proxy = ast.newClassInstanceCreation();
            proxy
                    .setType(ast.newSimpleType(ast
                            .newSimpleName(_getProxyName())));
            addInvocation.arguments().add(proxy);
            body.statements().add(ast.newExpressionStatement(addInvocation));
            bodyDeclarations.add(initializer);
View Full Code Here

        MethodInvocation mi = (MethodInvocation) loc.getASTNode();
        Expression s=mi.getExpression();
        fullCalleeName = mi.getName().getFullyQualifiedName();
      }else
        if(loc.getASTNode() instanceof ClassInstanceCreation) {
            ClassInstanceCreation mi = (ClassInstanceCreation) loc.getASTNode();
        fullCalleeName = mi.getType().toString();
      }
       
        if(fullCalleeName != null) {
        if(SourceView.isSourceName(fullCalleeName)) {
          return display.getSystemColor(SWT.COLOR_DARK_RED);
View Full Code Here

        processExpression(arrAccess, ae.getArray(),  cu, resource, stack, monitor, HistoryDefinitionLocation.ARRAYACCESS,false);
     
    }
    else if(e instanceof ClassInstanceCreation)
    {
      ClassInstanceCreation c=(ClassInstanceCreation)e;
      HistoryDefinitionLocation cc;
      if(!first){
      cc= new HistoryDefinitionLocation(
          e.toString(),
          resource,
          cu.getLineNumber(e.getStartPosition()),
          e,
          parent, HistoryDefinitionLocation.CLASS_INSTANCE_CREATION);
      }else
        cc=parent;
      String aux=(c.getType()).toString();
      if(SinkView.isDerivationName(aux)){
        for(Object arg:c.arguments()){
          if(registerExpansion(cc))
          processExpression(cc,(Expression)arg,cu,resource,stack,monitor,HistoryDefinitionLocation.DERIVATION,false);
        }
    }
      }
View Full Code Here

          addHistoryEntry(dl);
          fContentProvider.addElement(dl);
          refresh();
        }
       else if(covering instanceof ClassInstanceCreation) {
         ClassInstanceCreation ae=(ClassInstanceCreation)covering;
         HistoryDefinitionLocation dl = new HistoryDefinitionLocation(
              ae.toString(),
              (IFile)resource,
              unit.getLineNumber(0),
              covering,null, HistoryDefinitionLocation.CLASS_INSTANCE_CREATION);
          processExpression(dl, ae, unit, resource, new LinkedList<MethodInvocation>(), monitor, HistoryDefinitionLocation.CALL,true);
          setCurrentInput(dl);
View Full Code Here

                                    if (argCount > 0) {
                                        arg = (Expression) mi.arguments().get(argumentNumber);
                                    }
                                   
                                } else if (expr instanceof ClassInstanceCreation) {
                                    ClassInstanceCreation ci = (ClassInstanceCreation) expr;
                                    argCount = ci.arguments().size();
                                    if (argCount > 0) {
                                        arg = (Expression) ci.arguments().get(argumentNumber);
                                    }
                                  
                                } else {
                                    logError("Can't match " + expr + " of type " + expr.getClass());
                                 
View Full Code Here

             
              ASTNode varDeclarationFragment = node.getParent();
              if (varDeclarationFragment instanceof VariableDeclarationFragment) {
                VariableDeclarationFragment vdf = (VariableDeclarationFragment) varDeclarationFragment;
               
                ClassInstanceCreation newClassInstanceCreation = vdf.getAST().newClassInstanceCreation();
                Type newType = JDTUtils.createQualifiedType(vdf.getAST(), toClass);
                newClassInstanceCreation.setType(newType);
                List arguments = newClassInstanceCreation.arguments();
                arguments.clear();
               
                MethodInvocation initializer = (MethodInvocation) vdf.getInitializer();
                List newArguments = ASTNode.copySubtrees(newClassInstanceCreation.getAST(), initializer.arguments());
                arguments.addAll(newArguments);
                 
                vdf.setInitializer(newClassInstanceCreation);
              }
            }
View Full Code Here

  public void throwNew(Class<? extends Exception> exceptionClass) {
    String simpleName = exceptionClass.getSimpleName();
    SimpleName exName = ast.newSimpleName(simpleName);

    SimpleType exType = ast.newSimpleType(exName);
    ClassInstanceCreation newExType = ast.newClassInstanceCreation();
    newExType.setType(exType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newExType);
    block.statements().add(statement);
  }
View Full Code Here

TOP

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

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.