Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » MethodInvocation Node
MethodInvocation Node [message #238526] Fri, 01 December 2006 16:16 Go to next message
Eclipse UserFriend
Originally posted by: jeffmancanada.yahoo.ca

Hi,

If I have an ASTNode of type MethodInvocation, what is the easiest way to
get the name of the object we are invoking a method on (i.e.: how to get
the name object3)?

Ex: object3.someMethod(p1, p2);

Thanks,
~Jeff
Re: MethodInvocation Node [message #238532 is a reply to message #238526] Fri, 01 December 2006 17:43 Go to previous message
Eclipse UserFriend
Jeff wrote:

> If I have an ASTNode of type MethodInvocation, what is the easiest way
> to get the name of the object we are invoking a method on (i.e.: how to
> get the name object3)?
>
> Ex: object3.someMethod(p1, p2);

Expression expression = invocation.getExpression();
if (expression instanceof SimpleName) {
System.out.println(((SimpleName)expression).getIdentifier()) ;
} else {
System.out.println("Not a name.");
}
Previous Topic:Unable to see line numbers / editor image for editor backed with IStorageEditorInput
Next Topic:Programmatically fire IAction
Goto Forum:
  


Current Time: Sat May 10 09:11:09 EDT 2025

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

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

Back to the top