Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Get ASTNode for corresponding IVariableBinding?
Get ASTNode for corresponding IVariableBinding? [message #1727574] Thu, 24 March 2016 06:57 Go to next message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
Hi, I have a SimpleName and want to get its declaration.
IVariableBinding declBinding = simpleName.getVariableDeclaration();

resolves fine, but what's the next step? I tried to look on SearchEngine, but
declBinding.getJavaElement()
returns null

[Updated on: Thu, 24 March 2016 06:58]

Report message to a moderator

Re: Get ASTNode for corresponding IVariableBinding? [message #1727581 is a reply to message #1727574] Thu, 24 March 2016 08:02 Go to previous messageGo to next message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
I've found a solution with using
CompilationUnit.findDeclaringNode(...)


But it requires to use CompilationUnit of the class from
declBinding.getDeclaringClass()


It these another way without using corresponding CU? Thanks!

[Updated on: Thu, 24 March 2016 08:15]

Report message to a moderator

Re: Get ASTNode for corresponding IVariableBinding? [message #1729275 is a reply to message #1727581] Tue, 12 April 2016 13:47 Go to previous message
Noopur Gupta is currently offline Noopur GuptaFriend
Messages: 58
Registered: December 2012
Member
CompilationUnit.findDeclaringNode(IBinding) is the correct and only solution. The binding should correspond to a node in this CU. You can also get the CU using simpleName.getRoot().
Previous Topic:System Variable in VM argument
Next Topic:Help me write this plugin?
Goto Forum:
  


Current Time: Fri Apr 19 16:38:55 GMT 2024

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

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

Back to the top