title: JDT - AstParser - Get the list of methods which were called for a specific object
body: <p>For example, I have the code like</p>
  
  <pre><code>SomeObject1 obj1 = new SomeObject1();
  SomeObject2 obj2 = new SomeObject2();
  ...
  obj1.foo();
  obj1.boo();
  ...
  obj2.foo2();
  obj2.boo2();
  </code></pre>
  
  <p>And I want to get the next output:</p>
  
  <blockquote>
    <p>Type: SomeObject1</p>
    
    <p>Name: obj1</p>
    
    <p>Called methods: foo, boo</p>
    
    <p>==========</p>
    
    <p>Type: SomeObject2</p>
    
    <p>Name: obj2</p>
    
    <p>Called methods: foo2, boo2</p>
  </blockquote>
  
  <p>thanks</p>
  
  <p>UPD:
  I have made a code</p>
  
  <pre><code>public boolean visit(VariableDeclarationFragment v)
  {
      System.out.println("Declaration of " + v.getName().resolveBinding().getKey());
      return true;
  }
  
  public boolean visit(MethodInvocation inv)
  {               
      Expression e = inv.getExpression();
  
      if(e instanceof Name)
      {
          Name n = (Name) e;
          System.out.println("Calling the method \"" + inv.getName().getFullyQualifiedName() + "\" for " + n.resolveBinding().getKey());
      }
      return true;
  }
  </code></pre>
  
  <blockquote>
    <p>Declaration of Ltest/C:\Test\src\Test~Test;.abc)I</p>
    
    <p>Declaration of Ltest/C:\Test\src\Test~Test;.method()V#a</p>
    
    <p>Declaration of Ltest/C:\Test\src\Test~Test;.method()V#url</p>
    
    <p>Calling the method "replace" for Ltest/C:\Test\src\Test~Test;.method()V#url</p>
  </blockquote>
  
  <p>For the test code:</p>
  
  <pre><code>package test;
  
  public class Test
  {
      private int abc;
      public void method()
      {
          int a;
          String url = "ftp://fdh/sdcard/dfsgh";
          url.replace("'", ".");
      }
  }
  </code></pre>
  
  <p>The last two keys are equal, that means I have found the appropriate declaration. And it's easy to get types of variables, I won't post this</p>