Bug 332874 - [quick fix] Assign statement to existing field/local variable
Summary: [quick fix] Assign statement to existing field/local variable
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-17 15:05 EST by Paul Benedict CLA
Modified: 2011-01-04 03:12 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 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.