Bug 332874

Summary: [quick fix] Assign statement to existing field/local variable
Product: [Eclipse Project] JDT Reporter: Paul Benedict <pbenedict>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, deepakazad
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Paul Benedict CLA 2010-12-17 15:05:51 EST
Build Identifier: 

Quick Fix only suggests assigning to new fields or local variables. It would be nice to select existing ones that match type. Show another pop-up window with the existing fields/variables once the fix is selected?

Reproducible: Always

Steps to Reproduce:
1. Put cursor on statement.
2. Press CTRL+1
Comment 1 Ayushman Jain CLA 2010-12-20 00:21:48 EST
Moving to JDT/UI.
Comment 2 Dani Megert CLA 2011-01-03 08:52:13 EST
Can you give more details/examples?
Comment 3 Paul Benedict CLA 2011-01-03 19:38:50 EST
This is a simplistic example. Take for instance this code:

int x = 2;
3; // < cursor at this line

Quick fix gives me the options to:
* Assign statement to new local variable
* Assign statement to new field

I would like the options to be expanded so I can choose compatible existing variables:
* Assign statement to existing local variable 'x'

My initial thought was to list of the existing variables, but that might become too sloppy looking. Another thought is to trigger a dialog where Eclipse can process acceptable type variables/fields for the user to select.