IntelliJ IDEA 14.0.0 Web Help

Structural Search and Replace. Edit Variable Dialog

Edit | Find | Search Structurally | Edit variables


Use this dialog to define constraints for the variables of a search template.

Item Description
Variables This area shows a list of variables used in the current search template.
Text constraints In this area define the following constraints of the selected variable regarding text:
  • Text/regular expression - in this text box, type a perl-like expression or a class name to be used as a variable constraint. Basic code completion is available for class names.
  • Invert condition - select this check box to have the text pattern inverted.
  • Apply constraint within type hierarchy - select this check box to have the search according to the pattern performed both in type names and in parents (within the hierarchy).
  • Whole words only - when this check box is selected, only whole words within text are matched. This option recognizes string literals and comments.
Occurrences count In this area, define how pattern hits will be counted.
  • Minimum count - in this text box, type the minimum number of elements in the list.
  • Maximum count - in this text box, type the maximum number of elements in the list.
  • Unlimited - select this check box to allow unlimited number of elements in the list.
Expression constraints In this area, define how expressions should be processed.
  • Value is read - if this check box is selected, the matching variable is to be read.
  • Value is written - if this check box is selected, the matching variable is to be written.
  • Text/regular expression for java expression type - if the calculated variable is a java expression, this constraint checks its type. For instance, for the foo($a$) expression the type of the method parameter would be checked.
  • Text/regular expression for formal argument type of the method - if the calculated variable is a java expression in a method call, this constraint checks the parameter type. For instance, correspondence between the method parameter type (e.g. $a$) in method calls will be checked for methods like foo($a$).
  • Apply constraint within type hierarchy - select this check box to have the search according to the pattern performed both in type names and in parents (within the hierarchy).
  • Invert condition - select this check box to have the value of the corresponding check box changed to the opposite one.
Script constraints In this area, define a variable constraint via a script. Specify the script in the text box or click the browseButton button to open the Edit Groovy Script Constraint dialog box. The constraint is applied after the initial matching process is finished.
This variable is target of the search If this check box is selected, the search results will show not the entire expression but the selected variable(s) only.

See Also

Last modified: 4 December 2014
comments powered by Disqus