Package org.eclipse.jdt.core.dom

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


     * @return
     */
    private MethodInvocation invokeClone(CompilationUnit workingUnit, SimpleName original) {
        MethodInvocation cloneInvoke = workingUnit.getAST().newMethodInvocation();
        Expression cloneField = (SimpleName) ASTNode.copySubtree(cloneInvoke.getAST(), original);
        SimpleName cloneName = workingUnit.getAST().newSimpleName("clone");
        cloneInvoke.setExpression(cloneField);
        cloneInvoke.setName(cloneName);
        return cloneInvoke;
    }
View Full Code Here


      if (!packg.isEmpty())
      {
         getOrigin().addImport(type);
      }

      SimpleName simpleName = method.getAST().newSimpleName(name);

      List list = (List) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
      list.add(simpleName);

      return this;
View Full Code Here

   }

   @Override
   public String getName()
   {
      SimpleName name = param.getName();
      if (name != null)
      {
         return name.toString();
      }
      return "";
   }
View Full Code Here

        this.createdNode = (ASTNode) bodyDeclarations.iterator().next();
        createdNodeSource = this.source;
      }
    }
    if (this.alteredName != null) {
      SimpleName newName = this.createdNode.getAST().newSimpleName(this.alteredName);
      SimpleName oldName = rename(this.createdNode, newName);
      int nameStart = oldName.getStartPosition();
      int nameEnd = nameStart + oldName.getLength();
      StringBuffer newSource = new StringBuffer();
      if (this.source.equals(createdNodeSource)) {
        newSource.append(createdNodeSource.substring(0, nameStart));
        newSource.append(this.alteredName);
        newSource.append(createdNodeSource.substring(nameEnd));
View Full Code Here

  if (this.alteredName != null) return this.alteredName;
  return getFragment(this.createdNode).getName().getIdentifier();
}
protected SimpleName rename(ASTNode node, SimpleName newName) {
  VariableDeclarationFragment fragment = getFragment(node);
  SimpleName oldName = fragment.getName();
  fragment.setName(newName);
  return oldName;
}
View Full Code Here

   }

   @Override
   public String getName()
   {
      SimpleName name = param.getName();
      if (name != null)
      {
         return name.toString();
      }
      return "";
   }
View Full Code Here

      if (!packg.isEmpty())
      {
         getOrigin().addImport(type);
      }

      SimpleName simpleName = method.getAST().newSimpleName(name);

      List list = (List) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY);
      list.add(method.getAST().newSimpleType(simpleName));

      return this;
View Full Code Here

              while (bodyDeclarations.hasNext()) {
                Object bodyDeclaration = bodyDeclarations.next();
                if (bodyDeclaration instanceof MethodDeclaration) {
                  MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
                  if (methodDeclaration.isConstructor()) {
                    SimpleName methodName = methodDeclaration.getName();
                    if (methodName.getIdentifier().equals(oldTypeName)) {
                      rewriter.replace(methodName, ast.newSimpleName(newTypeName), null);
                    }
                  }
                }
              }
View Full Code Here

  private ASTNode createNode(AST ast) {
    TagElement tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_SEE);
    MethodRef method = ast.newMethodRef();
    tag.fragments().add(method);
    SimpleName name = ast.newSimpleName("Test");
    method.setQualifier(ast.newQualifiedName(ast.newQualifiedName(ast.newName("org"), ast.newSimpleName("junit")), name));
    name = ast.newSimpleName("setUp");
    method.setName(name);
    return tag;
  }
View Full Code Here

        TagElement tag = ast.newTagElement();
        tag.setTagName(TagElement.TAG_SEE);
        doc.tags().add(tag);
        MethodRef method = ast.newMethodRef();
        tag.fragments().add(method);
        SimpleName name = ast.newSimpleName("Test");
        method.setQualifier(ast.newQualifiedName(ast.newQualifiedName(ast.newName("org"), ast.newSimpleName("junit")), name));
        name = ast.newSimpleName("test");
        method.setName(name);
        return super.visit(doc);
      }
View Full Code Here

TOP

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

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.