#?description=Enumerate the IJavaIdentifiers (parameters, local vars) of IJavaMethod objects of a decompiled IJavaClass. Rename some identifiers. List all identifiers.
Enumerate the IJavaIdentifiers (parameters, local vars) of IJavaMethod objects of a decompiled IJavaClass. Rename some identifiers. List all identifiers
"""
classJavaListIdentifiers(IScript):
defrun(self, ctx):
prj=ctx.getMainProject()
assertprj, 'Need a project'
f=ctx.getFocusedFragment()
assertf, 'Need a focused fragment'
# assume a fragment is focused, assumed it is backed by an IUnit
unit=f.getUnit()
ifnotisinstance(unit, IJavaSourceUnit): return
# assume the unit is an IJavaSourceUnit
elt=unit.getASTElement()
ifnotisinstance(elt, IJavaClass): return
# 1) DEMO: rename some method identifiers
# enumerate all methods in the class (NOTE: nested classes are not enumerated, this is just a demo script)