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

Bug 315909

Summary: [extract constant][quick assist] Extract to constant should be available anywhere in a string/number
Product: [Eclipse Project] JDT Reporter: Aaron Digulla <digulla>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, deepakazad, michschn
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix none

Description Aaron Digulla CLA 2010-06-06 14:32:10 EDT
Build Identifier: I20100527-1700

Currently, you have to select the whole string (including quotes) to enable "Extract to constant" in the quick fix menu. It would be nice if Eclipse would simply select the constant I'm in when I press Ctrl+1 inside of a string or number.

Reproducible: Always
Comment 1 Dani Megert CLA 2010-06-07 08:20:58 EDT
Agree.

As a workaround you can use Alt+Shift+Up_Arrow to make the selection.
Comment 2 Markus Keller CLA 2010-06-15 08:51:57 EDT
Created attachment 171921 [details]
Fix

The Extract Constant and Extract Local Variable refactorings already work on the enclosing (or adjacent) expression. Made the quick assists behave the same.
Comment 3 Markus Keller CLA 2010-06-15 08:52:14 EDT
Fixed in HEAD.
Comment 4 Deepak Azad CLA 2010-08-03 07:28:36 EDT
Verified with I20100802-1800 on Ubuntu.
Comment 5 Markus Keller CLA 2010-09-09 15:05:25 EDT
For 3.7 M2, I've released an additional fix to QuickAssistProcessor that drops the relevance of these proposals when the selection is empty.