Package org.eclipse.jdt.core.dom

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


   *
   * @param declaration
   * @param includingModifiers - whether to include modifiers in the offset and length.
   */
  public final static OffsetAndLength calculateOffset(SingleVariableDeclaration declaration) {
    SimpleName methodName = declaration.getName();
    return new OffsetAndLength(methodName.getStartPosition(), methodName.getLength());
  }
View Full Code Here


            return newTypeLiteral;
        }
        if (value instanceof AstUtils.QualifiedNameValue) {
            AstUtils.QualifiedNameValue enumMember = (AstUtils.QualifiedNameValue)value;
            Name enumTypeName = ast.newName(enumMember.getName());
            SimpleName enumMemberName = ast.newSimpleName(enumMember.getIdentifier());
            return ast.newQualifiedName(enumTypeName, enumMemberName);
        }
    return ast.newNullLiteral();
  }
View Full Code Here

    public MatchResult compare() {
      //map argument variables
      for(Object param: cfg.getCodeFragment().parameters()){
        SingleVariableDeclaration var = (SingleVariableDeclaration) param;
        SimpleName name = var.getName();
        Variable result = EvaluationUtils.tryGetVariable(name);
        if (result == null)
          throw new RuntimeException("Not a proper variable!!: '" + var + "'");
        variablesMap.put(name.toString(), result);
      }
      MatchResult result = compare(commentCfg.graph.getInput(), cfg.getInput().singleEdges[0]);
      org.junit.Assert.assertTrue("Invalid number of vertices", result.getVerticesCount() <= cfg.size());
      return result;
    }
View Full Code Here

    if (javaName.isQualifiedName()) {
      final QualifiedName qualifiedName = (QualifiedName) javaName;
      tokens.addAll(new NameInfo(qualifiedName.getQualifier()).tokenize());
      tokens.add(qualifiedName.getName().getIdentifier());
    } else if (javaName.isSimpleName()) {
      final SimpleName simpleName = (SimpleName) javaName;
      tokens.add(simpleName.getIdentifier());
    } else {
      throw new IllegalStateException("Unsupported name: " + javaName);
    }
    return tokens;
  }
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

              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

public String getMainTaskName(){
  return Messages.operation_createMethodProgress;
}
protected SimpleName rename(ASTNode node, SimpleName newName) {
  MethodDeclaration method = (MethodDeclaration) node;
  SimpleName oldName = method.getName();
  method.setName(newName);
  return oldName;
}
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

        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 (!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

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.