Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse: Surround block with if

Tags:

java

eclipse

In eclipse we can surround a piece of code with try/catch. I want to surround a piece of code with if statement. Is there any shortcut key. Pressing Ctrl + 1 after selecting the block of code did not give me hint to surround with If.

like image 227
Muhammad Imran Tariq Avatar asked Nov 01 '12 06:11

Muhammad Imran Tariq


2 Answers

Highlight the block of code , press Alt+Shift+Z, then choose if (3).

like image 99
Quincy Avatar answered Oct 10 '22 17:10

Quincy


In Eclipse Galileo

  1. Select the code and right click on it
  2. Select the Surround with option from the context menu
  3. Choose if statement.
like image 24
Unni Kris Avatar answered Oct 10 '22 16:10

Unni Kris