Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 47816

Summary: Bind Specific QuickFix to a Keystroke [quick fix]
Product: [Eclipse Project] JDT Reporter: David Corbin <dcorbin>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: markus.kell.r, martinae
Version: 3.0   
Target Milestone: 3.1   
Hardware: All   
OS: All   
Whiteboard:

Description David Corbin CLA 2003-12-01 11:15:09 EST
It would be great if I could bind keystrokes to specific quick fixes when in the
Java Editor.
Comment 1 Dirk Baeumer CLA 2003-12-16 14:05:40 EST
This would require to provide actions for all quick fixes.

Comment 2 Guillaume Pothier CLA 2004-11-10 14:48:26 EST
This would be a very useful addition.
For instance, if I want to use the cast quickfix, I have to type the following:
Subclass x = aObject;

Now I need to wait for eclipse to detect the error, which might take time, and
then open the quickfix menu, and select the proper quickfix, which might appear
at any position in the list, according to whatever other quickfix is available.

it would be much nicer to type:
Subclass x = aObject;
And then some keystroke to directly add the cast.

Even nicer would be:
Subclass x = |
Type the keystroke now and get the (Cast) generated. This would propably require
modifying the quickfix itself, so maybe this is a bit overkill.
Comment 3 Martin Aeschlimann CLA 2004-11-11 08:56:24 EST
the suggestion of comment #2 is difficult to implement. That would be 
completly different code and currently be impossible as there's no full AST.
It would also be more of a code assist than a quick assist.

Are there other (better) examples where a key short cut is desired? I could 
think of a shortcut for 'Rename in File' (Local rename)
Comment 4 David Corbin CLA 2004-11-11 09:24:20 EST
I usually know what I'm going to do when I press CTRL-1.  For any that I use 
frequently ("assign to local variable" being one).  I would like to be able to 
just avoid the delay (and sometimes selection process) of waiting for the 
popup to occurr. 
 
If the specific keystroke is not applicable, it should be ignored, or perhaps 
a "bell" sound could be made.  The key point is that Eclipse should provide a 
way to do this for ANY quickfix (proably with none defined by default). 
Comment 5 Martin Aeschlimann CLA 2004-11-11 09:40:08 EST
It's already a problem to list all quick fixes as they depend on the context. 
Example of a 'dynamic' quick fix is 'Rename to XY'
But I was thinking that we give shortcuts to some of them.
You would still press CTRL + 1 and see the list, but proposals would get 
smomething like a mnemonic (speed-key) that you can use to select without 
using the cursor keys
-> CTRL + 1 + r would invoke local rename
What do you think?

Comment 6 Guillaume Pothier CLA 2005-09-30 13:46:05 EDT
Seems this bug could be closed now, there are key bindings for quick assists.
Comment 7 Martin Aeschlimann CLA 2005-10-03 03:40:09 EDT
Thanks, that's right. Fixed in 3.1
Comment 8 Philip Mayer CLA 2005-11-02 04:41:29 EST
Verified in I20051102-0010.