Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Class of the qualifier in an QualifiedName ASTNode
Class of the qualifier in an QualifiedName ASTNode [message #158391] Wed, 12 May 2004 07:57 Go to next message
Eclipse UserFriend
Originally posted by: creremoi.aol.com

hello.

I go through a compilation unit with an ASTVisitor and I when I find a
QualifiedName, I want to know the class of the qualifier.

For example if I have in a file :
class A{
int i;
}

and in another file :
class B{
void foo(){
A a = new A();
a.i = 0;
}
}

when I visit the QualifiedName node "a.i", how can I test if 'a' is an
object of the class A ?
Re: Class of the qualifier in an QualifiedName ASTNode [message #158425 is a reply to message #158391] Wed, 12 May 2004 10:07 Go to previous message
Eclipse UserFriend
Originally posted by: olivier_thomannNO.ca.ibm.comSPAM

Le Wed, 12 May 2004 13:57:41 +0200, "Satch" <creremoi@aol.com> a
écrit:
>when I visit the QualifiedName node "a.i", how can I test if 'a' is an
>object of the class A ?
You need to resolve the bindings when creating the DOM/AST.
You can get the qualifier ("a") and asked it resolveTypeBinding().
Then you can check that the ITypeBinding.getQualifiedName() is equals
to "A". This works if the project is well set up and A can be
retrieved when resolving the bindings for B.
--
Olivier
Previous Topic:Changed Listener - how to distinguish changes in ElementChangedEvent
Next Topic:CVS Compare greyed out in Resource History
Goto Forum:
  


Current Time: Wed Jun 04 11:45:51 EDT 2025

Powered by FUDForum. Page generated in 0.03685 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top