"Introduce constant" - combine with "Find All Usages" and suggest a replacement in *all* classes

When introducing a String constant with Ctrl+Alt+C I often need to make similar replacements in many other classes.
For example, I decide to replace "someStringValue" to a project-wide constant to be used in all classes.

So I suggest to add a "Find All Usages" checkbox in "Introduce Constant" dialog (Ctrl+Alt+C) which, when checked, will cause all other values in other classes to be replaced to the new constant just introduced.

I'm running Maia, 10597.

4 comments
Comment actions Permalink

Great idea. My suggestions:
1. To have a "Scope" combobox instead of a generic "Find All Usages" checkbox. "Current File" would be the default choice, to match the current default functionality.
2. Add a "Preview" button to "Introduce Constant" and "Introduce Variable" dialogs and allow me to preview and include/exclude the occurrences to be replaced. A lack of "Preview" functionality there has always been my personal favourite annoyance.

0
Comment actions Permalink

Please vote and hopefully it gets attention:

1. "Introduce constant" refactoring: add a scope selector to "Replace all occurrences"
http://www.jetbrains.net/jira/browse/IDEA-24059

2. (an ancient one!!!) Add "Preview changes" to the "Introduce Constant" refactoring
http://www.jetbrains.net/jira/browse/IDEABKL-265

0
Comment actions Permalink

Voted! Thanks for submitting the issues!

0

Please sign in to leave a comment.