Examples of newName()


Examples of org.eclipse.jdt.core.dom.AST.newName()

        }
       
        imports.removeAll(importsToBeRemoved);

        ImportDeclaration importDecl = ast.newImportDeclaration();
        importDecl.setName(ast.newName("com.google.gwt.user.client.rpc.AsyncCallback")); //$NON-NLS-1$
        astRoot.imports().add(importDecl);

        // Add Async to the name
        TypeDeclaration aRemoteService = (TypeDeclaration) astRoot.types().get(0);
        String remoteServiceAsyncName = aRemoteService.getName().getFullyQualifiedName()+"Async"; //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

            aMethod.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID));

            // Add AsyncCallback parameter
            SingleVariableDeclaration asyncCallbackParam = ast.newSingleVariableDeclaration();
            asyncCallbackParam.setName(ast.newSimpleName("callback")); //$NON-NLS-1$
            asyncCallbackParam.setType(ast.newSimpleType(ast.newName("AsyncCallback"))); //$NON-NLS-1$
            aMethod.parameters().add(asyncCallbackParam);
           
            // Remove throws
            aMethod.thrownExceptions().clear();
           
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

        Expression objExpr = createAnnotationPropertyValueExpression(cu, type.getComponentType(), object);
        ((ArrayInitializer) expression).expressions().add(objExpr);
      }
    } else if ((value instanceof String) && (type == Class.class)) {
      expression = ast.newTypeLiteral();
      SimpleType newSimpleType = ast.newSimpleType(ast.newName((String) value));
      ((TypeLiteral) expression).setType(newSimpleType);

      addImportToCompilationUnit((String) value, cu);
    } else if (value instanceof String) {
      expression = ast.newStringLiteral();
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

  @Override
  public void writeTo(CompilationUnit compilationUnit) {
    AST ast = compilationUnit.getAST();

    PackageDeclaration declaration = ast.newPackageDeclaration();
    Name theName = ast.newName(name);
    declaration.setName(theName);

    compilationUnit.setPackage(declaration);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

          if (o instanceof Annotation) {
            final Annotation anno = (Annotation) o;
            final String newName = importRewrite
                .addImport((String) annotationToQualifiedNameMap
                    .get(anno));
            anno.setTypeName(ast.newName(newName));
          }
        }
      }
      /*
       * TODO: Need to remove resulting unused imports, but I am unsure of
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

    // Make a copy of the simple name.
    final AST ast = name.getAST();
    final SimpleName nameCopy = (SimpleName) ASTNode.copySubtree(ast, name);

    final String typeName = importRewrite.addImport(fullyQualifiedTypeName);
    final QualifiedName newNameNode = ast.newQualifiedName(ast
        .newName(typeName), nameCopy);

    astRewrite.replace(nodeToReplace, newNameNode, null);
    return status;
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

                    tagIter.remove();
                  }
                } else if ("@wbp.gwt.Request".equals(tag.getTagName())) {
                  tagIter.remove();
                  addImport(serviceRoot, "com.google.gwt.http.client.Request");
                  methodDeclaration.setReturnType2(ast.newSimpleType(ast.newName("Request")));
                }
              }
              // remove empty JavaDoc
              if (tags.isEmpty()) {
                methodDeclaration.setJavadoc(null);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

          {
            addImport(serviceRoot, "com.google.gwt.user.client.rpc.AsyncCallback");
            // prepare "callback" type
            Type callbackType;
            {
              callbackType = ast.newSimpleType(ast.newName("AsyncCallback"));
              Type objectReturnType = getObjectType(returnType);
              ParameterizedType parameterizedType = ast.newParameterizedType(callbackType);
              DomGenerics.typeArguments(parameterizedType).add(objectReturnType);
              callbackType = parameterizedType;
            }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

        return;
      }
    }
    // add new ImportDeclaration
    ImportDeclaration importDeclaration = ast.newImportDeclaration();
    importDeclaration.setName(ast.newName(qualifiedName));
    imports.add(importDeclaration);
  }

  /**
   * Keeps Async interfaces for services and remove other interfaces.
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newName()

    }
    else group = model;
    // 2°) Second step, we build a rewriter from the compilation unit
    AST ast = u.getAST();
    ImportDeclaration id = ast.newImportDeclaration();
    id.setName(ast.newName(new String[] {"java", "util", "Set"}));
    ASTRewrite rewriter = ASTRewrite.create(ast);
    // 3°) Third step, we can process the type declaration
    if(t.isInterface()) {
      result = new InterfaceService(t, group, rewriter, u);
    }
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.