EugeneP
EugeneP

Reputation: 12003

is there a key shortcut in Eclipse to copy the whole method body into buffer?

is there a key shortcut in Eclipse to copy the whole method body into buffer?

Upvotes: 6

Views: 5283

Answers (4)

VonC
VonC

Reputation: 1323293

Little know trick, use the folding feature:

If a method is folded, and if you select the folded line, you will actually copy the full body of said method.

http://img210.i_mageshack.us/img210/7209/eclipsecopymethod.png

If the Alt+Shift+Up does not work for large number of lines, this will.

Upvotes: 7

Nathan Adams
Nathan Adams

Reputation: 1255

If you just want to copy a code block (including a method body), double click to the right of the first curly brace, the whole block will become highlighted, then it's just a Control-C, Control-V thing :)

Upvotes: 0

Matthew Farwell
Matthew Farwell

Reputation: 61695

You can find a list of shortcuts in Eclipse by typing Ctrl+Shift+L.

While you are exploring this list, you will find Alt+Shift+Right which selects the next element. This may be what you are looking for.

Upvotes: 8

Ha.
Ha.

Reputation: 3454

You can press alt+shift+up several (5-10 if you start from empty selection) times to expand selection to include the whole method body.

Upvotes: 5

Related Questions