Quantcast
Viewing all articles
Browse latest Browse all 426

Eclipse’s Awesome Block Selection Mode

This post is about an awesome Eclipse feature, that is completely underestimated and hidden in the menu. Yet, it is so useful in so many situations. The awesome “Block Selection Mode” which can be toggled through Alt-Shift-A on Windows. Here’s an example challenge for the Block Selection Mode:

Is there any way I can write (copy-paste) nicely-formatted SQL queries in Java string literals using Eclipse?

And my answer:

Step 1: Paste

Image may be NSFW.
Clik here to view.

Paste your formatted SQL statement verbatim into your Java file

Step 2: Write opening quotes

Image may be NSFW.
Clik here to view.

Notice the highlighted button, the sixth from the left. That’s the awesome “Block Selection Mode” (Alt-Shift-A on Windows). It lets you write opening quotes on each selected line at the same position

Step 3: Write closing quotes and concatenation

Image may be NSFW.
Clik here to view.

Apply the same technique for the closing quotes and the concatenation sign (`+`)

Step 4: Fix the semi-colon

Image may be NSFW.
Clik here to view.

No comment needed here.

Awesome Eclipse feature, no?


Filed under: java Tagged: Block Selection, Block Selection Mode, Eclipse, IDE, java, sql Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 426

Trending Articles