IntelliJ IDEA 14.0.3 Help

Structural Search and Replace Dialogs

Edit | Find | Search Structurally
StructuralSearchPlugin.StructuralSearchAction

Edit | Find | Replace Structurally
StructuralSearchPlugin.StructuralReplaceAction

Use these dialog boxes to find and replace fragments of code that structurally match the suggested search template.

Item Description Available in
Search template Use this text area to specify the template to be sought for. You can type the template code in the field or click the Copy existing template button to use one of the existing templates. Both
Replacement template Use this text area to specify the template to be substituted. You can type the template code in the field or click the Copy existing template button to use one of the existing templates. Structural Replace
Save template Click this button to open the Save Template dialog box, where you have to specify the name of the new template. Note that the new template is stored under the User Defined node of the existing templates tree view. Both
Edit variables Calls the Edit variables dialog box to set constraints for template variables. Both
History Click this button to open the History dialog box, that shows up to 25 last invoked templates. Both
Copy existing template Click this button to open the Existing Templates dialog box, where you can select one of the pre-defined or custom templates. Selected template is displayed in the Preview field. Clicking OK in the Existing Templates dialog box inserts the source code of the template into the Search template or Replace template field. Both
Recursive matching If this check box is selected, the search is performed recursively in the results. Structural Search
Case sensitive If this check box is selected, the search discerns lower and upper case letters. Both
File type Select file type from the drop-down list. Both
Shorten fully qualified names This option makes sense in case the template text contains fully qualified class names. If the check box is selected, IntelliJ IDEA automatically reduces these names in the template. Otherwise, fully qualified class names are used. Structural Replace
Reformat according to style Check this option, if you want IntelliJ IDEA to automatically reformat the expanded code fragment according to your code style settings (for details, refer to the Code Style dialog box). If the option is not checked, IntelliJ IDEA will only indent the whole template according to the position in code at which it is expanded, leaving its formatting as is. Structural Replace
Use static import if possible Check this option, if you want IntelliJ IDEA to shorten any references to static elements in the replaced code. IntelliJ IDEA will insert a static import for those elements. The elements are then referenced by their short name. If there are no references to static elements in the replaced code, the option will be ignored. Structural Replace
Scope Select one of the existing scopes from the drop-down list or click the ellipsis button (alternatively, press Shift+Enter), and create your own scope in the Scopes dialog box. Both
Open in new tab If this check box is selected, the results of the new search display in a new tab in the Find results tool window. Otherwise, the search results update the existing tab. Both

See Also

Last modified: 3 February 2015
comments powered by Disqus