Aravind Reddy Ayuluri Aravind Reddy Ayuluri -3 years ago 85
Java Question

how to get index of a node in ListRewrite of Eclipse JDT

I am using Eclipse JDT to modify the AST of a source code. I want to modify a

node. For that, I visited that using
and made changes. Now I removed the past node and am trying to add the new one at the same place using
method. For that I want to get the index of the node before removing it. How can I get the index?

Answer Source

Why not call ListRewrite.replace() instead of first removing then adding?

If that doesn't serve your purpose for some reason, try listRewrite.getOriginalList().indexOf(oldNode).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download