Package org.eclipse.jdt.core.dom

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


    }

    addImportToCompilationUnit(annotation.getCanonicalName(), cu);

    Annotation result = null;
    Name annotationTypeName = isClassImported(annotation.getCanonicalName(), cu) ? ast.newSimpleName(annotationType.getElementName()) : createQualifiedName(ast, annotationType.getFullyQualifiedName());

    if (properties != null) {
      result = ast.newNormalAnnotation();

      Method[] methods = annotation.getDeclaredMethods();
View Full Code Here


        .toTypeInfo(this);
  }

  @Override
  public ImportDeclaration newImportDeclaration(AST ast, Optional<String> name) {
    Name qualifier = ast.newName(this.name);
    SimpleName theName = ast.newSimpleName(name.or("*"));
    QualifiedName qualifiedName = ast.newQualifiedName(qualifier, theName);

    ImportDeclaration declaration = ast.newImportDeclaration();
    declaration.setName(qualifiedName);
View Full Code Here

  @Override
  public PackageDeclaration newPackageDeclaration(AST ast) {
    PackageDeclaration declaration = ast.newPackageDeclaration();

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

    return declaration;
  }
View Full Code Here

  @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

  private final ImportDeclaration ast;
  private final QualifiedName name;

  private ImportDeclarationWrapper(ImportDeclaration ast) {
    this.ast = ast;
    Name name = ast.getName();
    this.name = QualifiedName.class.cast(name);
  }
View Full Code Here

      ImportRewrite importRewrite, SimpleName name,
      String fullyQualifiedTypeName) {
    final RefactoringStatus status = new RefactoringStatus();

    // get the node to replace.
    final Name nodeToReplace = Util.getTopmostName(name);

    // If its in a case statement.
    if (Util.isContainedInCaseLabel(name)) {
      if (!nodeToReplace.isSimpleName()) // Need to remove prefix.
        astRewrite.replace(nodeToReplace, name, null);
      return status;
    }

    // Make a copy of the simple name.
View Full Code Here

      return;

    switch (node.getNodeType()) {
    case ASTNode.SIMPLE_NAME:
    case ASTNode.QUALIFIED_NAME: {
      final Name name = (Name) node;

      if (name.resolveBinding().getJavaElement() == null)
        throw new DefinitelyNotEnumerizableException(
            Messages.ASTNodeProcessor_NonEnumerizableTypeEncountered, node);
      else {
        final IJavaElement elem = name.resolveBinding()
            .getJavaElement();
        if (elem.isReadOnly() || name.resolveBoxing())
          throw new DefinitelyNotEnumerizableException(
              Messages.ASTNodeProcessor_SourceNotPresent, node);
        if (name.resolveTypeBinding().isEqualTo(
            node.getAST().resolveWellKnownType("java.lang.Object"))) //$NON-NLS-1$
          throw new NonEnumerizableASTException(
              Messages.ASTNodeProcessor_IllegalArrayUpcast, name);
        this.found.add(elem);
      }
View Full Code Here

                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);
                    }
View Full Code Here

      }
      else
      {
         if (!origin.requiresImport(typeName))
         {
            Name name = ast.newSimpleName(simpleName);
            type = ast.newSimpleType(name);
         }
         else
         {
            String[] className = Types.tokenizeClassName(typeName);
            Name name = ast.newName(className);
            type = ast.newSimpleType(name);
         }
      }
      field.setType(type);
      return this;
View Full Code Here

      }
      else
      {
         if (!origin.requiresImport(typeName))
         {
            Name name = ast.newSimpleName(simpleName);
            type = ast.newSimpleType(name);
         }
         else
         {
            String[] className = Types.tokenizeClassName(typeName);
            Name name = ast.newName(className);
            type = ast.newSimpleType(name);
         }
      }
      field.setType(type);
      return this;
View Full Code Here

TOP

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

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.