�� ������ �� ���������� �ſ� ������ ���� ��Ҹ� �̿��ϴ� ���� ����� �����ϴ� ���� �����ϴ� ������ �� ���� Usecases�� ������ �Ӹ� �ƴ϶� Structured
Search&Replace Ư¡, �� ���, ������ ����մϴ�.
Structured Search&Replace �� ����� �˻��ϴ� ���� �����ϰ� �ϰ�, �ʿ��ϴٸ� ������ ����Ͽ� �ڹ� �ڵ��� ������ ��ü�ϱ� ���� ����ϰ� �ִ� �ڹ�-�ν��� �ִ� �˻� �� ��ü ��Ŀ�����Դϴ�.
������ Structured
Search&Replace�� 2 ���̾�α׸� �����մϴ�. ù ��°�� ������ ����ϰ� �ִ� �ڹ� �ڵ� ������ �˻��ϴ� Structural Search �Դϴ�. �װ��� Search | Search
structurally �������ų� Ctrl
+ Shift + S ������ �ҷ��� �� �ֽ��ϴ�. �װ��� ���ϰ� �Բ� �ڹ� �ڵ带 ���� �˻��ϱ� ���� ���˴ϴ�.

�ٸ� ���� ������ ����ϰ� �ִ� �ڹ� �ڵ带 �˻��ϰ�, ��ü�ϴ� Structural Replace�Դϴ�. �װ��� Search |
Replace structurally�� �����ϰų� Ctrl + Shift + M�� ������ �ҷ����ϴ�.

���̾�α״� ������ ��Ʈ�� ������, Structured
Search&Replace�� ���� �ʿ��� �߰��� �Բ� ����� ���Դϴ�.
���̾�α��� �ֿ� �κ��� Search template�� Search
template/Replacement template �Դϴ�. �׵��� ��ġ�ϴ� ������ �˻��ϰų� ��ü�ϴ� �� ����ϴ� ���ø��� �����մϴ�. ������ Search ���ø��� Ŭ���� / �������̽� / ������Ʈ��Ʈ / ������Ʈ��Ʈ ��Ʈ / ǥ���� / �ڸ�Ʈ /Javadoc �ڸ�Ʈ ��� �������� ������ Replace ���ø��� �ڹ� �������� ��Ȯ�� ������ �Բ� ������Ʈ��Ʈ / ������Ʈ��Ʈ ��Ʈ / ǥ������ �Ǵ� ������ �����մϴ� . �׸��� ���ø� ���� � �̸��̶� ������ �Բ� ġȯ�� �� �ֽ��ϴ�. ������ $ ��ȣ ���� ������ �̸��Դϴ�. ���� ���, $Variable$ �Դϴ� . IDEA�� ������ ���ø��� �м��ϰ� ������ ��Ȯ�� �ڹ� ������ �����߸� �Ѵٶ�� ��Ȯ�� �˻� ����� ��� ���� �ڹ� �ν��� ������ ����մϴ�.

|
Replacement template �� Search template���� ���Ǵ� �������� ������ �� �ֽ��ϴ�.
|
���ø��� ���é¼, �� ���� ������ �̿��� �� �ֽ��ϴ�:
�޼ҵ� ����� ������ �� �ֽ��ϴ�.
���� � ���� �������� ǥ�õ��� ������, � ���� �����ڶ� ���� ���� ���Դϴ�.
���� �ʵ忡���Ӹ� �ƴ϶� ���ø����� ª�� Ŭ���� �̸�(����� �ڰ��� �־����� �� ��ſ�)�� ����Ͻʽÿ�.
���ø����μ� class
$Class$�� ����ϸé¼, �͸��� Ŭ������ �� �߰ߵ� ���Դϴ�.
�ڸ�Ʈ�� Javadoc�� ���� ���ø��� ��Ȯ�� �ڸ�Ʈ�� Javadoc ������ �Բ� ������ �����Ҹ� �����ؾ߸� �մϴ�.
IDEA�� ���� ���ø� ���̾�α׿� ����Ʈ �� �� ��Ʈ�� ����Ʈ ���ø��� �����ϴ�. ����ڴ� user defined �Ʒ� �ű⿡�� ���� �������� �ڱ� �ڽ��� ���ø��� ������ �� �ֽ��ϴ�.
�׵��� �߰��ߴ� ���ø��� ������ ���ø� â �Ʒ��� ��ġ�ϴ� 4���� ��ư�� ï¿½ï¿½ï¿½ï¿½Ï¸é¼ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ �� �ֽ��ϴ�.
Save template...
|
���� ��������, Save template ���̾�α׸� �θ��ʽÿ�.

Input template name �ؽ�Ʈ �ʵ忡 ���ϴ� ���ø� �̸��� �ٸ� ����� ������ ���ø��� �����ϱ� ���� �Է��Ͻʽÿ�.
|
Edit variables...
|
���ø� ������ ���� ������ �����ϴ� ���� ���� ���̾�α׸� �θ��ʽÿ�.
|
History...
|
Used Templates History ���̾�α׸� �θ��ʽÿ�.

����� �ְ� 25���� ���� ȣ��� ���ø��� �� �� �ֽ��ϴ�.
�װ��� �ٽ� �θ��� Template
preview �ؽ�Ʈ �ʵ忡�� ����� �ʿ��� �ϳ��� �����Ͻʽÿ�.
|
Copy
existing template...
|
���� ���� �Ǵ� ����� ���� ���ø��� �����ϰ� �Ǵ� �����ϵ��� Existing
Template�� �θ��ʽÿ�.

���̾�α״� �����ϴ� Ʈ�� �� ���� �Բ� ��ũ�� �� ���� �׷����� �������� ���� ������ ���ø��� �����մϴ� (expressions, operators, class-based, generics ��� ����).
���� ����� ������ ���ø��� �����ϱ� ���� Ư���� ���, user
defined�� �ֽ��ϴ�.
���ø��� �����ϸé¼, ����� Template
preview �ʵ忡�� �װ��� �� ���Դϴ�. Search template �Ǵ� Search/Replacement template �ؽ�Ʈ �ʵ忡�� ���ø��� �����ϱ� ����, OK �� �����ʽÿ�.

|
���� ����� ���ø� �׷��� ���̾�α� Ÿ��Ʋ �ٿ� ��Ÿ���ϴ�.
|
|
|
���̾�α״� Options �ɼ� �׷��� �����ϴ�.
Recursive matching
|
���� ���õǸ�, ��������� ��������� �����մϴ�. ������ �˻����� �̿��� �� �ִ�.
|
Case sensitive
|
���� ���õǸ�, �˻��� �����ϰ� �ִ� �빮�ڿ� �ҹ��ڴ� Ʋ���ϴ�.
|
Maximum matches
|
���� ���õǸ�, ������� �Ͽ��� ����� ���� ���� ��ġ�� ������ �� �ֵ��� �մϴ�.
����Ʈ��, �װ��� 1000�Դϴ�.
|
Shorten fully qualified
names
|
���� �ؽ�Ʈ�� ����� �ڰ��� �־����� Ŭ���� �̸��� ������ ��쿡 �� �ɼ��� ���� ���մϴ�.
���� üũ �ڽ��� ���õǸ�, IDEA�� ���� ������ �� �̸��� �ڵ������� ���� ���Դϴ�.
�׷��� ������, ����� �ڰ��� �־����� Ŭ���� �̸��� ���˴ϴ�.
Structured search and replace������ �̿��� �� �ִ�.
|
Format according to
style
|
���� IDEA�� ����� �ڵ� ��Ÿ�� ����(���� ����, ���� �ڵ� ��Ÿ�� �ɼ� �� ����)�� ���� Ȯ���Ű�� �Ǵ� �ڵ� �����׸�Ʈ�� �ڵ������� �������ϱ� �ٶ�� �� üũ �ڽ��� �����Ͻʽÿ�.
���� üũ �ڽ��� ���õ��� ������, �� �������� �״�� ���� �װ��� Ȯ���Ű�� �Ǵ� �ڵ忡�� IDEA�� ���� ��ġ�� ���� ��ü�� ���ø��� �鿩���� �� ���Դϴ�.
Structured search and replace������ �̿��� �� �ִ�.
|
|
Scope ���-�ٿ� ����� �˻�/��ü�� ������ �ϰ� �Ǵ� ������ ����� �����մϴ�. ���� ������ ������ �����ϰų� �Ǵ� ellipsis ��ư�� ���� �ҷ����� ���� ���� ���̾�α׸� ����Ͽ� ��� �ڽ��� ���� �����Ͻʽÿ�. ����� ���� ������ ���� ��Ͽ� ��Ÿ�� ���Դϴ�.
���̾�α׿��� ���ο� �˻� ����� ������ ���� ��ü�� ���̵���, �Ǵ� ���ο� ���� ���� ���̵� ���ο� �� üũ �ڽ����� ������ Open in
new tab üũ �ڽ��� �����Ͻʽÿ�.
Edit
���� ���̾�α�
|
���̾�α״� ����� ���ø����� ����� ���¸� ��� ������ ���ߴ� ���� �����ϰ� �մϴ�. ������ 3���� �ɼ� �׷����� �������ϴ�.

Text constraints�� ��Ģ���̰� ��(Perl)�� ���� ǥ���� ���·� �Ǵ� Ŭ���� �̸����μ� ������ �����Դϴ�.
Text/regular expression
|
�ް� ���� ǥ���� �Ǵ� Ŭ���� �̸��� ���� �������μ� ���DZ� ���� Ÿ�����Ͻʽÿ�.
Ŭ���� �̸��� ���� ����� �⺻ �ڵ� �ϼ��� �̿��� �� �ֽ��ϴ�.
|
Invert condition
|
���� ���õǸ�, �ؽ�Ʈ ������ ��ȯ��Ű�� �˴ϴ�.
|
Apply constraint within
type hierarchy
|
��� ������ Ÿ�� �̸��� �� �װ��� �ǹ̸� �����ϴ�. ���� ���õǸ�, ���� ��ġ�� ���� Ÿ�� �̸������� �ƴ϶� �θ𿡼�(���� ������) �˻��˴ϴ�.
|
Whole words only
|
���� ���õǸ�, �ؽ�Ʈ ���� ��ü�� �ܾ �˻��˴ϴ�.
�װ��� ���ڿ� ���ͷ��� �ڸ�Ʈ�� ���� �ǹ̸� �����ϴ�.
|
|
Occurrences count �� �󸶳� ���� ������ ���(�Ű� ����, ���� �Ǵ� ������Ʈ��Ʈ ��Ͽ�)�� ������ ������ �� �ִ� ���� �����մϴ�.
Minimum count
|
����� �ּ��� ��� ��.
|
Maximum count
|
����� �ִ����� ��� ��.
|
|

|
������ �ְų� �Ǵ� ���� ���� �����ϱ� ���ؼ� Minimum
count �� 0
�׸��� Maximum
count �� 1�� �����Ͻʽÿ�.
|
Expression constraints ���� ǥ������ ���� ������ �����մϴ�.
Value is read
|
���� ���õǸ�, ��ġ�ϰ� �ִ� ������ �����ϴ�.
|
Value is written
|
���� ���õǸ�, ��ġ�ϰ� �ִ� ������ �����ϴ�.
|
Text/regular expression
for java expression type
|
���� �ԷµǸ�, ǥ���� Ÿ���� �������� �˻��˴ϴ�.
|
Apply constraint within
type hierarchy
|
��� ������ Ÿ�� �̸��� �� �װ��� �ǹ̸� �����ϴ�. ���� ���õǸ�, ���� ��ġ�� ���� Ÿ�� �̸������� �ƴ϶� �θ𿡼�(���� ������) �˻��˴ϴ�.
|
Invert condition
|
���� ���õǸ�, �����ϴ� üũ �ڽ� ���� ��ȯ��Ű�� �˴ϴ�.
|
|
���� üũ(This
variable is target of the search) �� ���õǸ�, �˻� ����� ��ü ǥ������ �ƴϰ� ���õ� �������� ������ ���Դϴ�.

|
����
���� ������ ���� ���ø� ���̾�α׿�
���� �����մϴ�.
|
Search
patterns
1.
Elementary patterns:
$Statement$; pattern matches one statement. Increasing Occurrences
count | Maximum count to, for instance, 5, makes it to find
sequences having 1 to 5 statements.
$Instance$.$MethodCall$($Arguments$) pattern
matches method call expressions. We can specify that method call could be
absent by specifying that Occurrences count | Minimal count for the Instance variable
is set to zero. Also we could request finding method calls with 3 to 5
parameters by specifying Minimal count = 3, Maximum
count = 5 for the Argument variable.
2.
To search for all if
statements we could specify the following pattern:
if ($Expr$)
{
$ThenStatements$;
} else {
$ElseStatements$;
}
Occurrences count minimum and maximum values for the ThenStatements and ElseStatements variables are set to
0 and MaxIntValue,
respectively.
3.
Search in comments and/or string literals:
Consider one wants to find comments or literal containing 'foo'. Search
pattern would be like $SomethingWeWantToFind$ or "$SomethingWeWantToFind$".
Text pattern for "$SomethingWeWantToFind$" should
define comment / literal content of interest (for our example
.*foo.*).
In case one wants to find comments/string containing some particular words
(say, foo as word), then Whole words only option
for a variable constraint should be set. Text constraint contains word(s) one
want to find (foo for our example).
4.
More specific usages of class/interface
methods (fields), for instance, equals, etc. which are
accessed through descendants (e.g. searching equals called
from instances of BaseComponentClass type
descendants).
The pattern would be $Instance$.equals($Parameter$). The Instance variable
will have name of the java expression type set to short name of the class (BaseComponentClass), the Apply
constraint in type hierarchy option in the Expression
constraints group should be set as well.
5.
Let's consider finding all method
implementations (say, all methods named show in JComponent descendants):
The search query should be as follows:
class $Class$ extends $JComponent$
{
public
void $Show$();
}
Text constraint for the JComponent variable
should be JComponent, with
type hierarchy in the Text constraint group set to true. Text constraint for
the Show variable should be shown with the This variable is target of the search
option set to true (since we are looking for methods) as well. Class
members will be searched without regard to the order of members in the
classes being searched.
Replace
patterns
oReplacement
of empty length array creation with constant static ones.
The search pattern could be following:
new PsiElement[0]
And the replacement pattern:
PsiElement.EMPTY_ARRAY
oAdd try/catch/finally code.
The search pattern is $Statements$; where the Occurrences
count maximum value is Integer.MAX_VALUE.
The replacement pattern is the following:
try {
$Statements$;
} catch (Exception ex) {
}
To remove such code one needs to revert replace/search patterns.
|