The PDOM does not store the AST. It only contains
IASTNames and IBindings and ITypes. You would need to recreate the AST for the
file and walk it to find the right name given the file location stored in the
PDOMName.
From:
cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Neeraj U Bhope
Sent: Tuesday, September 05, 2006
4:21 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Finding
references using PDOM and then finding the AST elements that contain the
reference..
Given a PDOMBinding one can use
PDOMBinding.getFirstReference() to get the references. The reference returned
is of the type PDOMName. Is there a way to find what place in the AST this
PDOMName lies in?
e.g.
class
A {};
class
B {
A myA;
};
Can
I find out where in the AST the reference to A lies in the class B which in
this case is in a field declaration in the enclosing class B.. I tried using
PDOMName.getParent() PDOMName.getPropertyInParent() to see if I could get what
I wanted, but it turned out that they are currently not implemented.
Thanks,
--
neeraj