Inside Eclipse Search we can do operations like search and then replace, this is known to any one who is aware of eclipse dev tool.
Here I would like to know the concept of using part of input search param into replace content as a variable.
Some use cases are:
#1) Replace a method call 1 to call2 which have different params but have one or two common Same might be achieved using refactoring concept of eclipse as well but here I would like do with search and replace functionality of eclipse.
#2) Change the import package from one to new one like log4j replace with commons logging
How to do replace dynamic behaviour in #1 case
Lets say you have method called sendMMS which takes Message object as parameter and you want to change the method to sendMMSAndLog which will take two parameters one is Message object and other is file location.
i.e. the methods like sendMMS(msg) --> sendMMSAndLog(msg,filePath) In such case just search for sendMMS\((.*)\) and then in replace text give as below sendMMSAndLog($1,filePath)
This kind of behaviour is also available in jedit as well.
Tuesday, January 10, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment