Bug 533485 - [quick assist] Quick Assists for duplicating method
Summary: [quick assist] Quick Assists for duplicating method
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-12 03:39 EDT by Lars Vogel CLA
Modified: 2022-03-04 19:15 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2018-04-12 03:39:59 EDT
For writing tests and examples, I would find it handy if I could duplicate a method via a quick assits.

Example:

1.) Place cursor on the method
2.) Ctrl+1 -> Duplicate method
3.) New method is created with a new unique name and the method name can be adjusted.
Comment 1 Dani Megert CLA 2018-04-16 08:42:41 EDT
Note that you can copy&paste a method via views.
Comment 2 Dirk Steinkamp CLA 2022-03-04 19:15:22 EST
Suggestion for a workaround:
What I usually do is to have some autohotkey macro that does "Select enclosing method" (Alt+Shift+Up) 10 times, then "Restore last selection" (Alt+Shift+Down) 2 times, and bind this to some key-combination.
I then invoke that, and press Ctrl+Alt+Down to duplicate the selection and have my new method.
If I would be really clever I would do Ctrl+Shift+Up and Ctrl+Shift+Down and have the cursor at the beginning of the method identifier.

Well, it would be nice to have something built-in, but one can be inventive to get things done ...