±¸Á¶È­µÈ °Ë»ö ¹× ±³Ã¼

 

ÀÌ ¼½¼ÇÀº ÀÌ º¹ÀâÇÏÁö¸¸ ¸Å¿ì °­·ÂÇÑ ±¸¼º ¿ä¼Ò¸¦ ÀÌ¿ëÇÏ´Â °ÍÀ» ´ç½ÅÀÌ ½ÃÀÛÇÏ´Â °ÍÀ» Áö¿øÇÏ´Â À¯¿ëÇÑ ¸î °³ÀÇ 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  

ÆÞ°ú °°Àº Ç¥Çö½Ä ¶Ç´Â Ŭ·¡½º À̸§À» °¡º¯ Á¦¾àÀ¸·Î¼­ »ç¿ëµÇ±â À§ÇØ Å¸ÀÌÇÁÇϽʽÿÀ.  Å¬·¡½º À̸§À» À§ÇØ ´ç½ÅÀº ±âº» ÄÚµå ¿Ï¼ºÀ» ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.

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) ÀÌ ¼±ÅõǸé, °Ë»ö °á°ú´Â Àüü Ç¥Çö½ÄÀÌ ¾Æ´Ï°í ¼±ÅÃµÈ º¯¼ö¸¸ÀÌ º¸¿©Áú °ÍÀÔ´Ï´Ù.

Usecases  

 


´ëºÎºÐÀÇ ÁúÀÇ ÆÐÅÏÀº ±âÁ¸ ÅÛÇø´ ´ÙÀ̾ó·Î±×¿¡ ¹ú½á Á¸ÀçÇÕ´Ï´Ù.


*   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.