8 Superb Eclipse IDE Editing Shortcuts

So a friend had asked me why some programmers use a text editor to write code and I told him, “so they can say ‘I use a text editor.'”.  Following our laughter, I suppose there’s some pride to coding completely on your own, but really, the notepads and gedits should stick with scripts and nothing greater. If you’re a “text editor” here are 8 reasons why you should switch to Eclipse and why we laughed. If you already use Eclipse, you’ll have no trouble incorporating these shortcuts and soon realize that you’re using them daily. Else if, download Eclipse.

[Editing Java Source Shortcuts]
Ctrl + Shift + M Add import(s).
Ctrl + Alt + P Go to matching bracket or parenthesis
Crtl + D Delete entire line of code.
Crtl + / Comment out all lines of code that are highlighted
Alt + Up Arrow Move the selected line of code up.
Alt + Down Arrow Move the selected line of code down.
Ctrl + I Indent lines of code
Ctrl + Shift + F Format highlighted lines of code or all if none selected.


Ctrl + Shift + M

Automatically add all imports.

So you gotta write a function with several objects needed. Your grocery lists starts growing: 2 containers, 1 generator and those special ingredients you care not to list. It’s easy to get sidetracked once you get going so keep typing away and import those classes automatically.

[Before]

conshiftm

[After]

conshiftm1


Ctrl + Alt + P

Go to matching bracket or parenthesis

Sometimes navigating in a sea of parentheses and brackets can be frustrating, especially if the other pair is many lines away.  To find and jump to the matching bracket/parenthesis, move the blinking cursor to the right of a bracket/parenthesis and use Ctrl + Alt + P.

[Before]

controlshiftp

[After]

controlshiftp1


Ctrl + D

Delete line

The speediest way to remove the current line, no highlighting required. Just trash that useless line, so what were you thinking when you wrote it?

[Before]

controld

[After]

controld1


Ctrl + /

Comment out highlighted lines of code

I’ve actually seen many people comment out numerous lines individually. They get into a nice rhythm, pressing the down arrow, left arrow and then //, over and over. So stop looking like you’re playing the drums on your keyboard and learn the easy way. Also if you want to remove the comments just use the shortcut again.

[Before]

ctrlslash

[Step 1: Highlight]

ctrlslash1

[After]

ctrlslash2


Alt + Up Arrow

Move selected line of code up

Yep, you think you’re cool because you can cut and paste a line faster than anyone else, but put down that Ctrl+X and Ctrl+V, the new kid on the block is Alt + Up.

[Before]

altup

[After]

altup1


Alt + Down Arrow

Move selected line of code down

What goes up must also come down, it’s true, here is the proof:

[Before]

altdown

[After]

altdown1


Ctrl + I

Indent lines of this type of block style

Training wheels off, you gotta write blocks the way they were meant to be written. The following lines contain the extreme case where the indention of all lines are messed up, most of the time you’ll have one or a couple of nested blocks you’ll want to whip back into place.

[Before]

controli

[Step 1: Highlight]

controli1

[After]

controli2


Ctrl + Shift + F

Format all lines of code

Whoa, look how nice that looks. You know you’re good when you use this shortcut and see nothing change.

[Before]

controlshiftf

[After]

controlshiftf1