Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Test and Performance Tools Platform (TPTP) » How to get the type of the class being analyzed?
How to get the type of the class being analyzed? [message #115802] Wed, 17 October 2007 10:21 Go to next message
Eclipse User
Originally posted by: saorf.de.ibm.com

I start with this:

CodeReviewResource resource =
(CodeReviewResource)getProvider().getProperty(history.getHis toryId(),
CodeReviewProvider.RESOURCE_PROPERTY);

List typeDeclarations =
resource.getTypedNodeList(resource.getResourceCompUnit(),
ASTNode.TYPE_DECLARATION);

How can I get the type, the whole tree represents? If I say
typeDeclarations.get(0).getClass(), I get the type TypeDeclaration.

That makes sence.

But how can I get the type of the class I analyze (Is there a special
expression describing this type?)?
Re: How to get the type of the class being analyzed? [message #115909 is a reply to message #115802] Thu, 18 October 2007 05:07 Go to previous messageGo to next message
Eclipse User
Originally posted by: s_gutz.ca.ibm.com

Once you get the type declaration you can resolve it to a binding.

TypeBinding binding = td.resolveTypeBinding();

Note that you should always check the returned value for null before
using it and fail gracefully. Do this because it is possible that the
code you are analyzing doesn't actually compile.

Steve


Sascha Orf wrote:
> I start with this:
>
> CodeReviewResource resource =
> (CodeReviewResource)getProvider().getProperty(history.getHis toryId(),
> CodeReviewProvider.RESOURCE_PROPERTY);
>
> List typeDeclarations =
> resource.getTypedNodeList(resource.getResourceCompUnit(),
> ASTNode.TYPE_DECLARATION);
>
> How can I get the type, the whole tree represents? If I say
> typeDeclarations.get(0).getClass(), I get the type TypeDeclaration.
>
> That makes sence.
>
> But how can I get the type of the class I analyze (Is there a special
> expression describing this type?)?
>
Re: How to get the type of the class being analyzed? [message #116036 is a reply to message #115909] Fri, 19 October 2007 09:45 Go to previous message
Eclipse User
Originally posted by: saorf.de.ibm.com

Thanks for that!

After some short tries I think that brings me further!

:-)
Previous Topic:Problem with ModifierRuleFilter and Interfaces
Next Topic:Problems with Integrated Agent Controller
Goto Forum:
  


Current Time: Wed Jul 23 06:00:27 EDT 2014

Powered by FUDForum. Page generated in 0.01568 seconds