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

Bug 337955

Summary: [quick assist] Allow refactoring of bean property type
Product: [Eclipse Project] JDT Reporter: David Balažic <david.balazic>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P5 CC: markus.kell.r
Version: 3.7Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description David Balažic CLA 2011-02-23 05:27:26 EST
Build Identifier: 20100917-0705

I suggest refactoring the type of a property.

- before:

private String foo;

public void setFoo(String foo){
this.foo = foo;
}

public String getFoo(){
return foo;
}


- action: select Refactor menu on the foo property definition (first line in example code) and select another desired type, eg. Long

- after:


private Long foo;

public void setFoo(Long foo){
this.foo = foo;
}

public Long getFoo(){
return foo;
}


Reproducible: Always
Comment 1 Markus Keller CLA 2011-02-23 06:01:25 EST
This can only work as long as the property is not in use yet, since there's no way to update references to the getter and setter in a way that doesn't change behavior.

This sound like a change that should better be done by hand.
Comment 2 David Balažic CLA 2011-02-23 09:10:20 EST
Limiting all changes to same file is not an option?
Or limiting the change only to property and the getter and setter?
Comment 3 Markus Keller CLA 2011-02-24 08:50:08 EST
(In reply to comment #2)
> Limiting all changes to same file is not an option?
> Or limiting the change only to property and the getter and setter?

OK, we could offer that as a quick assist (Ctrl+1) when the caret is on the type of a property.

Implementation would go into AdvancedQuickAssistProcessor (find the connected nodes and set up linked mode).