Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

eclipse: Surround block with if

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.

Upvotes: 9

Views: 3945

Answers (2)

Quincy
Quincy

Reputation: 4433

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

Upvotes: 19

Unni Kris
Unni Kris

Reputation: 3095

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.

Upvotes: 3

Related Questions