Select the three lines and Shift+Right Click over the selection. Navigate to Insert Autotext: if(){...}
Check out the documentation for Autotext and in particular for $selected$. Scan the default entries for some ideas.
Pay careful attention to the fact an entry with $selected$ can be used with and without a selection. (The latter is invoked via shortcut and $selected$ is expanded to nothing.)