Structural Search and Replace question

I think SSR can do what I want to do but can't quite figure out how to accomplish it.

I am cleaning up a project I wrote a long time ago before I had a full grasp of log4j configuration. I have many many lines that look like:

Logger logger = ProjectLogger.getLogger();

I want to replace all of these lines with:

Logger logger = Logger.getLogger(.class); where ]]> is the name of the class the line of code is in.

Can SSR do this?

1 comment

Hi,
Unfortunately, you cannot do it right now with variable class name, just
on per class basis, or you can use replace pattern 'Logger logger =
Logger.getLogger(getClass());' if the pattern is appropriate.

Please, file JIRA request, this is important enhancement for SSR.

Michael Parmeley wrote:

I think SSR can do what I want to do but can't quite figure out how to accomplish it.

I am cleaning up a project I wrote a long time ago before I had a full grasp of log4j configuration. I have many many lines that look like:

Logger logger = ProjectLogger.getLogger();

I want to replace all of these lines with:

Logger logger = Logger.getLogger(<ClassName>.class);

where <ClassName> is the name of the class the line of code is in.

Can SSR do this?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.