Exemple #1
0
  public Collection<AssignableNode> findFieldAsgnsOfSource(MethodNodeWrapper constructorNode) {
    ArrayList<AssignableNode> assignmentsFound = new ArrayList<AssignableNode>();

    Collection<Node> assignmentNodes =
        NodeProvider.getSubNodes(
            constructorNode.getWrappedNode(), LocalAsgnNode.class, InstAsgnNode.class);
    for (Node currentNode : assignmentNodes) {

      AssignableNode currentAssignment = (AssignableNode) currentNode;
      Node valueNode = currentAssignment.getValueNode();
      MethodCallNodeWrapper valueWrapper = new MethodCallNodeWrapper(valueNode);
      if (valueWrapper.getType() == MethodCallNodeWrapper.INVALID_TYPE) {
        continue;
      }

      if (valueWrapper.getName().equals("new")
          && valueWrapper.getReceiverNode() instanceof ConstNode
          && ((ConstNode) valueWrapper.getReceiverNode())
              .getName()
              .equals(sourceClass.getName())) { // $NON-NLS-1$
        assignmentsFound.add(currentAssignment);
      }
    }
    return assignmentsFound;
  }
 public DelegateMethodEditProvider(MoveMethodConfig config) {
   super(false);
   this.config = config;
   oldMethod = config.getMethodNode();
   scopePos = NodeProvider.unwrap(oldMethod.getBodyNode());
 }